Mirage Source http://miragesource.net/forums/ |
|
Saving players http://miragesource.net/forums/viewtopic.php?f=210&t=868 |
Page 1 of 1 |
Author: | Jobs [ Mon Dec 18, 2006 4:00 am ] |
Post subject: | Saving players |
Well...I've gotten rid of the server saving players (just comment stuff out) and made it so players have to save themselves...but some of them go afk, and I wanna restart the server, but I don't want them to lose their data.. So I added a button to the server to save the players when I press it, but it's not working, and I dunno why, here's the code: Code: Private Sub Command70_Click()
Dim I As Long 'If PlayerI <= MAX_PLAYERS Then If IsPlaying(PlayerI) Then Call SavePlayer(PlayerI) Call PlayerMsg(PlayerI, GetPlayerName(PlayerI) & " is now saved.", Yellow) End If ' PlayerI = PlayerI + 1 'End If 'If PlayerI >= MAX_PLAYERS Then ' PlayerI = 1 ' PlayerTimer.Enabled = False ' tmrPlayerSave.Enabled = True 'End If End Sub Any advice? |
Author: | Rian [ Mon Dec 18, 2006 5:11 am ] |
Post subject: | |
Seems like playerI doesn't have any reference Code: Dim I As Long
For I = 0 To MAX_PLAYERS Call SavePlayer(I) Next I I think that's all you'd really need to save all the players. Does it just not work, or do you get an error of some sort? |
Author: | Jobs [ Mon Dec 18, 2006 6:18 am ] |
Post subject: | |
rte 9 Code: FileName = App.Path & "\accounts\" & Trim(Player(index).Login) & ".ini" in here Code: Sub SavePlayer(ByVal index As Long)
|
Author: | Rian [ Mon Dec 18, 2006 7:14 am ] |
Post subject: | |
Do you get the RTE 9 using your code, or the code I gave you to use? |
Author: | William [ Mon Dec 18, 2006 9:39 am ] |
Post subject: | |
Im pretty sure the Index is above 0. So try this: Code: Dim I As Long
For I = 1 To MAX_PLAYERS Call SavePlayer(I) Next I |
Author: | Lea [ Mon Dec 18, 2006 12:51 pm ] |
Post subject: | |
make it save players when A) The server shuts off, or B) The Player logs off. That way, unless your server crashes, you wont lose anything |
Author: | Jobs [ Mon Dec 18, 2006 4:04 pm ] |
Post subject: | |
The whole problem was the server lagged like crazy when a person logged off. So I had to get rid of it there, and I got a RTE with your code, mine just didn't work. Edit: Wow...I feel stupid, I didn't realise there was a saveallplayers thing, all I had to do was put Call SaveAllPlayersOnline and it works like a charm. Thanks for the help everyone! ^_^ |
Author: | Dragoons Master [ Mon Dec 18, 2006 10:15 pm ] |
Post subject: | |
You need to check if that player(index) is online or not xD Code: Dim I As Long
For I = 0 To MAX_PLAYERS If IsPlaying(I) Then Call SavePlayer(I) End If Next I That should work EDIT: sry, I didn't read all your last post Jobs... |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |