SA-MP Forums Archive
Dudb Stats Saver - 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: Dudb Stats Saver (/showthread.php?tid=176042)



Dudb Stats Saver - bennyisme - 11.09.2010

So i have a admin script with dudb. It saves to the file and when i do /stats it shows the amount of deaths but when i reload the filter script and do /stats it doesn't show the kills/deaths but when i go to the player file it does.
Код:
dcmd_stats(playerid,params[])
{
	new string[128];
	new pDeaths;
	new player1;

	if(!strlen(params)) player1 = playerid;
	else player1 = strval(params);
	
	new pname[MAX_PLAYER_NAME];
	GetPlayerName(playerid, pname, sizeof(pname));
	
	if(IsPlayerConnected(player1))
	{
	if(PlayerData[player1][Deaths] == 0) pDeaths = 1;
	else pDeaths = PlayerData[player1][Deaths];
	format(string, sizeof(string), "|- %s's Statistics -|",pname);
	SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
	format(string, sizeof(string), "Kills: [%d] | Deaths: [%d] | Ratio: [%0.2f] | Money: [$%d]|", PlayerData[player1][Kills], PlayerData[player1][Deaths], Float:PlayerData[player1][Kills]/Float:pDeaths,GetPlayerMoney(player1));
	return SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
	} else
  	return SendClientMessage(playerid,COLOR_GREY,"Incorrect playerid.");
}
Код:
	if(udb_Exists(PlayerName(playerid)))
	{
    	PlayerData[playerid][Deaths] ++;
	}
	if(udb_Exists(PlayerName(killerid)))
	{
		PlayerData[killerid][Kills] ++;
	}
	dUserSetINT(PlayerName(playerid)).("Kills", PlayerData[playerid][Kills]);
    dUserSetINT(PlayerName(playerid)).("Deaths", PlayerData[playerid][Deaths]);
playerfile
Код:
Kills=0
Deaths=2
shows before i reloadfs with /stats but after i reload fs it shows 0 kills 0 deaths for /stats but the same for player file until i die again. then the stats reset


Re: Dudb Stats Saver - bennyisme - 02.10.2010

bump please help