Fuel system not setting correctly - 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 system not setting correctly (
/showthread.php?tid=204225)
Fuel system not setting correctly -
randomkid88 - 29.12.2010
As the title says, I'm in the process of making a fuel system but fuel for some of the cars is being set to 0 on startup, and some are being set to -1. I think I have done everything correctly (code below) and I cant figure out whats wrong.
pawn Код:
new Fuel[MAX_VEHICLES];
//GamemodeInit
for(new i=0;i<MAX_VEHICLES;i++)
{
Fuel[i] = 100;
}
//OnPlayerEnterVehicle
format(infostr, sizeof(infostr), "[Owner: %s]-[VIN: LVDMV-%i]-[Fuel: %i]", CarInfo[vehicleid][cOwner], vehicleid, CarInfo[vehicleid][cHouseid],Fuel[vehicleid]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, infostr);
Like I said, the first car I get into after restarting the server says fuel is 0. It was a late-night addition to the script, so if I'm being a dunce and missing something let me know (kindly please

)
Re: Fuel system not setting correctly -
Johndaonee - 29.12.2010
pawn Код:
new Float:Fuel[MAX_VEHICLES];
format(string, 128, "Fuel: %.0f", Fuel[GetPlayerVehicleID(i)]);
Re: Fuel system not setting correctly -
Krx17 - 29.12.2010
It's not a problem with your fuel. You have an extra variable in your format(CarInfo[vehicleid][cHouseid]), take that out.
Re: Fuel system not setting correctly -
randomkid88 - 29.12.2010
Oh

I do don't I? Thanks