Preventing car explosion
#1

Hello.
How can I prevent car from exploding? I just want to turn it's engine off when car's health is low (without exploding).

Is it possible?
Reply
#2

if you have a speedo, put
pawn Code:
public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{
new panels, tires;
    GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
    bonnet = doors & 0x7;
    if(bonnet == 3)
    {
          SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
}
return 1;
}
will stop engine when bonnet comes off. modify it check its health. if its lower than 500 turn it off.
Reply
#3

Ok, but with how much health car explodes? 0?
Reply
#4

nah somewhere arounf 400's u better keep the check at 500
Reply
#5

Sorry, but I still don't know how to do it.

Can somebody explain it? I don't understand all these vehiclehealth functions.
Reply
#6

pawn Code:
public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{
    new Float:h;
    GetVehicleHealth(vehicleid,h);
    if(h < 500)
    {
        SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_OFF,-1,-1,-1,-1,-1,-1);
    }
    return 1;
}
Reply
#7

pawn Code:
public OnVehicleDamageStatusUpdate(vehicleid, playerid) //Get called every time a vehicle health changes (I think)
{
    new Float:health; //Creating a variable for the car's health
    GetVehicleHealth(vehicleid,health); //Storing the actual health of the vehicle in the variable
    if(health < 400.0) //Checkin if the health is lower than 400.0 (1000.0 is the max, somewhere around 400.0, it catches fire)
    {
        new engine, lights, alarm, doors, bonnet, boot, objective; //Creating variable's for the vehicle's parameters (doors, bonnet, engine, etc)
        GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective); //Getting the vehicle's parameters)
        SetVehicleParamsEx(vehicleid, 0, 0, 0, doors, bonnet, boot, objective); //Turning off the engine
        return 1;
    }
    return 1;
}
Hope I helped =D
Reply
#8

i used that and when my car was refixed the enine didnt switch back on
Reply
#9

Using damagestatusupdate is wrong for detecting its health because it only detects when some kind of part of the vehicle is damaged so using the callback is not the best way.
Reply
#10

Quote:
Originally Posted by [LHT]Bally
View Post
i used that and when my car was refixed the enine didnt switch back on
did you increase its health enough so that it wont switch off again?
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)