Putting HP in vehicles
#1

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

Reply
#2

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

You want to make empty vehicles damageable?
Reply
#4

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
    
}

Reply
#5

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

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

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)