Posts: 1,018
Threads: 320
Joined: Jul 2010
Hello I have this ony for motocycles so first it's go from 15.0 L and then fuel it should be 14.9 but instead is 14.8 and from there it's go fuel down normal. So why fuel go from 15 to 14.8 but it should 15.0 14.9 and then 14.8. Thanks
Posts: 1,018
Threads: 320
Joined: Jul 2010
here is the code where if fuel lower for cars and everything works fine and works also for motocycles just skip 14.9 and go to 14.8 and from 14.8 fuel lower normal 14.7 14.6 14.5 etc..
pawn Код:
forward GorivoTimer();
public GorivoTimer()
{
foreach(Player,i)
{
if(GetPlayerState(i) == 2)
{
new vid = GetPlayerVehicleID(i);
if(VoziloJeBiciklo(vid)) continue;
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
if(engine == 1) Fuel[vid] = Fuel[vid] -0.1;
new string[64];
format(string,sizeof string,"%.1fl",Fuel[vid]);
TextDrawSetString(Speedometar0[i],string);
TextDrawShowForPlayer(i,Speedometar0[i]);
}
}
return 1;
}
Posts: 95
Threads: 2
Joined: Jun 2014
Reputation:
0
Thats really weird of what you said, like it just works on the code you provided it, Its really unusual unless you script it to, Are you really sure that happens? Or is there any other defination existing for fuel system which takes fuel according to vehicles?
Posts: 1,018
Threads: 320
Joined: Jul 2010
yes I was sit for example on nrg and drive for a while fuel is set to 15.0 and it goes 15.0 then 14.8 instead of 14.9 I don't know why. thanks
Posts: 11,827
Threads: 33
Joined: Dec 2011
Reputation:
0
It's problem with the floats, not your code. Instead of 14.9, it goes to 14.899999 (14.8 with %.1f placeholder).
Posts: 1,018
Threads: 320
Joined: Jul 2010
why is this only show for bikes I mean nrg freeway etc with cars and the others it go 40.0 39.9 etc and is it a way to fix this. Thanks