if(strcmp("/kick", cmd, true) == 0)
{
if(PlayerInfo[playerid][pAdminLevel] >= 1)
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp))
{
return SendClientMessage(playerid,COLOR_LIGHTRED,"USAGE: /kick [id] [reason]");
}
new id = strval(tmp);
new pid = playerid;
new reason[128];
reason = strrest(cmdtext, idx);
if (!strlen(reason)) return SendClientMessage(playerid,COLOR_LIGHTRED,"USAGE: /kick [id] [reason]");
if(!IsPlayerConnected(id))
{
return SendClientMessage(playerid,COLOR_GRAY,"AdmCmd This player is not online!");
}
PlayHintSoundAtPos(playerid);
new globalmsg[100];
new adminid[MAX_PLAYERS], victimid[MAX_PLAYERS];
GetPlayerName(pid, adminid, sizeof(victimid));
GetPlayerName(id, victimid, sizeof(victimid));
format(globalmsg,sizeof(globalmsg),"AdmWarn: Administrator %s has kicked player %s [%s]",adminid,victimid,reason);
SendClientMessageToAll(COLOR_LIGHTBLUE,globalmsg);
Kick(id);
return 1;
}
else
{
SendClientMessage(playerid,COLOR_GRAY,"You don't have authorization.");
return 1;
}
}
COMMAND:kick(playerid, params[])
{
if(PlayerInfo[playerid][pAdminLevel] >= 1)
{
new pid = playerid, reason[128], id = strval(tmp);
if(sscanf(params, "us[128]", player, reason)) return SendClientMessage(playerid,COLOR_LIGHTRED,"USAGE: /kick [id] [reason]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,COLOR_GRAY,"AdmCmd This player is not online!");
PlayHintSoundAtPos(playerid);
new globalmsg[100];
new adminid[MAX_PLAYERS], victimid[MAX_PLAYERS];
GetPlayerName(pid, adminid, sizeof(victimid));
GetPlayerName(id, victimid, sizeof(victimid));
format(globalmsg,sizeof(globalmsg),"AdmWarn: Administrator %s has kicked player %s [%s]",adminid,victimid,reason);
SendClientMessageToAll(COLOR_LIGHTBLUE,globalmsg);
Kick(id);
}
else SendClientMessage(playerid,COLOR_GRAY,"You don't have authorization.");
return 1;
}
fcmd(kick,playerid)
{
if(PlayerInfo[playerid][pAdminLevel] < 1)
return SendClientMessage(playerid,COLOR_GRAY,"You don't have authorization.");
if(!iParams[1] || !iParams[2])
return SendClientMessage(playerid,COLOR_LIGHTRED,"USAGE: /kick [id] [reason]");
static id;
id = strval(iParams[1]);
if(!IsPlayerConnected(id)
return SendClientMessage(playerid,COLOR_GRAY,"AdmCmd This player is not online!");
PlayHintSoundAtPos(playerid);
new globalmsg[100];
new adminid[MAX_PLAYERS], victimid[MAX_PLAYERS];
GetPlayerName(pid, adminid, sizeof(victimid));
GetPlayerName(id, victimid, sizeof(victimid));
format(globalmsg,sizeof(globalmsg),"AdmWarn: Administrator %s has kicked player %s [%s]",adminid,victimid,reason);
SendClientMessageToAll(COLOR_LIGHTBLUE,globalmsg);
Kick(id);
return true;
}
^^If someone translate that thread(fcmd) to English, Japanese or Greek I would really appreciate it.
|
command(kick, playerid, params[])
{
new ID, string[128], reason[66];
if(PlayerInfo[playerid][pAdminLevel] >= 1) return SendClientMessage(playerid, 0xFFFF00AA,"You don't have authorization.");
if(sscanf(params, "uS(No Reason Given)[65]", ID, reason)) SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /kick [id] [optional: reason]");
else if(ID == INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_LIGHTBLUE, "AdmCmd This player is not online!");
else
{
format(string,sizeof(string), "You have been kicked by Administrator %s Reason: %s", adminid,reason);
SendClientMessage(ID , COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "You have kicked %s %s", victimid, reason);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "Administrator/VIP %s has kicked %s %s",adminid,victimid,reason);
SendClientMessageToAll( COLOR_LIGHTBLUE, string );
TogglePlayerControllable(ID, false);
Kick(ID);
}
return 1;
}