27.01.2015, 18:17
Hi guys, how's it going?
Recently with some tests I noticed that my fuel system only works on first vehicle on server. It won't decrease on any other vehicle. I will gladly put all codes necessary.
And also I am wondering why my fuel shows e.g. 3.59 L when it should 3.60? Do I need to round it?
Recently with some tests I noticed that my fuel system only works on first vehicle on server. It won't decrease on any other vehicle. I will gladly put all codes necessary.
pawn Код:
#undef MAX_VEHICLES
#define MAX_VEHICLES 500
public FuelAndSync()
{
for(new i = 1; i <= MAX_VEHICLES; i++)
{
if (IsValidVehicle(i))
{
if(!IsABicikl(i)) // is not a bicycle
{
if(VehInfo[i][Motor] == false) return 1; // engine
if(VehInfo[i][Gorivo] >= 0.60) // fuel
{
if(IsATruck(i)) { VehInfo[i][Gorivo] -= 0.40; }
else if(IsAOldCar(i)) { VehInfo[i][Gorivo] -= 0.40; } //
// ....
}
else
{
ToggleVehicleEngine(i);
VehInfo[i][Motor] = false;
VehInfo[i][NemaGoriva] = true;
foreach (Player, j)
{
if(IsPlayerInVehicle(j, i) && GetPlayerState(j) == PLAYER_STATE_DRIVER)
{
SCM(j, COLOR_LIGHTRED, "Ostali ste bez goriva!");
}
}
}
}
}
}