28.10.2016, 16:48
Hi,
this include provides some functionality (2 callbacks) for handling vehicle health and visual damage.
Configurations:
Callbacks:
Example code:
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: Click me
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)
Code:
OnVehicleTakeDamage(vehicleid, driverid, &Float:amount, playerid, weaponid, &apply_health_damage); OnVehicleTakeVisualDamage(vehicleid, driverid, &apply_visual_damage);
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; }
Github: Click me