11.02.2012, 10:56
This on OnGameModeEnit
and this as Public fuel_lower
You mihgt have to define some stuff, not sure. but it should work
pawn Код:
for(new i=0;i<MAX_VEHICLES;i++){
fuel[i] = 100; //sets every car's fuel to 100 in a loop
}
SetTimer("timer_fuel_lower",35500,true); //sets the timer to drop the fuel
pawn Код:
public timer_fuel_lower()
{
for(new i=0;i<MAX_PLAYERS;i++) { //loop for all players
if (isrefuelling[i]) continue; //stop when a player is already refuelling
new vid = GetPlayerVehicleID(i); //getting vehicle ID
if (GetPlayerVehicleSeat(i) == 0) { //if the player is a driver (it should only lower the fuel when theres an driver!)
fuel[vid] = fuel[vid] -1; //lowering fuel value
if (fuel[vid]<1) //if fuel is empty
{
fuel[vid] = 0; //setting fuel to 0 (else the timer will set it to -1 -2 -3 etc before removing player)
RemovePlayerFromVehicle(i); //remove player out of vehicle
GameTextForPlayer(i,"~r~You are out of ~w~fuel~r~!",5000,4); //show text
}
}
new string[125];format(string,sizeof string,"Fuel:%i",fuel[vid]); //preparing string with next fuel value
TextDrawSetString(td_fuel[i],string); //updating textdraw
}
return 1;
}

