Home   Help Search Login Register  

Author Topic: Disable direct vehicle command  (Read 2519 times)

0 Members and 1 Guest are viewing this topic.

Offline Ext3rmin4tor

  • Members
  • *
Disable direct vehicle command
« on: 23 Mar 2013, 19:39:00 »
I have a humvee whose driver is not in the player team. The player unit is the humvee gunner. I want to prevent the driver to assign direct commands like FORWARD, LEFT, etc. Do you know how to do that?

EDIT:
I managed to do that with actionKeys and display event handlers. You just return true with a custom display event handler script in the main display (code 46). Here's the script:

Code: [Select]
disableInput =
{
_r = false;
{

if ((_this select 1) in _x) exitWith
{
_r = true;
};
} forEach disabled_keys;
_r;
};

disabled_keys = [];
while {true} do
{
_up_keys = actionKeys "CommandForward";
_down_keys = actionKeys "CommandBack";
_left_keys = actionKeys "CommandLeft";
_right_keys = actionKeys "CommandRight";
_ff_keys = actionKeys "CommandFast";
_sf_keys = actionKeys "CommandSlow";
disabled_keys = [_up_keys,_down_keys,_left_keys,_right_keys,_ff_keys,_sf_keys];
if (movement_disabled) then
{
hint format ["%1", disabled_keys];
(findDisplay 46) displaySetEventHandler["keydown","_this call disableInput"];
(findDisplay 46) displaySetEventHandler["keyup","_this call disableInput"];
waitUntil{!movement_disabled};
}
else
{
(findDisplay 46) displaySetEventHandler["keydown",""];
(findDisplay 46) displaySetEventHandler["keyup",""];
disabled_keys = [];
waitUntil{movement_disabled};
};
sleep 0.01;
};
« Last Edit: 23 Mar 2013, 21:40:51 by Ext3rmin4tor »
How can you shoot women and children?
Easy! Ya' just don't lead'em so much! Ain't war hell?!!