21.08.2015, 15:15
Hello
QUESTION 1
Well, I did this code, but I would like to know if, thanks to this, we can type /stats [ID] and have the stats of the person that i type the id ?
Because, I typed /stats for test, it writes my stats, but if I type /stats myid. It don't work.
How can modificate it to do it for all players ?
QUESTION 2.
Is that is correct ? I want in this example, that only if the person where I want see stats, is register and logged, i can see the money of him. But I think its linked to question 1.
Thanks
QUESTION 1
Well, I did this code, but I would like to know if, thanks to this, we can type /stats [ID] and have the stats of the person that i type the id ?
Because, I typed /stats for test, it writes my stats, but if I type /stats myid. It don't work.
How can modificate it to do it for all players ?
Код:
CMD:stats(playerid,params[]) { new id, tmp[50], string[1028]; sscanf(params, "u", id); if (isnull(params)) { format(tmp, sizeof(tmp), "Score: %d\n", GetPlayerScore(playerid)); strcat(string, tmp); format(tmp, sizeof(tmp), "Money: $%d\n", GetPlayerMoney(playerid)); strcat(string, tmp); ShowPlayerDialog(playerid, 325, DIALOG_STYLE_MSGBOX, "Stats", string, "Ok",""); } return 1; }
Код:
CMD:stats(playerid,params[]) { new id, tmp[50], string[1028]; sscanf(params, "u", id); if (isnull(params)) { format(tmp, sizeof(tmp), "Score: %d\n", GetPlayerScore(playerid)); strcat(string, tmp); if(IsPlayerConnected(player1)) { format(tmp, sizeof(tmp), "Money: $%d\n", GetPlayerMoney(playerid)); strcat(string, tmp); ShowPlayerDialog(playerid, 325, DIALOG_STYLE_MSGBOX, "Stats", string, "Ok",""); } else return format(tmp, sizeof(tmp), "\n"); strcat(string, tmp); } return 1; }
Thanks