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]);
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