Kick Timer - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Kick Timer (
/showthread.php?tid=651519)
Kick Timer -
Lixyde - 21.03.2018
Okay so i have this command:
Код:
CMD:kick(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
new PID;
new reason[64];
new str[128];
new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
GetPlayerName(playerid, Adminname, sizeof(Adminname));
GetPlayerName(PID, Playername, sizeof(Playername));
if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, COLOR_SYSTEM, "SERVER: {FF1E00}/kick [playerid] [причина]");
if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, COLOR_GREY, "Този играч не е в сървъра!");
format(str, sizeof(str), "{FF1E00}ADMIN: '%s' е кикнат от администратор '%s'. [Причина: %s]", Playername, Adminname, reason);
SendClientMessageToAll(COLOR_SYSTEM, str);
Kick(PID);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Трябва да сте поне 1 левел Админ!");
}
return 1;
}
Ignore the bugged text, its not the problem here.
The problem is i want to tell the player that is kicked before he is actually kicked.
I test it myself i typed to kick myself and it worked the command, but doesn't say in the chat that myname is kicked by administrator myname [reason: asd] [EXAMPLE]
So how do to that it shows the message before the player is actually kicked?
I learned that i need to make a timer, but i don't know how. If anyone can give me timer for this command to work , to show the message, before the player is kicked.
Thanks anyway.
Re: Kick Timer -
kovac - 21.03.2018
PHP код:
forward KickPlayer(playerid);
public KickPlayer(playerid)
{
Kick(playerid);
return 1;
}
PHP код:
SetTimerEx("KickPlayer",50,false,"i",playerid);
Re: Kick Timer -
scripter112 - 21.03.2018
forward DelayedKick(playerid)
public DelayedKick(playerid)
{
Kick(playerid);
}
stock KickPlayer(playerid)
}
SetTimerEx("DelayedKick",1000,false,"i",playerid);
return 1;
}
And use KickPlayer(PID)