Jump to content

Exploding Heli Protection Script


ScaRR

Recommended Posts

thanks for this ...

 

i took a look at the code and decided there was no reason to disable damage every time a player enters driver seat (as that can obviusly be abused if players found out) considdering there could be another player in the vehicle already, also no reason to set damage to false on the client transfering the vehicle to the next local player.

 

so heres my edit ... havent heard any complaints as of yet:

/*
	File: OX3_GetInProtect.sqf
	Author: ScaRR
	minor edits by Halv
*/
if(isServer) exitWith {};

fn_handleGetIn = {
	private ["_vehicle","_seat"];
	_vehicle = _this select 0;
	_seat = _this select 1;
	if(count (crew _vehicle) < 1)then{
		_vehicle setVariable ["GotIn",true];
		_vehicle allowDamage false;
	};
};

fn_handleLocal = {
	private "_vehicle";
	_vehicle = _this select 0;
	if(_this select 1)then{
		_vehicle setVariable ["LocalChanged",true];
		_vehicle allowDamage false;
	};
};

while {true} do {
	{
		if (!(_x getVariable ["added_EHProtect",false])) then {
			_x addEventHandler ["GetIn", {_this call fn_handleGetIn;}];
			_x addEventHandler ["Local", {_this call fn_handleLocal;}];
			_x setVariable ["added_EHProtect",true];
		 };
		if( (_x getVariable["GotIn",false])) then{
		 	sleep 3;
			_x allowDamage true;
			_x setVariable ["GotIn",false];
		};
		if( (_x getVariable["LocalChanged",false])) then{
		 	sleep 3;
			_x allowDamage true;
			_x setVariable ["LocalChanged",false];
		};
	}forEach vehicles;
	uiSleep 5;
};  

possibly these sleeps for 3seconds could be reduced aswell, i havent tried it yet, but im sure 3 seconds is possibly too much.

Link to comment
Share on other sites

I have been trying to add this to my server. Every time I add it i get errors, I added this

  Reveal hidden contents

*/


if(isServer) exitWith {};

fn_handleGetIn = {
private ["_vehicle","_seat"];
_vehicle = _this select 0;
_seat = _this select 1;

if(_seat == "driver")then{
_vehicle setVariable ["GotIn",true];
_vehicle allowDamage false;
diag_log "[OX3] - Vehicle getin handled";
};
};

fn_handleLocal = {
private ["_vehicle","_local"];

_vehicle = _this select 0;
_local = _this select 1;
_vehicle setVariable ["LocalChanged",true];
_vehicle allowDamage false;
diag_log "[OX3] - Vehicle local handled";

};

diag_log "[OX3] - Vehicle get in pilot protection";
while {true} do
{

{
if (!(_x getVariable ["added_EHProtect",false])) then {
_x addEventHandler ["GetIn", {_this call fn_handleGetIn;}];
_x addEventHandler ["Local", {_this call fn_handleLocal;}];
_x setVariable ["added_EHProtect",true];
};

if( (_x getVariable["GotIn",false])) then{
sleep 3;
_x allowDamage true;
_x setVariable ["GotIn",false];
};

if( (_x getVariable["LocalChanged",false])) then{
sleep 3;
_x allowDamage true;
_x setVariable ["LocalChanged",false];
};
}forEach vehicles;

uiSleep 5;

};

to the sqf

This is what my rpt says after it starts.

  Reveal hidden contents

21:15:20 Error in expression */\scripts\ox3_getinprotect.sqf"


if(isServer) exitWith {};

fn_handle>
21:15:20 Error position: <*/

if(isServer) exitWith {};

fn_handle>
21:15:20 Error Invalid number in expression \scripts\ox3_getinprotect.sqf"

IDK is that */ ment to be there? 

Link to comment
Share on other sites

  On 7/1/2015 at 2:23 AM, bustedparts said:

I have been trying to add this to my server. Every time I add it i get errors, I added this

  Reveal hidden contents

*/

if(isServer) exitWith {};

fn_handleGetIn = {

private ["_vehicle","_seat"];

_vehicle = _this select 0;

_seat = _this select 1;

if(_seat == "driver")then{

_vehicle setVariable ["GotIn",true];

_vehicle allowDamage false;

diag_log "[OX3] - Vehicle getin handled";

};

};

fn_handleLocal = {

private ["_vehicle","_local"];

_vehicle = _this select 0;

_local = _this select 1;

_vehicle setVariable ["LocalChanged",true];

_vehicle allowDamage false;

diag_log "[OX3] - Vehicle local handled";

};

diag_log "[OX3] - Vehicle get in pilot protection";

while {true} do

{

{

if (!(_x getVariable ["added_EHProtect",false])) then {

_x addEventHandler ["GetIn", {_this call fn_handleGetIn;}];

_x addEventHandler ["Local", {_this call fn_handleLocal;}];

_x setVariable ["added_EHProtect",true];

};

if( (_x getVariable["GotIn",false])) then{

sleep 3;

_x allowDamage true;

_x setVariable ["GotIn",false];

};

if( (_x getVariable["LocalChanged",false])) then{

sleep 3;

_x allowDamage true;

_x setVariable ["LocalChanged",false];

};

}forEach vehicles;

uiSleep 5;

};

to the sqf

This is what my rpt says after it starts.

  Reveal hidden contents

21:15:20 Error in expression */\scripts\ox3_getinprotect.sqf"

if(isServer) exitWith {};

fn_handle>

21:15:20 Error position: <*/

if(isServer) exitWith {};

fn_handle>

21:15:20 Error Invalid number in expression \scripts\ox3_getinprotect.sqf"

IDK is that */ ment to be there? 

 

 

Hey, just paste the entire script, the */ is the closing tag for the comments and boilerplate at the top of the file. If you are using my original script , replace */ with 

 

Link to comment
Share on other sites

Seems i don't get it running because i never have logfiles which say that the script is active. Also helis still explode. May i ask what i am missing here? Here is my init.sqf:

// Logo
[] execVM "images\logo.sqf";
/////////////////////////////////////////////////////////////// Earplugs for vehicles
call compile preProcessFileLineNumbers "cmEarplugs\config.sqf";

/////////////////////////////////////////////////////////////// Custom Spawn selection
[] execVM "addons\halv_spawn\init.sqf";/////////////////////////////////////////////////////////////// Control the epoch ai limit per player

// 1. Cultist, 2. Shark, 3. Sapper regular, 4. Super Sapper, 5. Drone, 6. Invisible Phantom, 7. Transport Heli
EPOCH_spawnLimits = [2, 1, 4, 0, 0, 0, 1];// Mission script

if(hasInterface) then {

execVM "semClient.sqf";
[] execVM "addons\halo\halo_out.sqf";
[] execVM "addons\service_point\service_point.sqf";

};

[] execVM "trader\init.sqf";
[] execVM "trader\HALV_takegive_crypto_init.sqf";
[] execVM "trader\resetvehicleammo.sqf";
[] execVM "effect.sqf";
[] execVM "addons\messages\init.sqf";
[] execVM "addons\OX3_GetInProtect.sqf";

Thanks

Link to comment
Share on other sites

  On 7/7/2015 at 5:14 AM, flow0815 said:

Seems i don't get it running because i never have logfiles which say that the script is active. Also helis still explode. May i ask what i am missing here? Here is my init.sqf:

// Logo
[] execVM "images\logo.sqf";
/////////////////////////////////////////////////////////////// Earplugs for vehicles
call compile preProcessFileLineNumbers "cmEarplugs\config.sqf";

/////////////////////////////////////////////////////////////// Custom Spawn selection
[] execVM "addons\halv_spawn\init.sqf";/////////////////////////////////////////////////////////////// Control the epoch ai limit per player

// 1. Cultist, 2. Shark, 3. Sapper regular, 4. Super Sapper, 5. Drone, 6. Invisible Phantom, 7. Transport Heli
EPOCH_spawnLimits = [2, 1, 4, 0, 0, 0, 1];// Mission script

if(hasInterface) then {

execVM "semClient.sqf";
[] execVM "addons\halo\halo_out.sqf";
[] execVM "addons\service_point\service_point.sqf";

};

[] execVM "trader\init.sqf";
[] execVM "trader\HALV_takegive_crypto_init.sqf";
[] execVM "trader\resetvehicleammo.sqf";
[] execVM "effect.sqf";
[] execVM "addons\messages\init.sqf";
[] execVM "addons\OX3_GetInProtect.sqf";

Thanks

 

Hey, are you checking your client side rpt?

 

If so, try adding diag_log before and after this

 

if(isServer) exitWith {};

 

 

 

e.g. 

 

diag_log "[OX3] - Vehicle get in pilot protection - Pre isSever check";

if(isServer) exitWith {};

diag_log "[OX3] - Vehicle get in pilot protection - Post isSever check";

 

 

 

You should at least see the first one. If you don't see the second one try changing isServer to isDedicated.

Link to comment
Share on other sites

  On 7/7/2015 at 7:53 AM, flow0815 said:

Hi Scarr,

 

ist the logging in your script client side? This one i never checked. :D :D  I only checked it on my server rpt files.This code goes directly into your script file?

 

Thanks man

 

Yes the script runs client side. Your init.sqf looks fine. 

The code change I suggested is in the OX3_GetInProtect.sqf script. 

 

The line below, if(isServer) exitWith {};    , means that if the server is running the script it should exit so this means it will only run on clients. isDedicated is a similar check, it just checks if it is a dedicated server but isServer should work. 

I suggest first checking the client rpt for errors before making the changes.

Link to comment
Share on other sites

Thank you. Will check that when i am at home. The script was running from the beginning but the player still complain about exploding helis. So i set your line more to the top of init.sqf maybe this helps.

Will check that.

 

Thanks again

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Discord

×
×
  • Create New...