Vehicle engine damage help!
#1

I need to make it where vehicle engine would shut down after reaching a certen amount of HP in /dl like maybe around 300 or 400 hp the vehicle would not be able to start back up or move anyone could help that would be lovley thanks!

Also - Rep me and I'll rep you!
Reply
#2

A quick search does the job

pawn Код:
Public OnGameModeInit()
{
     SetTimerEx("carhealthcheck", 500, true, "i", playerid);
}


forward carhealthcheck();
public carhealthcheck()
{
    new Float:vhp;
    for(new vehicleid; vehicleid<MAX_VEHICLES;vehicleid++)
    {
        if(GetVehicleModel(vehicleid)==0)continue;
        GetVehicleHealth(vehicleid,vhp);
        if(vhp<250.0)
        {
            SetVehicleHealth(vehicleid,250)
            new engine,lights,alarm,doors,bonnet,boot,objective;
            GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(vehicleid,0,lights,alarm,doors,bonnet,boot,objective);
        }
    }
}
Credits to JhnzRep, although this ins't the best way it could be done it'd work..
Reply
#3

this..
pawn Код:
public OnPlayerUpdate(playerid)
{
if(IsPlayerInAnyVehicle(playerid))
{
new Float:health,vid=GetPlayerVehicleID(playerid);
GetVehicleHealth(vid, health);
if(health<=300)//enter the value to be when engine of here
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,0,lights,alarm,doors,bonnet,boot,objective);
}
}
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)