SA-MP Forums Archive
Stats Won't Save... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Stats Won't Save... (/showthread.php?tid=154590)



Stats Won't Save... - Maxips2 - 14.06.2010

Player Stats won't save..
So this is how its defined in my script:

That's on login dialog response:

Quote:

SetPVarInt(playerid, "Logged", 1);
SetTimer("CheckStats",500,1);
//for(new i; i < GetMaxPlayers(); i++){ CheckStats(i);}
SetPlayerScore(playerid, dini_Int(file, "score"));
SetPlayerMoney(playerid, dini_Int(file, "money"));
PlayerInfo[playerid][AdminLevel]=dini_Int(file,"AdminLevel");
PlayerInfo[playerid][Bombs]=dini_Int(file,"Bombs");
PlayerInfo[playerid][PainKillers]=dini_Int(file,"PainKillers");
PlayerInfo[playerid][Level]=dini_Int(file,"Level");
PlayerInfo[playerid][Kills]=dini_Int(file,"Kills");
PlayerInfo[playerid][Deaths]=dini_Int(file,"Deaths");
PlayerInfo[playerid][RemoteBombs]=dini_Int(file,"RemoteBombs");

This is the public(Timer) CheckStats:

Quote:

public CheckStats(playerid)
{
dini_IntSet(file, "money", GetPlayerMoney(playerid));
dini_IntSet(file, "AdminLevel", (PlayerInfo[playerid][AdminLevel]));
dini_IntSet(file, "score", GetPlayerScore(playerid));
dini_IntSet(file, "Bombs", (PlayerInfo[playerid][Bombs]));
dini_IntSet(file, "PainKillers", (PlayerInfo[playerid][PainKillers]));
dini_IntSet(file, "Kills", (PlayerInfo[playerid][Kills]));
dini_IntSet(file, "Deaths", (PlayerInfo[playerid][Deaths]));
dini_IntSet(file, "Level", (PlayerInfo[playerid][Level]));
dini_IntSet(file, "RemoteBombs", (PlayerInfo[playerid][RemoteBombs]));
return 1;
}




Re: Stats Won't Save... - MadeMan - 14.06.2010

You need to define file.

pawn Код:
new playername[24];
GetPlayerName(playerid, playername, 24);
format(file, sizeof(file), "%s.ini", playername);



Re: Stats Won't Save... - Maxips2 - 14.06.2010

i already have it defined
new file[128];
OnDialogResponse:
format(file, 128, "%s.ini", GetName(playerid));


Re: Stats Won't Save... - MadeMan - 14.06.2010

You need to define it in public CheckStats(playerid) too.


Re: Stats Won't Save... - Maxips2 - 14.06.2010

I did now, let me test it