SendClientMessageEx(playerid, COLOR_GREY, "User Statistics for {665353}%s(%d) {AFAFAF}- Database ID: {665353}%d", GetName(playerid), playerid, PlayerInfo[playerid][ID]);
Target's stats here
set the targetid default value to -1. whenever its equal to -1 you check for your own stats, else you check for others
|
Hello, how can i make so a player can use /stats to view their own stats, or someone else's stats by doing /stats [targetid]
EX: if he does /stats, this will show up: PHP код:
PHP код:
|
new id, string[64];
if(sscanf(params, "u", id))
{
// FOR TARGET ID
return 1;
}
else
{
//FOR YOURSELF
}
maybe this code can help you
PHP код:
|
CMD:stats(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] > 11)
{
new giveplayerid, string[64];
if(sscanf(params, "u", giveplayerid))
{
SendClientMessageEx(playerid, COLOR_GREY, "User Statistics for {665353}%s(%d) {AFAFAF}- Database ID: {665353}%d", GetName(playerid), playerid, PlayerInfo[playerid][ID]);
return 1;
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, "User Statistics for {665353}%s(%d) {AFAFAF}- Database ID: {665353}%d", GetName(giveplayerid), PlayerInfo[giveplayerid][ID], PlayerInfo[giveplayerid][ID]);
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "{A9A9A9}ERROR: You don't have permission to use command.");
return 1;
}
return 1;
}