SA-MP Forums Archive
Car engine off - 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: Car engine off (/showthread.php?tid=658330)



Car engine off - ZigGamerx - 01.09.2018

i want a code that when car reaches 400 health so engine automatic offs.


Re: Car engine off - Lokii - 01.09.2018

PHP код:
public OnVehicleDamageStatusUpdate(vehicleidplayerid)
{
    new 
Float:hp
    GetVehicleHealth
(vehicleidhp);
    if(
hp <= 400)
    {
        
//turn off engine code here
    
}
    return 
1;




Re: Car engine off - dani18 - 02.09.2018

Exactly, as Lokii says.
We will make it easier for you.
PHP код:
public OnVehicleDamageStatusUpdate(vehicleidplayerid)
{
    new 
Float:hpvehicleid GetPlayerVehicleID(playerid), enginelightsalarmdoorsbonnetbootobjective;
    
GetVehicleHealth(vehicleidhp);
    if(
hp <= 400)
    {
    
GetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective);
    
SetVehicleParamsEx(vehicleidVEHICLE_PARAMS_OFFlightsalarmdoorsbonnetbootobjective);
    }
    return 
1;

Also if you want to find how to configure another part of the vehicle, go to this link: https://sampwiki.blast.hk/wiki/SetVehicleParamsEx


Re: Car engine off - Shinja - 02.09.2018

Quote:
Originally Posted by dani18
Посмотреть сообщение
Exactly, as Lokii says.
We will make it easier for you.
PHP код:
public OnVehicleDamageStatusUpdate(vehicleidplayerid)
{
    new 
Float:hpvehicleid GetPlayerVehicleID(playerid), enginelightsalarmdoorsbonnetbootobjective;
    
GetVehicleHealth(vehicleidhp);
    if(
hp <= 400)
    {
    
GetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective);
    
SetVehicleParamsEx(vehicleidVEHICLE_PARAMS_OFFlightsalarmdoorsbonnetbootobjective);
    }
    return 
1;

Also if you want to find how to configure another part of the vehicle, go to this link: https://sampwiki.blast.hk/wiki/SetVehicleParamsEx
Why you are defining a new vehicleid? it will give him error


Re: Car engine off - ZigGamerx - 02.09.2018

Quote:
Originally Posted by Shinja
Посмотреть сообщение
Why you are defining a new vehicleid? it will give him error
I will remove it myself anyways thanks for Code everyone