[Include] VehicleDamage
#1

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: Click me
Reply
#2

Quote:

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

So if you set the amount to 0 it will prevent the damage

Nice job tho
Reply
#3

Quote:
Originally Posted by SecretBoss
View Post
So if you set the amount to 0 it will prevent the damage

Nice job tho
You can set
PHP Code:
apply_health_damage 
to 0 to revert the damage or set the amount to a custom value.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)