[HELP] Command
#4

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(kick,4,cmdtext);
    //dcmd([command name],[length of the name],cmdtext);
    return 0;
}

dcmd_kick(playerid, params[])
{
    new id, reason[128];
    if (GetPVarInt(playerid,"AdminLvl") >= 1)
    {
        if (sscanf(params, "us", id, reason))
        {
            UsageMsg(playerid, "USAGE: /Kick <PlayerID/PartOfName> <Reason>");
        }
        else if (id == INVALID_PLAYER_ID) ErrorMsg(playerid, "That player is not found");
        else if(id == playerid) ErrorMsg(playerid,"Use /q");
        else if(GetPVarInt(id,"AdminLvl") > GetPVarInt(playerid,"AdminLvl")) ErrorMsg(playerid,"You cannot use this command on player with higher admin level!");
        else
        {
            ServerMsg(id," ");
            ServerMsg(id," ");
            ServerMsg(id," ");
            SendFMessage(id,cInfo,"You have been kicked by Admin %s. Reason: %s",pName[playerid],reason);
            SendFMessageToAll(cInfo,"%s was kicked by Admin. Reason: %s",pName[id],reason);
            Kick(id);
        }
    }
    else return ErrorMsg(playerid,"You are not authorized to use this command.");
    return 1;
}
Just change "ErrorMsg", "SystemMsg" and "SendFMessage" to your own SendClientMessage functions.. :P
Reply


Messages In This Thread
[HELP] Command - by Larsey123IsMe - 15.01.2011, 01:00
Re: [HELP] Command - by *IsBack - 15.01.2011, 09:35
Re: [HELP] Command - by Larsey123IsMe - 15.01.2011, 11:28
Re: [HELP] Command - by *IsBack - 15.01.2011, 14:52

Forum Jump:


Users browsing this thread: 2 Guest(s)