Car engine off
#1

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

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

Reply
#3

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
Reply
#4

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
Reply
#5

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)