28.10.2010, 08:02
pawn Код:
dcmd_kick(playerid,params[])
{
if(PlayerInfo[playerid][AdminLevel] < 1) return SendClientMessage(playerid, COLOUR_RED, "You need to be admin to use this command");
else
{
new Index;
new tmp[256]; tmp = strtok(params,Index);
new tmp2[256]; tmp2 = strtok(params,Index);
if(!strlen(params)) return
SendClientMessage(playerid, COLOUR_RED, "Usage: /kick [ID] [Reason]") &&
SendClientMessage(playerid, COLOUR_RED, "NOTE: You don't have to put the reason if you don't want to");
new player1;
new string[128];
new playername[MAX_PLAYER_NAME];
new adminname [MAX_PLAYER_NAME];
player1 = strval(tmp);
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid && (PlayerInfo[player1][AdminLevel]))
{
GetPlayerName(player1, playername, sizeof(playername));
GetPlayerName(playerid, adminname, sizeof(adminname));
if(!strlen(tmp2))
{
format(string,sizeof(string),"%s got kicked by Administrator %s . Reason:No reason given",playername,adminname);
SendClientMessageToAll(COLOUR_ORANGE,string);
Kick(player1);
}
else
{
format(string,sizeof(string),"%s got kicked by Administrator %s . Reason: %s.",playername,adminname,params[2]);
SendClientMessageToAll(COLOUR_ORANGE,string);
Kick(player1);
}
}
}
}
return 1;
}