SA-MP Forums Archive
Vehicle take damage - 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 take damage (/showthread.php?tid=507852)



Vehicle take damage - Lidor124 - 19.04.2014

Is that possible to make a vehicle take damage although there isn't any person in the vehicle like single player?


Re: Vehicle take damage - doreto - 19.04.2014

Yes,OnPlayerWeaponShot

pawn Code:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    if(hittype == BULLET_HIT_TYPE_VEHICLE)
    {
        // lower vehicle health
    }
    return 1;
}



Re: Vehicle take damage - Lidor124 - 19.04.2014

Quote:
Originally Posted by doreto
View Post
Yes,OnPlayerWeaponShot

pawn Code:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    if(hittype == BULLET_HIT_TYPE_VEHICLE)
    {
        // lower vehicle health
    }
    return 1;
}
What is the default value? i mean the vehicle damaged will be updated according to the weapon which shoots.


Re: Vehicle take damage - doreto - 19.04.2014

Quote:
Originally Posted by Lidor124
View Post
What is the default value? i mean the vehicle damaged will be updated according to the weapon which shoots.
Each weapon deals different damage like(not sure if those damage value are correct) deagle deals 35 dm and 8 mm pistol 8 dm.You can customize damage value to affect vehicle health whatever you want.


Re: Vehicle take damage - Lidor124 - 20.04.2014

Quote:
Originally Posted by doreto
View Post
Each weapon deals different damage like(not sure if those damage value are correct) deagle deals 35 dm and 8 mm pistol 8 dm.You can customize damage value to affect vehicle health whatever you want.
Yes but i want the original values like you hit in vehicle while there is a player as driver in the vehicle.


Re: Vehicle take damage - arakuta - 20.04.2014

I don't know the original values, you should test each one.

Then create a float array with those values.

And of course, check if the vehicle is unnoccupied, because when lagcomp is on, as you shot in a vehicle, there is a lag compensation also.

By the way, OnPlayerWeaponShot only works with bullet weapons, as far as i know. So, if you you rocket an unnoccupied vehicle, nothing will happens.


Re: Vehicle take damage - Dziugsas - 20.04.2014

https://sampforum.blast.hk/showthread.php?tid=271903