20.07.2013, 11:14
Good Morning,
I've been busy working on a GUI for my vehicle system, and I recently uncovered a bug regarding the fuel...
I'm not too sure whether or not it's a String bug or some common bug that I'm unaware of, but if anyone recognizes this, it would be a great deal of relief to know the solution!

As you see, the fuel is exponentially large, although in the script it's max is 100.
I won't be giving away any of the code unless it's needed, because I think it has to do with the string.
Thanks!
[EDIT]:
Here is the code, because I understand how difficult it can be without getting a picture in your head.
That is all under OnPlayerUpdate(); of course.
I've been busy working on a GUI for my vehicle system, and I recently uncovered a bug regarding the fuel...
I'm not too sure whether or not it's a String bug or some common bug that I'm unaware of, but if anyone recognizes this, it would be a great deal of relief to know the solution!

As you see, the fuel is exponentially large, although in the script it's max is 100.
I won't be giving away any of the code unless it's needed, because I think it has to do with the string.
Thanks!
[EDIT]:
Here is the code, because I understand how difficult it can be without getting a picture in your head.
pawn Код:
new speedstring[20],locationstring[56],fuelstring[56];
format(speedstring, sizeof(speedstring), "%i MPH", GetVehicleSpeed(GetPlayerVehicleID(playerid), true));
PlayerTextDrawSetString(playerid, Speed, speedstring);
format(locationstring, sizeof(locationstring), "%s", GetPlayer3DZone(playerid));
PlayerTextDrawSetString(playerid, Location, locationstring);
Fuel[vehicleid] -= GetPlayerSpeed(playerid)/1000.0;
format(fuelstring, sizeof(fuelstring), "%i/100", Fuel[vehicleid]);
PlayerTextDrawSetString(playerid, FuelAmount, fuelstring);