Tisor 17 Posted October 29, 2013 Is it posible to have the displaySetEventHandler thing working when you get inside your addon vehicle? What we want is to have custom controls in our mod cars for controlling the lightbar, blinkers and so on. I know the scripts are like the example here: http://community.bistudio.com/wiki/displaySetEventHandler I just need some help to figure out how can I make that this keymaps only works for the driver of my car, when he gets on a car with enabled key panel (With lightbar, siren, blinkers...) I have trying adding on the init, changing some parameters but does not work. Have anyone tried this? Can any one give any tip please? Share this post Link to post Share on other sites
Kunsa 10 Posted October 29, 2013 http://dev-heaven.net/docs/cba/index/General.html look at the stuff on extended event handlers. with cba you can set an event handler for your specific class only. btw using SetEventHandler is not a good idea.. AddEventHandler is friendlier .. i.e. Set will overwrite anyone elses handlers Share this post Link to post Share on other sites
Tisor 17 Posted October 29, 2013 (edited) So, will I need CBA for doing that? I don't like the idea of that, because we want our mod to be stand alone. At the moment, we are running the init.sqf from the config.cpp like this: class eventhandlers { init = "_this execVM '\My_Vehicle\scripts\init.sqf';"; }; And init.sqf is just running the scripts for the Lightbar, blinkers and so on: if (isServer) then {exit}; private["_car"]; _car = _this select 0; _car execVM "\My_Vehicle\scripts\lightbar.sqf"; _car execVM "\My_Vehicle\scripts\sirens.sqf"; _car execVM "\My_Vehicle\scripts\alley.sqf"; _car execVM "\My_Vehicle\scripts\takedown.sqf"; _car execVM "\My_Vehicle\scripts\directional.sqf"; _car execVM "\My_Vehicle\scripts\blinkers.sqf"; exit; So, isn't it posible without using more addons like CBA? Edit: I was thinking on add to the config.cpp eventhandlers a "getin" handler that execute the script of custom keys for the driver of the vehicle. Then a get out one to remove the keys. Would this work? Edited October 29, 2013 by Tisor Share this post Link to post Share on other sites
Tisor 17 Posted November 1, 2013 Can anyone give more light on this? Share this post Link to post Share on other sites
sakura_chan 9 Posted November 2, 2013 Its possible to do this without cba or eventhandlers. All you have to do is add the keyboard script to the vehicle's UI. This way it gets loaded automatically whenever you get in the car. Share this post Link to post Share on other sites
Tisor 17 Posted November 5, 2013 Its possible to do this without cba or eventhandlers. All you have to do is add the keyboard script to the vehicle's UI. This way it gets loaded automatically whenever you get in the car. I don't get you. I need the displayAddEventHandler so I know when a key is pressed, right? The closest I have been able to get is running this on the vehicle init: private["_vcl", "_phase"]; _vcl = _this; while {alive _vcl} do { waitUntil {!IsNull driver _vcl}; if (driver _vcl == player) then { waitUntil {!(IsNull (findDisplay 46))}; _keyDown = (findDisplay 46) displayAddEventHandler ["KeyDown", "hint str _this"];}; waitUntil {IsNull driver _vcl}; _remove = (findDisplay 46) displayRemoveEventHandler ["KeyDown", "hint str _this"]; sleep 0.5; }; exit; The hint appears and recognized the keys, only when I get in the vehicle. But then, I want the keys to be removed when I get out, and it's not happening. Also, need to figure out if this is gonna work only for the player or to all players in the MP Server... is getting a headache to me :( :cry2: I'm sure someone here can give me the answer... will be very appreciated. Share this post Link to post Share on other sites