Help please. - 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: Help please. (
/showthread.php?tid=440666)
Help please. -
HyDrAtIc - 30.05.2013
pawn Код:
{
SendClientMessage(playerid, RED, "You have been kicked as you are using an incorrect name format. Use Firstname_Lastname.");
Kick(playerid);
}
Is someone able to fix this for me? The problem is that it kicks the person BEFORE the message comes to him. Is there any way to set a time on it, so it does it after like 1 second?
Re: Help please. -
nielsbon1 - 30.05.2013
Well you can make a timer,
pawn Код:
SetTimerEx("KickPlayer", 100, false, "i", playerid);
and in function KickPlayer you put your Kick(playerid);
This should dodge this.
Re: Help please. -
[KHK]Khalid - 30.05.2013
https://sampwiki.blast.hk/wiki/Kick
Check out the note and the example in this page!
Re: Help please. -
HyDrAtIc - 30.05.2013
So, KickWithMessage?
Re: Help please. -
nielsbon1 - 30.05.2013
Quote:
Originally Posted by HyDrAtIc
So, KickWithMessage?
|
For example:
pawn Код:
/* This is the timer that kicks the player if needed put it in your function so replace with Kick();*/
SetTimerEx("KickPlayer", 100, false, "i", playerid);
forward KickPlayer(playerid);
public KickPlayer(playerid) {
Kick(playerid);
return 1;
}
Re: Help please. -
[KHK]Khalid - 30.05.2013
Yep.
pawn Код:
forward KickPublic(playerid);
public KickPublic(playerid) { Kick(playerid); }
stock KickWithMessage(playerid, color, message[])
{
SendClientMessage(playerid, color, message);
SetTimerEx("KickPublic", 1000, 0, "d", playerid); //Delay of 1 second before kicking the player so he recieves the message
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/kickme", true) == 0)
{
//Kicks the player who the executed this command
KickWithMessage(playerid, 0xFF0000FF, "You have been kicked.");
return 1;
}
return 0;
}
//by Kye
Re: Help please. -
HyDrAtIc - 30.05.2013
Thank you a lot. Let's see if this is going to work.
+rep.