Jump to content
Sign in to follow this  
iceman77

DisableUserInput (but only the keyboard)

Recommended Posts

When haloing, you can find yourself across the map in a hurry (especially from high altitudes). I have a spawning system for players to spawn inside specific markers. I'm now spawning them via halo, over a random position in the marker(s). The thing is, I need the person haloing, to land somewhere inside of the marker. Or atleast at a reasonable distance. Basically, I don't want players intentionally drifting into an area they haven't captured, upon respawn (exploiting). But they should be able to look around. To do this, I wanted to disable the users input, but only for keys. Because as soon as they spawn (halo) if I use disableuserInput (until a certain height), the person isn't free to look around, as he/she should be to be aware of surroundings.

Any thoughts or help is appreciated.

Edited by Iceman77

Share this post


Link to post
Share on other sites

The easiest way would be to disableUserInput When a key is pressed and re enable when released. Or Disable on keypressed, spawn a brief sleep, then re-enable.

_handle_KeyDown = (findDisplay 46) displayAddEventHandler ["KeyDown","disableUserInput true"];

_handle_KeyUp = (finddisplay 46) displayaddeventhandler ["keyUp","disableUserInput false"];

OR..

_handle_KeyDown = (findDisplay 46) displayAddEventHandler ["KeyDown","disableUserInput true; 0.15 spawn {sleep _this;disableUserInput false}"];//This may be the safer approach

Share this post


Link to post
Share on other sites

np

Just don't forget to remove it when its no longer needed.

_handle_KeyDown = (findDisplay 46) displayAddEventHandler ["KeyDown","disableUserInput true; 0.15 spawn {sleep _this;disableUserInput false}"];
["KeyDown",_handle_KeyDown] spawn {
WaitUntil {YOUR_CONDITION};
(findDisplay 46) displayRemoveEventHandler _this;
};

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  

×