05.04.2013, 13:01
A Custom and Modified
Kick(playerid);
Kick(playerid);
Introduction
Since 0.3x, You won't receive any messages anymore before you get kick.
It is because of SA-MP's new security system.
This can be fixed by setting a timer. No not the timer without the parameter settings.
I'm talking about timer with parameter settings by i mean that, i mean SetTimerEx.
Let's get started.
Kick(playerid) Time!!!
pawn Code:
new kick2[MAX_PLAYERS];
forward PlayerKick(playerid);
public PlayerKick(playerid)
{
Kick(playerid);
return KillTimer(kick2[playerid]);
}
stock KickEx(playerid, time = 500)
{
if(time == 0) return print("Error, Time is 0, Cannot run timer with that milesecond!");
else if(time != 0)
{
kick2[playerid] = SetTimerEx("PlayerKick", time, false, "d", playerid);
}
return 1;
}
pawn Code:
new kick2[MAX_PLAYERS];
//Creates a variable
pawn Code:
forward PlayerKick(playerid);
Forwards the callback PlayerKick in order to avoid warnings when we create public PlayerKick(playerid)
pawn Code:
public PlayerKick(playerid) //gets called after the SetTimerEx's milesecond parameters execute!
{
Kick(playerid);
//kicks the player
return KillTimer(kick2[playerid]); //kills the timer that we run in the stock function KickEx
}
pawn Code:
stock KickEx(playerid, time = 500) //creates a new stock function.
pawn Code:
if(time == 0) return print("Error, Time is 0, Cannot run timer with that milesecond!");
//if the scripter accidentally typed 0 in the time parameter. The system will block it and send a error print!
pawn Code:
else if(time != 0) //if the time parameter is not 0
pawn Code:
kick2[playerid] = SetTimerEx("PlayerKick", time, false, "d", playerid);
//creates a timer, we will gonna kill it later