its all about timer..
lemme explain
lets say, your Ban code is
we go Do a brand new function for it, it will be
Код:
public PlayerBan(playerid)
but, to Do that and avoid errors, we have to forward it
Код:
forward PlayerBan(playerid);
-*The forward should be on top of the Function(before it)*-
--Whole Function should be like this--
Quote:
forward PlayerBan(playerid);
public PlayerBan(playerid)
{
Ban(playerid);
}
|
-> It Can be put Anywhere
Now lets go
**Lets Say this is my Ban Command (don't use my command, use the Basic tutorial i gave)
Код:
CMD:ban(playerid, params[])
{
{
GetPlayerName(playerid, Adminname, sizeof(Adminname)); //defines the function with the adminname we wanna get
GetPlayerName(PID, Playername, sizeof(Playername));
if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /kick [playerid] [reason]"); //tell sscanf if the parameters/the syntax is written wrong to return a message (PID and the reason used here)
(it got player name And other bla bla, this is not what i'm Trying to focus for)
SendClientMessage(playerid, 0xFF0000FF, "You have been banned!:P");
// Actually ban them a second later on a timer.
SetTimerEx("PlayerBan", 1000, false, "d", playerid);
}
else //if he has not got the permissions
{
SendClientMessage(playerid, COLOR_GREY, "You have to be level 5 to use that command!"); //return this message
}
return 1;
}
(Focus where the Message and timer should be, First the Message Before the ban Timer .. and Both of them ''Bantimer+Message" are before the 'Else' Function that checks if he has not got the permission'