17.08.2011, 03:02
He can't use playerid.
Playerid = admin/default person using the command.
Try this one, it isn't using sscanf, but works the same way:
!strlen means if it's not the string length of the params (admin didn't include id, only typed /respawn), in this case: targetid.
Playerid = admin/default person using the command.
Try this one, it isn't using sscanf, but works the same way:
pawn Код:
CMD:respawn(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,COLOR_RED,".:: You are not authorized to use this command ::.");
new targetid;
targetid = strval(params); // string value
if(!strlen(params)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /respawn [name / id]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, ""#COL_ORANGE"[ERROR]"#COL_LRED" Player not connected!");
new string[128];
new pName[24], pTame[24];
GetPlayerRame(playerid,pName,24);
GetPlayerRame(targetid,pTame,24);
format(string,sizeof string,""#COL_ORANGE"[SERVER]"#COL_LRED" %s has been respawned by Administrator %s.",pTame,pName);
SendClientMessageToAll(COLOR_RED, string);
SpawnPlayer(targetid);
return 1;
}