SA-MP Forums Archive
[HELP] fuel problem - 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: [HELP] fuel problem (/showthread.php?tid=272246)



[HELP] fuel problem - spaty2 - 27.07.2011

I have that problem, when I stay in my car and don't move with it, my fuel starts to get up
Example:

I have 100% of fuel
and in next 5 minut I have 105%

I don't know why, maybe this can help...
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) {
                            GameTextForPlayer(i,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~Fuel is low",5000,3);
                        }
                    }
                    if(gGas[i] == 1) {
                    if(IsAPlane(vehicle) || IsABoat(vehicle) || IsABike(vehicle) || IsAHarvest(vehicle) || IsADrugHarvest(vehicle) || IsASweeper(vehicle))
                    {
                        format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~Fuel:~w~ N/A");
                    }
                    else
                    {
                        format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~Fuel:~w~ %d%",Gas[vehicle]);
                    }
                    GameTextForPlayer(i,string,20500,3); }
                    if(IsAPlane(vehicle) || IsABoat(vehicle) || IsABike(vehicle) || IsAHarvest(vehicle) || IsADrugHarvest(vehicle) || IsASweeper(vehicle) || engineOn[vehicle] == 0) { Gas[vehicle]++; }
                    Gas[vehicle]--;
                }
                else
                {
                    NoFuel[i] = 1;
                    TogglePlayerControllable(i, 0);
                    GameTextForPlayer(i,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~No fuel in Vehicle",1500,3);
                }
            }
        }
    }
    return 1;
Does anyone know this problem?


Re: [HELP] fuel problem - Dr - 27.07.2011

Try changing:
pawn Код:
Gas[vehicle]++;
To
pawn Код:
Gas[vehicle]--;



Re: [HELP] fuel problem - spaty2 - 27.07.2011

I think delete will be better, but thx


Re: [HELP] fuel problem - spaty2 - 27.07.2011

no delete doesn't work

EDIT: Works!! I deleted it shitly..