Stats problem
#1

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

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

Thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)