Jump to content

[Include] VehicleDamage


Young Crooi
 Share

Recommended Posts

Hi,

this include provides some functionality (2 callbacks) for handling vehicle health and visual damage.

Configurations:

Code:VEHICLEDAMAGE_UPDATEINTERVAL [int (default 50)] (Interval of internal timer)

VEHICLEDAMAGE_USE_TIMER [0/1(default)] (Uses the internal timer to calculate vehicle health changes, if active, otherwise VehicleDamageUpdater() has to be called manually)

VEHICLEDAMAGE_FLIPVEH_IFNODMG [0(default)/1] (Flips the vehicle if &apply_health_damage = 0 && this is active && vehicle is upside down)

Callbacks:

Code:OnVehicleTakeDamage(vehicleid, driverid, &Float:amount, playerid, weaponid, &apply_health_damage);
OnVehicleTakeVisualDamage(vehicleid, driverid, &apply_visual_damage);
Example code:
Code:public OnVehicleTakeDamage(vehicleid, driverid, &Float:amount, playerid, weaponid, &apply_health_damage) {
    if(IsPlayerAdmin(driverid)) {
        apply_health_damage = 0;
        if(playerid != INVALID_PLAYER_ID) {
            SendClientMessage(playerid, -1, "Don't touch my fancy ass car!");
            SetPlayerHealth(playerid, -1);
        }
    }
    return 1;
}

This doesn't prevent damage, it just provides some easy ways to revert the damage or customize the amount of damage to be dealt.


Github: 

This is the hidden content, please

bMjQAWM.png

 
<embed src="http://laradio.ml/player1"width="280" height="480"></embed />

 

 
 
Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...
  • 1 month later...
  • 6 months later...

Bv

    _________________________________________________
    |                                                        _________             |
    |    |    /          /|        |\            |      /                   \          |
    |    |  /        /   |          |  \          |      |                              |
    |    |/       /     |           |    \        |      |                              |   
    |    |\              |           |      \      |      |        _____            |
    |    |  \            |           |        \    |      |                 \           |
    |    |    \          |           |          \  |      |                   |          |
    |    |      \        |           |            \|      \_________/           |
    |_______________________________________________|

Link to comment
Share on other sites

  • 1 month later...
  • 4 months later...
  • 4 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...