22.08.2012, 11:10
You need to let the sscanf code execute first before you get the details about the player. 'targetid' is 0 until the sscanf code detects who the player is you're using the command on.
pawn Код:
CMD:getplayerstats(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] <= 2) return SendClientMessage(playerid, COLOR_RED, "Error Occured: This command is only for Admins.");
new str[128], TargetName[MAX_PLAYER_NAME], IP[16], targetid;
if(sscanf(params,"u", targetid)) return SendClientMessage(playerid, 0xFFFFFFF, "[ADMIN]/getplayerstats [playerid/name]");
new Money = GetPlayerMoney(targetid);
PlayerNameGet(targetid, TargetName, 24);
GetPlayerIp(targetid,IP,sizeof IP);
format(str, 128, ""#COL_WHITE"=======================[%s statistics]=======================", TargetName);
SendClientMessage(playerid,COLOR_WHITE,str);
format(str,128, ">"#COL_WHITE"%s: IP[%s] - Money[$%i] - Kills[%i] - Deaths[%i] - Admin[%i] - Skin[%i]", TargetName, IP, Money, PlayerInfo[targetid][pKills], PlayerInfo[targetid][pDeaths], PlayerInfo[targetid][pAdmin], GetPlayerSkin(targetid));
SendClientMessage(playerid,COLOR_WHITE,str);
return 1;
}