SA-MP Forums Archive
Vehicle health. - 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: Vehicle health. (/showthread.php?tid=540731)



Vehicle health. - KesaSport - 06.10.2014

pawn Код:
public ServerTimer()
{
    for(new i; i < MAX_VEHICLES; i++)
    {
        if(i != INVALID_VEHICLE_ID)
        {
            new Float:vHp;
            GetVehicleHealth(i, vHp);
            if(vHp != 999.0) SetVehicleHealth(i, 999.0);
        }
    }
    return (true);
}
why it's not calling when vehicle is empty?


AW: Vehicle health. - lcp9 - 06.10.2014

Can you show use the SetTimer function ?


Re: Vehicle health. - Pottus - 06.10.2014

if(i != INVALID_VEHICLE_ID) the fuck ?


Re: AW: Vehicle health. - KesaSport - 06.10.2014

Everything works when player in vehicle....


AW: Vehicle health. - lcp9 - 06.10.2014

Please show us the code where the timer is.


Re: Vehicle health. - KesaSport - 06.10.2014

You think I'm stupid?
public OnGameModeInit()
{
SetTimer("ServerTimer", 50, true);
return 1;
}


Re: Vehicle health. - Ahmad45123 - 06.10.2014

Add print("Test") in the timer, And see if the timer gets actually called...

If not, Then you may not have forwarded the function.

Add forward ServerTimer(); in the top of the public.


Re: Vehicle health. - KesaSport - 06.10.2014

As I say, every works when vehicle is occupied. But whent vehicle un-occupied code doesn't call.


Re: Vehicle health. - Vince - 06.10.2014

Vehicles can't be damaged unless someone's in them, anyway.


Re: Vehicle health. - Quickie - 07.10.2014

just use
pawn Код:
public OnUnoccupiedVehicleUpdate(vehicleid, playerid, passenger_seat, Float:new_x, Float:new_y, Float:new_z, Float:vel_x, Float:vel_y, Float:vel_z)