Timed kick
#1

Okay, basically i want a timer on the kick command, so that it let's the message appear then 3 seconds later it kicks you.
how could i do this, I'm a beginner and i can't seem to get the timers working.
so any help with this is appreciated.

SendClientMessage(playerid,COLOR_RED,"Invalid Name, Correct Format: Firstname_lastname.");
SendClientMessage(playerid,COLOR_RED,"You will be kicked in 3 seconds.");
// Kicks the player that doesn't have a roleplay name.
Kick( playerid );

EDIT: ok i figured it out, thanks a bunch though guys.
Reply
#2

Follow these Tutorials, If it doesn't helps then ask again



https://sampwiki.blast.hk/wiki/SetTimerEx

https://sampwiki.blast.hk/wiki/Public_functions



Remember to always check the SA:MP Wiki Always for tutorials.
Reply
#3

I am not sure why you need this. When a player gets kicked they don't actually exit the game, so they can still see the message.

But anyways:

pawn Код:
SendClientMessage(playerid, 0xAA0000AA,"kick message");
SetTimerEx("Kick", 3000, false, "d", playerid);

The only possible issue with this is the case when a player leaves, and another takes their place within that 3 second gap. (unlikely but it can happen)
So to ensure thats not a problem you can do.

pawn Код:
new kickTimers[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
  if(kickTimers[playerid] != -1) KillTimer(kickTimers[playerid]);
  kickTimers[playerid] = -1;
}

SendClientMessage(playerid, 0xAA0000AA,"kick message");
kickTimers[playerid] = SetTimerEx("Kick", 3000, false, "d", playerid);
Reply
#4

Thanks alot, i was just about to post about that problem =D.

And yeah, well in my case the message wasn't appearing, so yeah but either way this works so thank you, now only if i could get the dini tutorial stuff workin'.

Do you mind if i add you to msn, do you think you could help me out a little here?

if you don't mind, just send me a private message, seeing that you have hidden your email.
Reply
#5

If you have any specific questions you can send me a pm.

My email is hidden on purpose.
I don't mind helping people, but I keep my email separate, I get enough email as it is.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)