Vehicle engine damage help! - 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 engine damage help! (
/showthread.php?tid=505973)
Vehicle engine damage help! -
LostGaming2014 - 11.04.2014
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!
Re: Vehicle engine damage help! -
Flake. - 11.04.2014
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..
Re: Vehicle engine damage help! -
BroZeus - 11.04.2014
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;
}