MC.Quit 1 Posted April 3, 2018 Hi i need someone that can make a simple holster script for me that allows the player to holster his weapon after pressing SHIFT+H for now i use this player addAction ["Holster weapon","holsterpistol.sqf"] at the holsterpistol.sqf there is this code player action ["SwitchWeapon", player, player, -1]; pretty simple but im tryna keep the actionbar empty Share this post Link to post Share on other sites
HazJ 1289 Posted April 3, 2018 Don't expect it done for you. Learn and try yourself. Check this out: https://community.bistudio.com/wiki/displayAddEventHandler https://community.bistudio.com/wiki/DIK_KeyCodes Here is a snippet from mine to give you an idea. #define DIK_H 0x23 case DIK_H : { player action ["SwitchWeapon", player, player, -1]; }; I have a keyDownHandler function with switch block. Params: params ["_display", "_key", "_shift", "_ctrl", "_alt"]; I use _key for the switch condition. EDIT: It may be better to set true for the switch condition and then for the case do something like: case (_key isEqualTo DIK_H && _shift) : { player action ["SwitchWeapon", player, player, -1]; }; _shift returns BOOL. Share this post Link to post Share on other sites
MC.Quit 1 Posted April 3, 2018 3 minutes ago, HazJ said: Don't expect it done for you. Learn and try yourself. Check this out: https://community.bistudio.com/wiki/displayAddEventHandler https://community.bistudio.com/wiki/DIK_KeyCodes Here is a snippet from mine to give you an idea. #define DIK_H 0x23 case DIK_H : { player action ["SwitchWeapon", player, player, -1]; }; I have a keyDownHandler function with switch block. Params: params ["_display", "_key", "_shift", "_ctrl", "_alt"]; I use _key for the switch condition. Thank you for the basic! i'll see if i could make it work thanks. i might have some questions in the future tho :P the first question is whats the DIK_H 0x23 means Share this post Link to post Share on other sites
HazJ 1289 Posted April 3, 2018 Sure, that is fine. If you get stuck, I and others would be happy to help. I personally don't like it when people expect it all done and aren't willing to learn/try. That's all. I edited my post above by the way. Share this post Link to post Share on other sites
GEORGE FLOROS GR 4207 Posted April 3, 2018 Hello there MC.Quit ! Well , what HazJ told you is right. 16 hours ago, MC.Quit said: pretty simple but im tryna keep the actionbar empty 15 hours ago, HazJ said: https://community.bistudio.com/wiki/DIK_KeyCodes But since there might be a lot of people , who are trying to find this , write this in your init.sqf : //________________ Author : [GR]GEORGE F ___________ 04.04.18 _____________ //https://community.bistudio.com/wiki/DIK_KeyCodes hint"Holster Weapon with key 5"; [] spawn { waitUntil {!isNull(findDisplay 46)}; (findDisplay 46) displayAddEventHandler ["KeyDown", { if(_this select 1 == 0x06) //number 5 then { _Holster_Weapon_ctrl = (_this select 0) displayCtrl 9001; if(isNull(_Holster_Weapon_ctrl)) then { _Holster_Weapon_ctrl = (_this select 0) ctrlCreate ["RscText", 9001]; _Holster_Weapon_ctrl ctrlSetPosition [SafeZoneXAbs, SafeZoneY + (SafeZoneH - 0.05) / 2, 0.2, 0.03]; _Holster_Weapon_ctrl ctrlSetFontHeight 0.03; _Holster_Weapon_ctrl ctrlSetText "Weapon Holstered"; _Holster_Weapon_ctrl ctrlShow false; _Holster_Weapon_ctrl ctrlCommit 0; }; _shown = ctrlShown _Holster_Weapon_ctrl; //this is for earplugs - mute sound //0.1 fadeSound (if(_shown)then{1}else{0.1}); //Weapon on the back player action ["SWITCHWEAPON",player,player,-1]; waitUntil {currentWeapon player == "" or {primaryWeapon player == "" && handgunWeapon player == ""}}; _Holster_Weapon_ctrl ctrlShow !_shown; }; }]; }; Once is holstered , press the number for the weapon that you want to draw Share this post Link to post Share on other sites
HazJ 1289 Posted April 3, 2018 No need for call + spawn together. I don't know what it is but I'm seeing this a lot on these forums very recently + new threads. 1 Share this post Link to post Share on other sites
GEORGE FLOROS GR 4207 Posted April 4, 2018 14 minutes ago, HazJ said: No need for call + spawn together. I fix it above and added also an option for lowering volume. //this is for earplugs - mute sound //0.1 fadeSound (if(_shown)then{1}else{0.1}); Thanks HazJ! Share this post Link to post Share on other sites
GEORGE FLOROS GR 4207 Posted April 14, 2018 There is available the GF Holster script. for more stuff: Share this post Link to post Share on other sites