CMD:kick(playerid, params[], help)
{
if(Info[playerid][Level] >= 2)
{
new id, reason[50],string[128];
if(sscanf(params, "uS()[50]", id, reason)) return SCM(playerid, red, "Kick player: /kick <PlayerID> <Reason>");
if(id == INVALID_PLAYER_ID) return SCM(playerid, red, "Invalid player id");
if(Info[playerid][Level] <= Info[id][Level]) return ShowMessage(playerid, red, 6);
if(!isnull(reason))
format(string,sizeof(string),"%s %s has kicked %s: %s",GetLevel(playerid),GetName(playerid),GetName(id),reason);
else format(string,sizeof(string),"%s %s has kicked %s",GetLevel(playerid),GetName(playerid),GetName(id));
SendClientMessageToAll(red,string);
return DelayKick(id);
}
else return ShowMessage(playerid, red, 1);
}
SetTimerEx("KickTimer", 1000, false, "is", id, reason);
forward KickTimer(playerid, reason[]); public KickTimer(playerid, reason[]) { Kick(playerid); SendCLientMessageToAll(BLUE, reason); return 1; }
Info[id][newkickvariable] = gettime()+240; //4 minutes
public OnPlayerConnect(playerid) { if(Info[id][newkickvariable] > gettime()) { //send message and kick them DelayKick(playerid); } }
Use timer
Code:
SetTimerEx("KickTimer", 1000, false, "is", id, reason); Code:
forward KickTimer(playerid, reason[]); public KickTimer(playerid, reason[]) { Kick(playerid); SendCLientMessageToAll(BLUE, reason); return 1; } |