When the vehicle is going to destroy ...
#1

Good evening.

I want a function to check the condition of the vehicle, when 300, 300 and there is not for it explodes (it remains on fire).

Thx.
Reply
#2

Код:
public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{
    new Float:health;
    GetVehicleHealth(vehicleid, health);
    if(health <= 300)
    {
        SetVehicleHealth(vehicleid, 300);
    }
}
EDIT: Disregard.
Reply
#3

OnVehicleDamageStatusUpdate is not always the best method of detecting damage to a vehicle. That callback is called when VISUAL damage is applied to a vehicle, like damage to panels, wheels, hood etc.

A vehicle starts burning at 250 health, not 300. I don't really have to time to script all of this for you right now, but I might get back to you later.
Reply
#4

In that case, use a timer to check for the vehicle's health and set it accordingly.
Reply
#5

There is not a callback devoted to it?
Reply
#6

https://sampwiki.blast.hk/wiki/Category:Scripting_Callbacks
https://sampwiki.blast.hk/wiki/OnVehicleDamageStatusUpdate

The only callback that gets called when a vehicle is damaged is 'OnVehicleDamageStatusUpdate'.
As Benzo said, it only detects the damage of body parts, not the actual vehicle.
Reply
#7

UP, help please for the fire?
Reply
#8

UPPPPPPP
Reply
#9

pawn Код:
//#include <a_samp>
native IsValidVehicle(vehicleid); //Add this directly under the inclusion of 'a_samp'.

public OnGameModeInit() //Or OnFilterScriptInit for filterscripts.
{
    SetTimer("VehicleFire", 1000, true);
    return 1;
}

forward VehicleFire();
public VehicleFire()
{
    new Float:vhealth;
    for(new i = 0; i < MAX_VEHICLES; i++)
    {
        if(!IsValidVehicle(i)) continue;
        GetVehicleHealth(i, vhealth);
        if(vhealth < 251.0)
        {
            SetVehicleHealth(i, 251.0);
            SetVehicleHealth(i, 250.0);
        }
    }
    return 1;
}
To be honest, I don't know if setting the health to 251 and reverting it to 250 will actually work, but hopefully it gives you what you want. If the connection from client to server is good, then this should most likely work.
Reply
#10

Not work!!
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)