/mystats Command Help
#1

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

%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!
Reply
#3

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!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)