/mystats Command Help - 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: /mystats Command Help (
/showthread.php?tid=487599)
/mystats Command Help -
UnknownOwner - 14.01.2014
Maybe simple answer, but when i do /mystats ingame, i don't get the values like AdminLevel: 1 etc. I only get AdminLevel:.
Please help me:
Код:
CMD:mystats(playerid, params[])
{
new string[246];
format(string, sizeof(string), "Admin Level: %s \nVIP: %s \nMoney: %s \nScores: %s \nKills: %s \nDeaths: %s", pInfo[playerid][Adminlevel],pInfo[playerid][VIPlevel], pInfo[playerid][Money],pInfo[playerid][Scores],pInfo[playerid][Kills],pInfo[playerid][Deaths]);
SendClientMessage(playerid, -1, string);
return 1;
}
Re: /mystats Command Help -
SilentSoul - 14.01.2014
%s is used for strings like (UnkownGamer) , you want to receive integers ( 1,2,3,) so you should use
%d
pawn Код:
CMD:mystats(playerid, params[])
{
new string[128]; //also here you used big string cell , and this string shouldn't exceed 128 letters
format(string, sizeof(string), "Admin Level: %d \nVIP: %d \nMoney: %d \nScores: %d \nKills: %d \nDeaths: %d", pInfo[playerid][Adminlevel],pInfo[playerid][VIPlevel], pInfo[playerid][Money],pInfo[playerid][Scores],pInfo[playerid][Kills],pInfo[playerid][Deaths]);
SendClientMessage(playerid, -1, string);
return 1;
}
Take a look here :
https://sampwiki.blast.hk/wiki/Format
Also you used
\n it won't switch to new line because it only works on dialogs not ClientMessages!
Re: /mystats Command Help -
UnknownOwner - 14.01.2014
Quote:
Originally Posted by SilentSoul
%s is used for strings like (UnkownGamer) , you want to receive integers ( 1,2,3,) so you should use %d
pawn Код:
CMD:mystats(playerid, params[]) { new string[128]; //also here you used big string cell , and this string shouldn't exceed 128 letters format(string, sizeof(string), "Admin Level: %d \nVIP: %d \nMoney: %d \nScores: %d \nKills: %d \nDeaths: %d", pInfo[playerid][Adminlevel],pInfo[playerid][VIPlevel], pInfo[playerid][Money],pInfo[playerid][Scores],pInfo[playerid][Kills],pInfo[playerid][Deaths]); SendClientMessage(playerid, -1, string); return 1; }
Take a look here : https://sampwiki.blast.hk/wiki/Format
Also you used \n it won't switch to new line because it only works on dialogs not ClientMessages!
|
My bad XD It worked thx!