Problem with save file -
Face9000 - 16.01.2012
Hello,i've a problem with a save some stats in a fine.I used this code to save the total N° of players kills.
Here is:
OnGameModeInit:
pawn Код:
TotalKills = dini_Int("/LOGS/sestats.txt","TotalKills");
OnPlayerDeath:
The problem is,it logs the kills but if i restart the server,the Players Kills Stats are set to 0.How to fix this and save it in a file?
Re: Problem with save file -
Face9000 - 16.01.2012
Sorry for hour bump but it's important..
Re: Problem with save file -
Wesley221 - 16.01.2012
You probably dont have 'dini_IntSet()' in your script, so it adds one to the variable, but doesnt save in the file.
Re: Problem with save file -
Jaxson - 16.01.2012
Add this below "TotalKills++" under OnPlayerDeath callback.
Код:
dini_IntSet("/LOGS/sestats.txt","TotalKills", TotalKills);
Re: Problem with save file -
thimo - 16.01.2012
What wesley says! :P
Re: Problem with save file -
Face9000 - 16.01.2012
Quote:
Originally Posted by Wesley221
You probably dont have 'dini_IntSet()' in your script, so it adds one to the variable, but doesnt save in the file.
|
So,i've to add the dini_IntSet(TotalKills) under the TotalKills++ variable?
Quote:
Originally Posted by Jaxson
Have you loaded the variable mentioned above when player logs in?
|
OnGameModeInit,not when player login.
Re: Problem with save file -
Wesley221 - 16.01.2012
Quote:
Originally Posted by Logitech90
So,i've to add the dini_IntSet(TotalKills) under the TotalKills++ variable?
OnGameModeInit,not when player login.
|
When you restart the server (i assume you restart it with /rcon gmx?), you should add a line under 'OnGameModeExit':
pawn Код:
dini_IntSet(filelocation, "Totalkills", TotalKills);
Not sure what the params are with dini, but should look like this
Re: Problem with save file -
Jaxson - 16.01.2012
Quote:
Originally Posted by Logitech90
So,i've to add the dini_IntSet(TotalKills) under the TotalKills++ variable?
OnGameModeInit,not when player login.
|
Yeah, I've just noticed and edited my post.
Quote:
Originally Posted by Jaxson
Add this below "TotalKills++" under OnPlayerDeath callback.
Код:
dini_IntSet("/LOGS/sestats.txt","TotalKills", TotalKills);
|
Re: Problem with save file -
Face9000 - 16.01.2012
Thanks,ok then:
pawn Код:
dini_IntSet("/LOGS/sestats.txt","TotalKills", TotalKills);
is to parse TotalKills in the file.
And to read it again if server restarts?
Re: Problem with save file -
Jaxson - 16.01.2012
Yes, you need to load the variable again when the server starts. OnGameModeInit callback.