| Mirage Source http://web.miragesource.net/forums/ |
|
| Server Loop Help http://web.miragesource.net/forums/viewtopic.php?f=193&t=4617 |
Page 1 of 1 |
| Author: | deathknight [ Fri Oct 24, 2008 11:49 am ] |
| Post subject: | Server Loop Help |
Ok, I'm not quite sure how to do this. I know what I WANT to do, I just haven't figured out how. So I'm trying to make a code in the server loop that every 10 seconds looks at all the players online, and updates a stat I created for them. I'm working on a fishing system, and I'm coding it up one piece at a time, to get all the error straight before hand. SPOILER: (click to show)
|
|
| Author: | Jacob [ Fri Oct 24, 2008 1:56 pm ] |
| Post subject: | Re: Server Loop Help |
First thing i see is Code: fishness As Byte Why is that a byte when GetPlayerStat returns a long? Code: fishness = Int(GetPlayerStat(index, Stats.canfish)) Where are you getting this 'index' from? Code: Call SetPlayerStat(index, Stats.canfish, GetPlayerStat(index, Stats.canfish) - fishness) index again? |
|
| Author: | deathknight [ Fri Oct 24, 2008 2:08 pm ] |
| Post subject: | Re: Server Loop Help |
I'm not sure about the index, I was trying to find a way to do it, and as far as I can tell, the code throughout the server side always pops up similar to Code: Int(GetPlayerStat(Index, Stats.defense) I tried removing the index (forget the error code I got for that), and i tried putting in I instead of index (not sure why I tried that, some stupid part of my mind slipped out when I tried that one I guess). I figured the error involved the index. I got the second part of the code Code: Call SetPlayerStat(index, Stats.canfish, GetPlayerStat(index, Stats.canfish) - fishness) from the stat update part of the server, and it worked when I created another sub that was called when a player used an item. I try to understand everything I add, but alot of it I do not understand, I just know what works and what doesn't work.Edit*** I got it working. It may have been a problem with dimming it as a byte (I'm not sure) but the final working code was Code: Private Sub UpdatePlayerFishing() Dim i As Long, fishness As Long For i = 1 To MAX_PLAYERS If IsPlaying(i) Then fishness = GetPlayerStat(i, Stats.canfish) If fishness >= 1 Then Call SetPlayerStat(i, Stats.canfish, GetPlayerStat(i, Stats.canfish) - fishness) Else End If End If Next i End Sub Thanks for your help Dugor. |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|