Need help: Fuel System Timer
#1

Hey I want to set a timer for this command so when there are no admins online it will automaticly refuel every 20 minutes, I already tried it but it failed:

Timer should be set on 20 minutes and can you please add a GameText like this: ''All cars have been refueled''

It's this command:

Код:
	}
	if(strcmp(cmd, "/fuelcars", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	    if(PlayerInfo[playerid][pAdmin] >= 4)
	    {
	      for(new c=0;c<MAX_VEHICLES;c++)
				{
					Fuel[c] = GasMax;
				}
				SendClientMessageToAll(COLOR_ADMINCMD, "INFO: All cars refueled by an administrator.");
	    }
	    else
	    {
	      SendClientMessage(playerid, COLOR_RED, "ERROR: You are not an administrator.");
	      return 1;
	    }
	  }
	  return 1;
I hope you can help me!

Reply
#2

So you want to check if there are any admins online all time.
Then if there isn't, set a timer of 20 minutes.
And in that timer function, refuel all cars?
Reply
#3

Yes well I actually would like it to go automaticly even when there is an admin online so we don't have to look at it all the time.
Reply
#4

pawn Код:
SetTimer("Refuel",1000*60*20,true);

forward Refuel();
public Refuel()
{
  for(new c=0;c<MAX_VEHICLES;c++)
  {
    Fuel[c] = GasMax;
  }
}
Reply
#5

Finally someone who does x*x*x instead of just a large number of ms
Reply
#6

Thanks MenaceX now I see I only did one thing wrong!
Reply
#7

pawn Код:
public Refuel()
{
    for(new c=0;c<MAX_VEHICLES;c++)
    {
        Fuel[c] = GasMax;
    }
    return GameTextForAll("All cars ~g~refueled", 5000, 4);
}
Reply
#8

Thanks!

Is that on the top or on the bottom? I want it on the top.
Reply
#9

It's over your head
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)