SA-MP Forums Archive
Putting HP in vehicles - 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: Putting HP in vehicles (/showthread.php?tid=650067)



Putting HP in vehicles - JnniorDoug - 20.02.2018

Does anyone know how I can this adding Hp in vehicles, all cars tested are indestructible




Re: Putting HP in vehicles - BulletRaja - 20.02.2018

you want to set vehicle health??
Код:
SetVehicleHealth(vehicleid, Float:health);



Re: Putting HP in vehicles - RogueDrifter - 20.02.2018

You want to make empty vehicles damageable?


Re: Putting HP in vehicles - Mugala - 20.02.2018

you can make an unoccupied vehicle damageable with OnPlayerWeaponShot callback.

PHP код:
if(hittype == BULLET_HIT_TYPE_VEHICLE)
{
    if(
GetVehicleID(hitid) != INVALID_VEHICLE_ID)
    {
        new 
Float:VHP;
        
GetVehicleHealth(hitid,VHP);
        
SetVehicleHealth(hitid,VHP-30); // you can set damage for each weapons
    
}




Re: Putting HP in vehicles - RogueDrifter - 20.02.2018

Quote:
Originally Posted by Mugala
Посмотреть сообщение
you can make an unoccupied vehicle damageable with OnPlayerWeaponShot callback.

PHP код:
if(hittype == BULLET_HIT_TYPE_VEHICLE)
{
    if(
GetVehicleID(hitid) != INVALID_VEHICLE_ID)
    {
        new 
Float:VHP;
        
GetVehicleHealth(hitid,VHP);
        
SetVehicleHealth(hitid,VHP-30); // you can set damage for each weapons
    
}

Remove that GetVehilcleID check its useless and even if it wasnt itd be something like so....
PHP код:
hitid != INVALID_VEHICLE_ID 



Re: Putting HP in vehicles - ISmokezU - 20.02.2018

Switch between weapon ids to give concentrated damages for different weapons.


Re: Putting HP in vehicles - Mugala - 20.02.2018

Quote:
Originally Posted by RogueDrifter
Посмотреть сообщение
Remove that GetVehilcleID check its useless and even if it wasnt itd be something like so....
PHP код:
hitid != INVALID_VEHICLE_ID 
LOL I just looked at my code now I'm getting ID from ID, nice, good job Mugala +1.
by the way, otherwise it will work.