SA-MP Forums Archive
[Help] problem with setting fuel to vehicle - 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: [Help] problem with setting fuel to vehicle (/showthread.php?tid=472614)



[Help] problem with setting fuel to vehicle - Luca12 - 29.10.2013

Hello I put under ongamemodeinit 15.0 L for motocycles and know is the problem I turn on my server and sit on motocycle and fuel should be 15.0L but instead is 40.0 L. Thanks


Re: [Help] problem with setting fuel to vehicle - Keyhead - 29.10.2013

We cannot help without the code.


Re: [Help] problem with setting fuel to vehicle - Luca12 - 29.10.2013

Ok this is under ongamemodeinit

pawn Код:
for(new o = 1; o < MAX_VOZILA; o++)
    {
        if(o != INVALID_VEHICLE_ID)
        {
            if(IsPlane(GetVehicleModel(o)) || IsBoat(GetVehicleModel(o)) || IsBus(GetVehicleModel(o))) Gorivo[o] = 80.00;
            else if(IsCar(GetVehicleModel(o))) Gorivo[o] = 40.00;
            else if(IsMotoCycle(GetVehicleModel(o))) Gorivo[o] = 15.00;
            else if(IsTruck(GetVehicleModel(o))) Gorivo[o] = 100.00;
            else if(IsBycle(GetVehicleModel(o)) || GetVehicleModel(o) == 538) Gorivo[o] = 1000000.00;
            else  Gorivo[o] = 40.00;
            if(!IsBycle(GetVehicleModel(o)))
            {
                new engine, lights, alarm, doors, bonnet, boot, objective;
                GetVehicleParamsEx(o, engine, lights, alarm, doors, bonnet, boot, objective);
                SetVehicleParamsEx(o, 1, 0, alarm, doors, bonnet, boot, objective);
            }
        }
    }



Re: [Help] problem with setting fuel to vehicle - Luca12 - 30.10.2013

Anyone? Thanks


Re: [Help] problem with setting fuel to vehicle - Patrick - 30.10.2013

I believe Gorivo = Fuel try these code, what was the use of last else?

pawn Код:
for(new o = 1; o < MAX_VOZILA; o++)
{
    new engine, lights, alarm, doors, bonnet, boot, objective;
    if(o != INVALID_VEHICLE_ID)
    {
        if(IsPlane(GetVehicleModel(o)) || IsBoat(GetVehicleModel(o)) || IsBus(GetVehicleModel(o))) Gorivo[o] = 80.00;
        else if(IsCar(GetVehicleModel(o))) Gorivo[o] = 40.00;
        else if(IsMotoCycle(GetVehicleModel(o))) Gorivo[o] = 15.00;
        else if(IsTruck(GetVehicleModel(o))) Gorivo[o] = 100.00;
        else if(IsBycle(GetVehicleModel(o)) || GetVehicleModel(o) == 538) Gorivo[o] = 1000000.00;

        if(!IsBycle(GetVehicleModel(o)))
            return GetVehicleParamsEx(o, engine, lights, alarm, doors, bonnet, boot, objective),
            SetVehicleParamsEx(o, 1, 0, alarm, doors, bonnet, boot, objective);
    }
}



Re: [Help] problem with setting fuel to vehicle - Luca12 - 30.10.2013

I try like this it not working


Re: [Help] problem with setting fuel to vehicle - Luca12 - 31.10.2013

Anyone? Thanks


Re: [Help] problem with setting fuel to vehicle - Konstantinos - 31.10.2013

Post IsCar and IsMotoCycle. It seems there's a mistake in IsCar and exists a motorbike in it so the 2nd else if is not called at all.


Re: [Help] problem with setting fuel to vehicle - Pottus - 31.10.2013

I bet those functions try and keep track of vehicles by vehicle id if they do I'm going to shit my pants.


Re: [Help] problem with setting fuel to vehicle - Luca12 - 01.11.2013

Konstantinos the stocks isamotocycle and isacar is working beacuse I make again stock and in the isamotocycle is all id of motocycles and isacar is all id of car vehicles