Fuel problem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Fuel problem (
/showthread.php?tid=212023)
Fuel problem -
Nonameman - 16.01.2011
Hey!
I'm working on a small fuel script and I have some problems. There are no errors/warnings in the script, but it doesn't work. So I started to search for the problem(s).
These are the lines I modify the value of the vehicle's fuel:
pawn Код:
#define MAX_FUEL 1000.0
new Float:Fuel[MAX_VEHICLES],
FuelChecker[MAX_PLAYERS];
public OnPlayerEnterVehicle(playerid,vehicleid,ispassenger)
{
Fuel[vehicleid]=MAX_FUEL;//Only for testing..
FuelChecker[playerid]=SetTimerEx("FuelCheck",1000,1,"d",vehicleid);
return 1;
}
forward FuelCheck(vehicleid);
public FuelCheck(vehicleid){
Fuel[vehicleid]-=0.1;
return 1;
}
The problem is when I enter a vehicle, the fuel goes up to 1000 and then quickly to 0.
Re: Fuel problem -
shayanpk - 24.01.2011
#define MAX_FUEL 100