CheckGas
#1

pawn Код:
if(Motor[vehicle] == true)
                    {
                        Gas[vehicle]--;
                    }
                    else if(IsAPlane(vehicle) || IsABoat(vehicle) || IsABike(vehicle)) { Gas[vehicle]++; }
The Problem is, even if it's a normal car, it gives ++gas when engine is on

Whole function
pawn Код:
public CheckGas()
{
    new string[256];
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
            {
                new vehicle = GetPlayerVehicleID(i);
                if(Gas[vehicle] >= 1)
                {
                    if(Gas[vehicle] <= 10)
                    {
                        PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
                        if(gGas[i] == 0) {
                        CreateBox(i,"Benzin","~r~Du hast noch wenig Benzin ~n~~w~Fahr zur naehersten Tankstelle~n~um Benzin aufzutanken.");
                        }
                    }
                    if(gGas[i] == 1) {
                    if(IsAPlane(vehicle) || IsABoat(vehicle) || IsABike(vehicle))
                    {
                        format(string, sizeof(string), "~r~Benzin:~w~N/A");
                    }
                    else
                    {
                        format(string, sizeof(string), "~r~Benzin:~w~%d%/40L",Gas[vehicle]);
                    }
                    TextDrawShowForPlayer(i, gorivo); }
                    TextDrawSetString(gorivo, string);
                    if(IsAPlane(vehicle) || IsABoat(vehicle) || IsABike(vehicle)) { Gas[vehicle]++; }
                    else
                    if(!Motor[vehicle] == false)
                    {
                        Gas[vehicle]--;
                    }
                }
                else
                {
                    NoFuel[i] = 1;
                    GetVehicleParamsEx(vehicle,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vehicle,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
                    CreateBox(i,"Benzin","~r~Der Tank dieses Fahrzeugs ist leer");
                }
            }
        }
    }
    return 1;
}
So if i turn the engine off, the gas goes ++ for some reason, it should go ++ only on bikes planes and boats
Reply
#2

anyone?!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)