Issue regarding to the fuel.
#2

In timer_fuel_lower, use GetVehicleParamsEx function and check if "engine" is 0 or -1*. If it is, then don't lower the fuel as the engine of the vehicle is off.

* It is returned -1 when a parameter (such as engine) has not been set. I'm not entirely sure if ManualVehicleEngineAndLights has not been used and it hasn't been set to any value, whether the engine is off or not (you'll need to test it to make sure).

Some things to change:

- When declaring "fuel" array, set a default value.

pawn Код:
new fuel[MAX_VEHICLES] = {100, ...};
instead of using a loop when the gamemode starts (2000 iterations) to set a value:
pawn Код:
for(new i=0;i<MAX_VEHICLES;i++)
{
    fuel[i] = 100;
}
- Avoid declaring variables inside loops.
- Use foreach/y_iterate for player-loops. If not, at least GetPlayerPoolSize.
Reply


Messages In This Thread
Issue regarding to the fuel. - by D1am0nd - 29.06.2016, 14:45
Re: Issue regarding to the fuel. - by Konstantinos - 29.06.2016, 15:44

Forum Jump:


Users browsing this thread: 1 Guest(s)