Vehicle take damage
#1

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

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;
}
Reply
#3

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

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

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)