SA-MP Forums Archive
[Include] VehicleDamage - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] VehicleDamage (/showthread.php?tid=620293)



VehicleDamage - PistolWhip - 28.10.2016

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


Re: VehicleDamage - SecretBoss - 31.10.2016

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


Re: VehicleDamage - PistolWhip - 31.10.2016

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.