Jump to content

Earplug.sqf - Hard coded activation key


Recommended Posts

Hi there, 

I am attempting to modify the earplug script such that the users of our server can set their own activation key (IE: not Pause/Break) via the Use Action 1-20 custom keys. 
I am also very new to scripting and so I am having issues with this. 

The script uses displayAddEventHandler to compare the key pressed to Pause/Break (197) but I dont know how to reference the Custom Controls keys inside of that script. 

Any help? This is where Im at. The commented line is the original, and I am just attempting to have a hint show the number of the key pressed. Where do I go from here? I want the key to be set by Use Action 20. 

Thanks for any help! 


_UKD = actionKeys "User20";
//MEP_KD = (findDisplay 46) displayAddEventHandler ["KeyDown", "if (_this select 1 == 197) then {_this call earplugAction;};"];
MEP_KD = (findDisplay 46) displayAddEventHandler ["KeyDown", "if (_this select 1 == _UKD) then {hint str _UKD};"];


Link to comment
Share on other sites

Its actually not doing anything. No errors, and no hint display. I tried adding "actionKeys "User 20" directly into the displayAddEventHandler and I got an error saying the type was incorrect. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Forum Statistics

    Total Topics
    Total Posts
  • Create New...