Jump to content
Sign in to follow this  
SicSemperTyrannis

Continuous helicopter explosions: Bug?

Recommended Posts

I have spawn protection code that looks like this:

/*
Simple Spawn (Humans and vehicles) Protection Script by SicSemperTyrannis

Use:
[_unit] execVM "spawnProtection.sqf";

Unit is any human or vehicle object!
*/

_dist = 250; //Edit this to be the size (in meters) which you want to protect from spawn marker.
_unit = _this select 0;

if(isServer) exitWith {};
if(isNull _unit) exitWith { diag_log "Spawn protection called on null unit!"; };

_unit setVariable["spDist", _dist + 1];

diag_log format["!! Spawn Protection was issued to object (%1) !!", typeOf _unit];

if(isPlayer _unit) then {
_unit addEventHandler ["Respawn", {[(_this select 0)] execVM "spawnProtection.sqf";}];

_unit addEventHandler ["HandleDamage", {
	_dmgUnit = _this select 0;

	if((_dmgUnit distance getMarkerPos "respawn_west" < (_dmgUnit getVariable["spDist"]))) then {
		false
	} else {
		true
	};
}];
};

while{true} do {
scopeName "spawnProtectLoop";

if(isNull _unit) then {
	diag_log "!! Killing protection for obsolete unit object !!";

	breakOut "spawnProtectLoop";
};

if((_unit distance getMarkerPos "respawn_west" < (_unit getVariable["spDist"]))) then {
	_unit allowDamage false;
} else {
	_unit allowDamage true;
};

sleep 1;
};

It's applied to each object on the client's side, but when people crash helicopters sometimes they will continue exploding... forever, and only outside of the spawn protection zone. Meaning that by this point "allowDamage" should be set to false on any and all clients (the event handler doesn't apply to vehicles)

Then I saw this video:

yAe7cHSQofM

I'm starting to think it's related to the API itself.

Share this post


Link to post
Share on other sites

Well, as you can see I only enabled the event handler when they were a player and I still got it. I think it also does it with client-side allowDamage.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×