28.02.2013, 07:44
This should fix that issue.
pawn Код:
/In order to display a message (eg. reason) for the player before the connection is closed you have to use a delay:
forward KickPublic(playerid);
public KickPublic(playerid) { Kick(playerid); }
stock KickWithMessage(playerid, message[])
{
SendClientMessage(playerid, 0xFF4444FF, message);
SetTimerEx("KickPublic", 1000, 0, "d", playerid); //Delay of 1 second before kicking the player so he recieves the message
}
//Sample Usage
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/kickme", true) == 0)
{
//Kicks the player who the executed this command
KickWithMessage(playerid, "You have been kicked.");
return 1;
}
return 0;
}
//by Kye