Help with a timer to use the command per minute.
#5

Quote:
Originally Posted by Adil_Rahoo
Put this at the top where you put the new variables.
pawn Код:
new FartTimer[MAX_PLAYERS];
and add this where you add forward:
pawn Код:
forward FartTimerOff(playerid);
and change your command to this:
pawn Код:
if(strcmp(cmdtext, "/fart", true) == 0) {
if(FartTimer[playerid] == 1)
{
SendClientMessage(playerid, 0xFFFFFFFF, "You must wait to do that again.");
return 1;
}
new pName[MAX_PLAYER_NAME];
new string[256];
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "EEW! %s has just farted!.", pName);
SendClientMessageToAll(0xFFFF00AA, string);
FartTimer[playerid] = 1;
SetTimer("FartTimerOff", 60000, 0);//change this 60000 to your timer, this is in milli secconds.
return 1;
}
and add this where you add Public:
pawn Код:
public FartTimerOff(playerid)
{
if(FartTimer[playerid] == 1)
{
FartTimer[playerid] == 0;
return 1;
}
}
Regards, Adil.
pawn Код:
public FartTimerOff(playerid)
{
if(FartTimer[playerid] == 1)
{
FartTimer[playerid] = 0;
return 1;
}
}
Use the FartTimerOff function I've provided, as Adil's has an error.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)