SA-MP Forums Archive
/stats command isnt updating the stats - 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)
+--- Thread: /stats command isnt updating the stats (/showthread.php?tid=469853)



/stats command isnt updating the stats - efrim123 - 15.10.2013

Hello someone helped me out make a stats command
but when i increase my score by robbing shops it dosent update the new score i get

Here is my code:
pawn Код:
CMD:stats(playerid,params[])
{
    new admin = pInfo[playerid][Adminlevel], //User's admin level
        vip = pInfo[playerid][VIPlevel], //User's vip level
        regularplayerlevel = pInfo[playerid][Regularlevel],
        cash = GetPlayerMoney(playerid), //User's money
        scores = pInfo[playerid][Scores],
        crank = pInfo[playerid][Coprank],
        kills = pInfo[playerid][Kills], //User's kills
        deaths = pInfo[playerid][Deaths]; //User's deaths
    new string[500];
    format(string,sizeof(string),"Admin level: %i\nVip level: %i\nRegularPlayerLevel: %i\nCash: %d\nScores: %i\nCop rank: %i\nKills: %i\nDeaths: %i",admin,vip,regularplayerlevel,cash,scores,crank,kills,deaths);
    ShowPlayerDialog(playerid,DIALOG_STATS,DIALOG_STYLE_MSGBOX,"Your status",string,"Ok",""); // define the DIALOG_STATS on the top
    return 1;
}



Re: /stats command isnt updating the stats - verlaj - 15.10.2013

use a timer to update player scores and stuff, example is.. INI_WriteInt(file,"Scores",GetPlayerScore(playerid ));


Re: /stats command isnt updating the stats - zT KiNgKoNg - 15.10.2013

Quote:
Originally Posted by verlaj
Посмотреть сообщение
use a timer to update player scores and stuff, example is.. INI_WriteInt(file,"Scores",GetPlayerScore(playerid ));
I've goto say you're wrong here, if you actually change the data vars in the Enum in lets say /setadminlevel [playerid] [level] then save the stats on disconnect with a stock or function it'll always be updated no matter what you're doing, using a timer to save or load information A. is inaffective And B. a down right stupid idea.


EG.
pawn Код:
pInfo[playerid][AdminLevel] = 5458755363;

new str[40];
format(str,sizeof(str),"Administration Level: [%d]",pInfo[playerid][AdminLevel]);
SendClientMessage(playerid, 0xFF43AA, str);

// You can change the color because i just made it up



Re: /stats command isnt updating the stats - Harish - 15.10.2013

Check that you add pInfo[playerid][Scores]+=1 on robbing function.