help with stats
#1

pawn Код:
CMD:stats(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        new
            string[ 128 ],
            Age = PlayerInfo[ playerid ][ pAge ],
            Stress = PlayerInfo[ playerid ][ pStressweed ],
            Money = GetPlayerCash( playerid )
           
        ;

        new Sex[20];
        if(PlayerInfo[ playerid ][ pSex ] == 1) { Sex = "Male"; }
        else if(PlayerInfo[ playerid ][ pSex ] == 2) { Sex = "Female"; }
       
        new Job[20];
        if(PlayerInfo[ playerid ][ pJob ] == 0) { Job = "None"; }
        else if(PlayerInfo[ playerid ][ pJob ] == 1) { Job = "Drugdealer"; }

        SendClientMessage(playerid, COLOR_LIGHTBLUE, "------------------------------------------------------------------------");
        format(string, sizeof(string), "Name: %s | Money: %d | Age: %d | Sex: %s | Stress: %d | Job: %d", RPName(playerid), Money, Age, Sex, Stress, Job);
        SendClientMessage(playerid, COLOR_GRAD2, string);
    }
    return 1;
}
if my job is 0 it says "78" instead of "none" and if its 1 it says "68" instead of Drugdealer
Reply
#2

pawn Код:
format(string, sizeof(string), "Name: %s | Money: %d | Age: %d | Sex: %s | Stress: %d | Job: %s", RPName(playerid), Money, Age, Sex, Stress, Job);
The job parameter should be a string.
https://sampwiki.blast.hk/wiki/Format
Reply
#3

But you can do like this:

Код:
CMD:info(playerid,params[])
{
ShowPlayerStats(playerid);
return 1;
}
forward ShowPlayerStats(playerid);
public ShowPlayerStats (playerid)
{ 

// code goes here.
return 1;
}
Reply
#4

Thankyou +repp
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)