SA-MP Forums Archive
wtf>? bikes have fuel - 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)
+--- Thread: wtf>? bikes have fuel (/showthread.php?tid=314836)



wtf>? bikes have fuel - mineralo - 31.01.2012

well, I have downloaded a fuel system and later I upgraded it and it works enough good BUT ITS WORKS FOR EVERY VEHICLES and that is my problem, if think real bikes ( bmx etc ) doesn't have fuel and I put condition for avoid it but doesn't work wtf? help me plz
pawn Код:
forward BenzinUpdate();
public BenzinUpdate()
{
    new string[256];
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            new vehicle = GetPlayerVehicleID(i);
            if(GetPlayerVehicleID(i) != 481 && GetPlayerVehicleID(i) != 509 && GetPlayerVehicleID(i) != 510)
            {
            if(IsPlayerInAnyVehicle(i) == 1)
            {
                if(Gas[vehicle] == 0)
                {
                        format(string, sizeof(string), "~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~FUEL: ~l~--");
                        GameTextForPlayer(i,string,10000,3);
                        new engine, lights, alarm, doors, bonnet, boot, objective;
                        GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
                        SetVehicleParamsEx(vehicle,0,lights,alarm,doors,bonnet,boot,objective);
                }
                else if(Gas[vehicle] > 0 && Gas[vehicle] <= 10)
                {
                        format(string, sizeof(string), "~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~FUEL: ~r~%d%",Gas[vehicle]);
                        GameTextForPlayer(i,string,5000,3);
                }
                else if(Gas[vehicle] >= 11 && Gas[vehicle] <= 50)
                {
                        format(string, sizeof(string), "~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~FUEL: ~y~%d%",Gas[vehicle]);
                        GameTextForPlayer(i,string,5000,3);
                }
                else if(Gas[vehicle] >= 51 && Gas[vehicle] <= 100)
                {
                        format(string, sizeof(string), "~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~FUEL: ~g~%d%",Gas[vehicle]);
                        GameTextForPlayer(i,string,5000,3);
                }
                return 1;
            }
            return 1;
            }
            return 1;
        }
        return 1;
    }
    return 1;
}
forward CheckGas();
public CheckGas()
{
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
            {
                new vehicle = GetPlayerVehicleID(i);
                if(GetPlayerVehicleID(i) != 481 && GetPlayerVehicleID(i) != 509 && GetPlayerVehicleID(i) != 510)
                {
                if(Gas[vehicle] >= 1)
                {
                Gas[vehicle]--;
                return 1;
                }
                return 1;
                }
                return 1;
            }
            return 1;
        }
        return 1;
    }
    return 1;
}
http://i43.tinypic.com/65twcm.png


Re: wtf>? bikes have fuel - mineralo - 01.02.2012

help me !


Re: wtf>? bikes have fuel - Baboon - 01.02.2012

Easy.
I see you have used GetPlayerVehicleID(i).
Use GetVehicleModel(GetPlayerVehicleID(i))