Drug System problem
#1

Okay, I have a drug system and I use dUserSetInt to save player data into a .txt file for all accounts in scriptfiles. I just made it so when someone buys drugs, it will save it in their user file also, just like money, score etc... When I purchase the drugs then /quit the game the drugs save (thankfully) and rejoin, the drugs are still there (thankfully lol). But the problem is if I close the server or gmx (restart) it, the drugs set are deleted in-game and are also set to 0 in the user file. I tried putting this line under OnGameModeInit and Exit:

pawn Код:
if(udb_Exists(PlayerName2(playerid))) dUserSetINT(PlayerName2(playerid)).("drugs",playerdrugs[playerid]);
but obviously doesn't work and doesn't compile because playerid isn't defined as default in OnGameModeInit and Exit, I also tried making a loop for those 2 callbacks:

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
   if(udb_Exists(PlayerName2(i))) dUserSetINT(PlayerName2(i)).("drugs",playerdrugs[i]);
}
it compiles, but doesnt work ingame either :S

So my question is how do I get it to save on game mode restart or when i close the server, because the drugs only saves if someone disconnects and rejoins which is good, but doesnt save when the server restarts/closes.

Thanks.
Reply


Messages In This Thread
Drug System problem - by grand.Theft.Otto - 30.06.2011, 18:54
Re: Drug System problem - by grand.Theft.Otto - 01.07.2011, 18:20
Re: Drug System problem - by =WoR=Varth - 02.07.2011, 00:20
Re: Drug System problem - by Shadoww5 - 02.07.2011, 01:46
Re: Drug System problem - by Skylar Paul - 02.07.2011, 03:42
Re: Drug System problem - by Shadoww5 - 02.07.2011, 03:59
Re: Drug System problem - by [HiC]TheKiller - 02.07.2011, 05:03

Forum Jump:


Users browsing this thread: 4 Guest(s)