Stats problem - 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: Stats problem (
/showthread.php?tid=633481)
Stats problem -
Despacito - 01.05.2017
Can someone tell me why this /stats cmd doesnt work?
pawn Код:
CMD:stats(playerid, params[])
{
new id;
sscanf(params, "u", id);
SendClientMessage(playerid,0xFF0000FF, "* You can also do /stats playername/id to check other player's stats.");
if (isnull(params))
{
ShowStats(playerid);
}
else if(IsPlayerConnected(id))
{
ShowStats(id);
}
else SendClientMessage(playerid,COLOR_RED,"* Player is not connected.");
return true;
}
I only get "You can also do /stats playername/id to check other player's stats." message.
This is ShowStats stock:
pawn Код:
stock ShowStats(playerid)
{
new temp[1000];
new info[1000];
format(temp, sizeof(temp), "Kills: %d\n",Player[playerid][Kills]);
strcat(info, temp);
format(temp, sizeof(temp), "Deaths %d\n",Player[playerid][Deaths]);
strcat(info, temp);
format(temp, sizeof(temp), "Score: %i\n",GetPlayerScore(playerid));
strcat(info, temp);
return 1;
}
Re: Stats problem -
GoldenLion - 01.05.2017
Well, you forgot to add ShowPlayerDialog. Also remove these 1000 string sizes. You only need maximum like 50 for the dialog and like 15 for that "temp" string. Also have a look here:
https://sampforum.blast.hk/showthread.php?tid=570635
Re: Stats problem -
Despacito - 01.05.2017
Thanks.