15.01.2011, 14:52
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;
}