Kick Timer
#1

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.
Reply
#2

PHP код:
forward KickPlayer(playerid);
public 
KickPlayer(playerid)
{
    
Kick(playerid);
    return 
1;

PHP код:
SetTimerEx("KickPlayer",50,false,"i",playerid); 
Reply
#3

forward DelayedKick(playerid)

public DelayedKick(playerid)
{
Kick(playerid);
}


stock KickPlayer(playerid)
}
SetTimerEx("DelayedKick",1000,false,"i",playerid);
return 1;
}

And use KickPlayer(PID)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)