SA-MP Forums Archive
Deaths dont 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: Deaths dont save. (/showthread.php?tid=199794)



Deaths dont save. - Face9000 - 16.12.2010

Hi all,i've a problem...deaths dont save.Here is what variables server save when someone /register.

Код:
	  dini_Create(file);
			  dini_IntSet(file,"Password", udb_hash(tmp));
			  dini_IntSet(file,"AdminLevel", 0);
			  dini_IntSet(file,"Cash", 0);
			  dini_IntSet(file,"Score", 0);
			  dini_IntSet(file,"Deaths", deaths[playerid]);
And login:

Код:
	new playername[MAX_PLAYER_NAME];
				 	SetPlayerMoney(playerid, dini_Int(file, "Cash"));
				 	SetPlayerScore(playerid, dini_Int(file, "Score"));
				 	deaths[playerid] = dini_Int(udb_encode(playername), "deaths");
					PlayerInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
And this is OnPlayerDisconnect added values:

Код:
 new file[256];
    new playername[24];
    new name[MAX_PLAYERS];
    GetPlayerName(playerid, name, sizeof(name));
    format(file,sizeof(file),"%s.ini",name);
    dini_IntSet(file,"AdminLevel",PlayerInfo[playerid][AdminLevel]);
    dini_IntSet(file,"Cash",GetPlayerMoney(playerid));
    dini_IntSet(file,"Score",GetPlayerScore(playerid));
    deaths[playerid] = dini_Int(udb_encode(playername), "deaths");
And i've added:

Код:
new deaths[MAX_PLAYERS];
On the top of the gm.


Re: Deaths dont save. - Face9000 - 17.12.2010

BUMP,it's pretty urgent...


Re: Deaths dont save. - XePloiT - 17.12.2010

pawn Код:
new file[256];
    new playername[24];        
    new name[MAX_PLAYERS];
    GetPlayerName(playerid, name, sizeof(name));
    format(file,sizeof(file),"%s.ini",name);
    dini_IntSet(file,"AdminLevel",PlayerInfo[playerid][AdminLevel]);
    dini_IntSet(file,"Cash",GetPlayerMoney(playerid));
    dini_IntSet(file,"Score",GetPlayerScore(playerid));
    deaths[playerid] = dini_Int(file, "deaths"); // changed line... you putted playrname instead of file

//at the login the same
deaths[playerid] = dini_Int(file, "deaths");