help with 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: help with stats (
/showthread.php?tid=433415)
help with stats -
Michael_Cuellar - 27.04.2013
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
Re: help with stats -
DanLore - 27.04.2013
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
Re: help with stats -
Renas - 27.04.2013
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;
}
Re: help with stats -
Michael_Cuellar - 27.04.2013
Thankyou +repp