Respawn command
#4

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:

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;
}
!strlen means if it's not the string length of the params (admin didn't include id, only typed /respawn), in this case: targetid.
Reply


Messages In This Thread
Respawn command - by Kingunit - 17.08.2011, 02:21
Re: Respawn command - by ElieJabbour - 17.08.2011, 02:29
Re: Respawn command - by Kingunit - 17.08.2011, 02:31
Re: Respawn command - by grand.Theft.Otto - 17.08.2011, 03:02
Re: Respawn command - by ElieJabbour - 17.08.2011, 03:07
Re: Respawn command - by Mozz - 17.08.2011, 03:15
Re: Respawn command - by Kingunit - 17.08.2011, 12:38
Re: Respawn command - by MadeMan - 17.08.2011, 15:01
Re: Respawn command - by Kingunit - 17.08.2011, 15:33

Forum Jump:


Users browsing this thread: 4 Guest(s)