CMD:kick(playerid,params[])
{
if(pInfo[playerid][pAdminLevel] >= 1)
{
new targetid,reason[105],string[180];
if(sscanf(params, "us[105]", targetid,reason)) return SendClientMessage(playerid,-1,""COL_RED"AdmCmds: /kick [PlayerID] [Reason]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""COL_RED"Error!");
if(!IsPlayerNPC(targetid))
{
format(string, sizeof(string), ""COL_RED"AdmCmds: %s %s has kicked %s"COL_WHITE" [Reason: %s]",GetAdminName(playerid),PlayerName(playerid),PlayerName(targetid),reason);
SendClientMessageToAll(-1,string);
format(jQuery, MAX_QUERY_LENGTH, "INSERT INTO `"#sanctionlog"` (Username, Targetname, Comanda, Motivul, Data) VALUES ('%s', '%s', 'KICK', '%s', CURRENT_TIMESTAMP)",PlayerName(playerid), PlayerName(targetid), reason);
mysql_tquery(handle, jQuery, "", "");
Kick(targetid);
}
else return SendClientMessage(playerid,-1,""COL_RED"ENPCe!");
}
else {
SendClientMessage(playerid,-1,""COL_RED"Error: Notadmin!");
}
return 1;
}
for (new i; i <= GetPlayerPoolSize(); i++) { if(IsPlayerConnected(playerid)) { if(i != targetid) { SendClientMessage(i, -1, sprintf("AdmCmds: %s was kicked by %s, reason: %s", name, adminname, reason)); } } }
foreach (new i : Player) { if(i != targetid) { SendClientMessage(i, -1, sprintf("AdmCmds: %s was kicked by %s, reason: %s", name, adminname, reason)); } }
As I can understand you want silently kick the player, so Instead of SendClientMessageToAll you should use SendClientMessage
|
Create a timer (for example one second) before realy kicking him.
And at least read the wiki next time, god damn... https://sampwiki.blast.hk/wiki/Kick |
forward _KickPlayerDelayed(playerid)
public _KickPlayerDelayed(playerid)
{
Kick(playerid);
return 1;
}
DelayedKick(playerid, time = 500)
{
SetTimerEx("_KickPlayerDelayed", time, false, "d", playerid);
return 1;
}
DelayedKick(playerid);