Jump to content
  • 0

Earplugs for vehicles...


Angrygargamel

Question

Hi&Hello...

i tried to implement this little but functional earplug script on my epoch server...

i have tried 3 different variants now... but the mousewheel actions never show up

 

http://www.armaholic.com/page.php?id=26624

 

any suggestions?

 

 

who doesnt know what this script does...

when you fly in a heli you cant understand anything of the VON or teamspeak unless you turn the ingame volume down

this script does this for you instant... put the earplugs in... sound is lowered to x percent

take the earplugs out... sound is back to normal

Link to comment
Share on other sites

Recommended Posts

  • 0

Joyous day all, I have finished my script with satisfactory results. Everyone should get the menu now, regardless of server restart, fresh spawn to a server that just restarted, all situations should be good to go. 

 

Here is the link to the RAR with all the files you need for a vanilla server.

 

https://www.dropbox.com/s/sze9g3a8izghc7j/EARPLUGS.rar?dl=0

 

Make sure to change out this line in your Battley scripts.txt filter

7 exec !="<execute expression=" !"RscDebugConsole_execute" !"execFSM" !"_executeStackedEventHandler" !"fn_execVM" !"fn_moduleExecute" !"fn_execRemote" !"fn_MPexec" !"bis_fnc_moduleExecute_activate" !"fn_tridentExecute" !"randomize_civ1" !"executed from" !"EPOCH_DebugGUI_exec" !"_handle = [_display] execVM _script;" !"finddisplay" !"execVM \"\A3\Structures_F\scripts" !="execVM \"\A3\Structures_F_EPC\Civ\PlayGround\scripts\Carousel_spin.sqf\""

Hope this works out for you guys. :)

Link to comment
Share on other sites

  • 0

Joyous day all, I have finished my script with satisfactory results. Everyone should get the menu now, regardless of server restart, fresh spawn to a server that just restarted, all situations should be good to go. 

 

Here is the link to the RAR with all the files you need for a vanilla server.

 

https://www.dropbox.com/s/sze9g3a8izghc7j/EARPLUGS.rar?dl=0

 

Make sure to change out this line in your Battley scripts.txt filter

7 exec !="<execute expression=" !"RscDebugConsole_execute" !"execFSM" !"_executeStackedEventHandler" !"fn_execVM" !"fn_moduleExecute" !"fn_execRemote" !"fn_MPexec" !"bis_fnc_moduleExecute_activate" !"fn_tridentExecute" !"randomize_civ1" !"executed from" !"EPOCH_DebugGUI_exec" !"_handle = [_display] execVM _script;" !"finddisplay" !"execVM \"\A3\Structures_F\scripts" !="execVM \"\A3\Structures_F_EPC\Civ\PlayGround\scripts\Carousel_spin.sqf\""

Hope this works out for you guys. :)

works fine for admins but not normal players...they are automaticaly on and u cant turn them off (no scroll wheel option)

 

ok now have the scroll option as normal player..but even with your BE line changed i get white screen as normal player

Link to comment
Share on other sites

  • 0

I use the standard Epoch antihack and with this script enabled players get autobanned (usually after a server restart), when I look at the ban reason it mentions addactions as being the reason but I can't see a line in the scripts.txt file relating to addactions.

The epoch auto bans wont be in the scripts.txt Its in a setting we cant access for some reason

Link to comment
Share on other sites

  • 0

The epoch auto bans wont be in the scripts.txt Its in a setting we cant access for some reason

 

It's weird, I've added both earplugs and the Explosives to Vehicle script on my server, both of which use addactions and both of which cause the autoban (they are also hit and miss as to whether they load at all).

 

I have IgiLoad installed which also uses addaction but which works flawlessly.  I have ended up removing the earplugs and EtV script for the time being as after every server restart people get auto banned.

Link to comment
Share on other sites

  • 0

It's weird, I've added both earplugs and the Explosives to Vehicle script on my server, both of which use addactions and both of which cause the autoban (they are also hit and miss as to whether they load at all).

 

I have IgiLoad installed which also uses addaction but which works flawlessly.  I have ended up removing the earplugs and EtV script for the time being as after every server restart people get auto banned.

 

The basic script for earplugs i'm using doesn't require an "addaction", if you want to give a try:

 

You only need earplugs.sqf (root of your mpmission folder):

if(isNil "EarPlugsOn") then {EarPlugsOn = true;} else {EarPlugsOn = !EarPlugsOn};
ToggleEarPlugs =
{
	if (soundVolume != 1) then
	{
		1 fadeSound 1;
		cutText ['Ear plugs taken off', 'PLAIN'];
	} else {
		1 fadeSound 0.2;
		cutText ['Ear plugs put on', 'PLAIN'];
	};
};
if(EarPlugsOn) then 
{ 
	Press_F3 = (findDisplay 46) displayAddEventHandler ["KeyDown","if ((_this select 1) == 61) then {call ToggleEarPlugs;};"];
};
if(!EarPlugsOn) then 
{
	(findDisplay 46) displayRemoveEventHandler ["KeyDown", Press_F3];
};

and initplayerlocal.sqf, in your mpsission root aswell:

while {true} do
{
	waitUntil {alive vehicle player};
	Sleep 10;
	[] execVM "earplugs.sqf";
	waitUntil {!alive player};
	[] execVM "earplugs.sqf";
};

then don't forget to add filters to scripts.txt in your battleye folder:

 

(add this at the end of line 53: displayAddEventHandler)

!"Press_F3 = (findDisplay 46) displayAddEventHandler [\"KeyDown\",\"if ((_this select 1) == 61) then {call T"

(add this at the end of line 59: displayRemoveEventHandler)

!"(findDisplay 46) displayRemoveEventHandler [\"KeyDown\", Press_F3];"
Link to comment
Share on other sites

  • 0

 

The basic script for earplugs i'm using doesn't require an "addaction", if you want to give a try:

 

You only need earplugs.sqf (root of your mpmission folder):

if(isNil "EarPlugsOn") then {EarPlugsOn = true;} else {EarPlugsOn = !EarPlugsOn};
ToggleEarPlugs =
{
	if (soundVolume != 1) then
	{
		1 fadeSound 1;
		cutText ['Ear plugs taken off', 'PLAIN'];
	} else {
		1 fadeSound 0.2;
		cutText ['Ear plugs put on', 'PLAIN'];
	};
};
if(EarPlugsOn) then 
{ 
	Press_F3 = (findDisplay 46) displayAddEventHandler ["KeyDown","if ((_this select 1) == 61) then {call ToggleEarPlugs;};"];
};
if(!EarPlugsOn) then 
{
	(findDisplay 46) displayRemoveEventHandler ["KeyDown", Press_F3];
};

and initplayerlocal.sqf, in your mpsission root aswell:

while {true} do
{
	waitUntil {alive vehicle player};
	Sleep 10;
	[] execVM "earplugs.sqf";
	waitUntil {!alive player};
	[] execVM "earplugs.sqf";
};

then don't forget to add filters to scripts.txt in your battleye folder:

 

(add this at the end of line 53: displayAddEventHandler)

!"Press_F3 = (findDisplay 46) displayAddEventHandler [\"KeyDown\",\"if ((_this select 1) == 61) then {call T"

(add this at the end of line 59: displayRemoveEventHandler)

!"(findDisplay 46) displayRemoveEventHandler [\"KeyDown\", Press_F3];"

 

Brilliant, thank you :)

Link to comment
Share on other sites

  • 0

Would you mind sharing your mission folder so I can see your files? I created that script on a blank server, with no admins setup. I also had a friend of mine join to confirm that it triggers at the right time. I am curious to see if your files differ from mine in anyway. I spent a great deal of time confirming that the techniques I used were stable. I will see what I can do, I have run the code on my test server with no issues, as well as my live server. Try joining my live server as that has a shit ton of scripts. let me know if it autobans you.

 

Thanks for the feedback, it helps me evolve.  :)

Link to comment
Share on other sites

  • 0

 

The basic script for earplugs i'm using doesn't require an "addaction", if you want to give a try:

 

You only need earplugs.sqf (root of your mpmission folder):

if(isNil "EarPlugsOn") then {EarPlugsOn = true;} else {EarPlugsOn = !EarPlugsOn};
ToggleEarPlugs =
{
	if (soundVolume != 1) then
	{
		1 fadeSound 1;
		cutText ['Ear plugs taken off', 'PLAIN'];
	} else {
		1 fadeSound 0.2;
		cutText ['Ear plugs put on', 'PLAIN'];
	};
};
if(EarPlugsOn) then 
{ 
	Press_F3 = (findDisplay 46) displayAddEventHandler ["KeyDown","if ((_this select 1) == 61) then {call ToggleEarPlugs;};"];
};
if(!EarPlugsOn) then 
{
	(findDisplay 46) displayRemoveEventHandler ["KeyDown", Press_F3];
};

and initplayerlocal.sqf, in your mpsission root aswell:

while {true} do
{
	waitUntil {alive vehicle player};
	Sleep 10;
	[] execVM "earplugs.sqf";
	waitUntil {!alive player};
	[] execVM "earplugs.sqf";
};

then don't forget to add filters to scripts.txt in your battleye folder:

 

(add this at the end of line 53: displayAddEventHandler)

!"Press_F3 = (findDisplay 46) displayAddEventHandler [\"KeyDown\",\"if ((_this select 1) == 61) then {call T"

(add this at the end of line 59: displayRemoveEventHandler)

!"(findDisplay 46) displayRemoveEventHandler [\"KeyDown\", Press_F3];"

 

 

 

For me it does not work, nothing happens.

Link to comment
Share on other sites

  • 0

how to activate the menu just in vehicles?

Here you go dude, I finished testing it out earlier today.

 

Copy this to your onPlayerRespawn.sqf file in your root mission folder. (if you don't have it, create it.

waituntil {!isnull (finddisplay 46)};

private ["_hintTitle","_hintText","_hintInfo","_hintOut","_cm_die","_guydude","_cmtrig","_cmbreathing","_cm_startingpos","_cm_position","_cm_stationary"];

_cmbreathing = alive player;
_cmtrig=true;
_guydude = player;

while {_cmtrig} do {

sleep 0.5;

if (_cmbreathing) then {
_cm_startingpos = position player;
sleep 0.5;
_cm_position = position _guydude;
_cm_stationary = _cm_startingpos select 0 == _cm_position select 0 && _cm_startingpos select 1 == _cm_position select 1;
if (_cm_stationary) then {
hint "Spawned in... Standing around...";
} else {
hint "Starting up scripts...";
_cmtrig=false;
};
};
};

UISLEEP 5;

[] execVM "earplugs.sqf"; 


And copy this code to your earplugs.sqf file in your root folder. (if you don't have it, make it)

//created by computermancer //Inspitration for code structure came from // v1g Fast Rope by [STELS]Zealot
//=========================================================================================
//=== Awesome Earplugs Scripts==================================
//---by computermancer----- superfunserver.com------------------

#define CM_ADD_TITLE1 "Earplugs"
earplugsout=true;

// the vehicles in which you can addAction
cm_allowed_array = ["O_Heli_Light_02_unarmed_F","O_Heli_Light_02_F","B_Heli_Transport_01_F","B_Heli_Transport_01_camo_F","O_Heli_Attack_02_F","O_Heli_Attack_02_black_F","I_Heli_Transport_02_F","B_Heli_Light_01_F","C_Offroad_01_EPOCH","C_Quadbike_01_EPOCH","C_Hatchback_01_EPOCH","C_Hatchback_02_EPOCH","C_SUV_01_EPOCH","C_Rubberboat_EPOCH","C_Rubberboat_02_EPOCH","C_Rubberboat_03_EPOCH","C_Rubberboat_04_EPOCH","C_Van_01_box_EPOCH","C_Van_01_transport_EPOCH","C_Boat_Civil_01_EPOCH","C_Boat_Civil_01_police_EPOCH","C_Boat_Civil_01_rescue_EPOCH","B_Heli_Light_01_EPOCH","B_SDV_01_EPOCH","B_MRAP_01_EPOCH","B_Truck_01_transport_EPOCH","B_Truck_01_covered_EPOCH","B_Truck_01_mover_EPOCH","B_Truck_01_box_EPOCH","O_Truck_02_covered_EPOCH","O_Truck_02_transport_EPOCH","O_Truck_03_covered_EPOCH","O_Truck_02_box_EPOCH","I_Heli_light_03_unarmed_EPOCH","O_Heli_Light_02_unarmed_EPOCH","I_Heli_Transport_02_EPOCH","O_Heli_Transport_04_EPOCH","O_Heli_Transport_04_bench_EPOCH","O_Heli_Transport_04_box_EPOCH","O_Heli_Transport_04_covered_EPOCH","B_Heli_Transport_03_unarmed_EPOCH","jetski_epoch","K01","K02","K03","K04","ebike_epoch","mosquito_epoch"];
	
cm_addaction_req = {
private ["_veh","_cm_req"];
_veh = vehicle player;
_cm_req = (_veh != player) and { (typeof _veh) in cm_allowed_array } and {alive _veh};
_cm_req;
};
		
cm_FUNc_earplugs = {

	if (earplugsout) then {

	hint "Earplugs have been put in.";
	1 fadeSound 0.25;
	earplugsout=false;

	} else {

	hint "Earplugs have been taken out.";
	1 fadeSound 1;		
	earplugsout=true;
	};
};

player addAction["<t color='#00ffff'>"+CM_ADD_TITLE1+"</t>", cm_FUNc_earplugs, [], -1, false, false, '','[] call cm_addaction_req'];
cutText [format["You can now wear earplugs when in certain vehicles."], "PLAIN DOWN",1];

As for battle eye filters, just add this to your scripts.txt file. Look for the "execvm" line and at the end of it, add this...

!="finddisplay" !="onPlayerRespawn.sqf" !="earplugs.sqf"

should look something like this

7 exec !="<execute expression=" !"RscDebugConsole_execute" !"execFSM" !"_executeStackedEventHandler" !"fn_execVM" !"fn_moduleExecute" !"fn_execRemote" !"fn_MPexec" !"bis_fnc_moduleExecute_activate" !"fn_tridentExecute" !"randomize_civ1" !"executed from" !"EPOCH_DebugGUI_exec" !"_handle = [_display] execVM _script;" !"execVM \"\A3\Structures_F\scripts" !="execVM \"\A3\Structures_F_EPC\Civ\PlayGround\scripts\Carousel_spin.sqf\"" !="HC\init.sqf" !="aoa\DCL\init.sqf;" !="IgiLoad" !="R3F_ARTY_AND_LOG" !="HC" !="FuMs" !="NameTags" !="SFM" !="superfun" !="randomize_colors" !="clock.sqf" !="randomize_gue" !="finddisplay" !="onPlayerRespawn.sqf" !="earplugs.sqf"

Link to comment
Share on other sites

  • 0

For me it does not work, nothing happens.

 

You should increase the sleep value like Phenomax suggested,

 

 

Scoo's script is now working fine for me, since i increased the sleep value from 10 to 30.

Maybe some datas need to be loaded before the EarPlugs can be initialized.

Greez

 

I'm not sure about it but I noticed players loading doesn't last the same on every server, so earplugs script triggers when player is still in loading... most probably.

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
  • Advertisement
×
×
  • Create New...