/stats command isnt updating the stats
#1

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;
}
Reply
#2

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

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
Reply
#4

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


Forum Jump:


Users browsing this thread: 1 Guest(s)