SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 28/10/2016, 04:48 PM   #1
PistolWhip
Little Clucker
 
Join Date: Mar 2016
Posts: 3
Reputation: 0
Default VehicleDamage

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
PistolWhip is offline   Reply With Quote
Old 31/10/2016, 03:33 PM   #2
SecretBoss
Gangsta
 
SecretBoss's Avatar
 
Join Date: Dec 2014
Location: Greece
Posts: 807
Reputation: 106
Default Re: VehicleDamage

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
__________________
SecretBoss is offline   Reply With Quote
Old 31/10/2016, 08:13 PM   #3
PistolWhip
Little Clucker
 
Join Date: Mar 2016
Posts: 3
Reputation: 0
Default Re: VehicleDamage

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.
PistolWhip is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[HELP] about vehicledamage boynumber5 Help Archive 6 31/07/2010 04:38 PM


All times are GMT. The time now is 09:54 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.