BEAKSBY 11 Posted October 5, 2014 HI All, I can't remember the command for showing your units on the map? ...it was something like showenable? Also, is there a command that prevents player from dropping weapons / inventory? Share this post Link to post Share on other sites
iceman77 18 Posted October 5, 2014 (edited) Do you mean setGroupIconsVisible? If you're on dev branch you could probably use an EH for inventory restriction. player addEventHandler ["inventoryOpened", {closeDialog 602;}]; Or while {true} do { sleep 0.1; if (!(isNull (findDisplay 602))) then { closeDialog 602; }; }; Also maybe something like deleting weapon holders could work. while {true} do { sleep 1; { deleteVehicle _x } forEach nearestObjects [player, ["GroundWeaponHolder"], 5]; }; You could also use a put EH, check the item type, delete the placed item if needed, and give it back to the player. ie; When a player goes to place his weapons in a crate or on the ground. player addEventHandler ["put", { _unit = _this select 0; _container = _this select 1; _item = _this select 2; _typeArray = [_item] call BIS_fnc_itemType; if ((_typeArray select 0) == "Weapon") then { if (_container isKindOf "GroundWeaponHolder") then { { deleteVehicle _x } forEach nearestObjects [player, ["GroundWeaponHolder"], 5]; } else { _container removeWeapon _item; }; player addWeaponGlobal _item; player selectWeapon _item; }; }]; Or something like this player addEventHandler ["put", { _unit = _this select 0; _container = _this select 1; _item = _this select 2; _typeArray = [_item] call BIS_fnc_itemType; if (_container isKindOf "GroundWeaponHolder") then { { deleteVehicle _x } forEach nearestObjects [player, ["GroundWeaponHolder"], 5]; switch (_typeArray select 0) do { case "Weapon":{ player addWeaponGlobal _item; player selectWeapon _item; }; case "Item":{player addItem _item;}; case "Magazine":{player addMagazineGlobal _item;}; }; } else { switch (_typeArray select 0) do { case "Weapon":{ _container removeWeapon _item; player addWeaponGlobal _item; player selectWeapon _item; }; case "Item":{ _container removeItem _item; player addItem _item; }; case "Magazine":{ _container removeMagazine _item; player addMagazineGlobal _item; }; }; }; }]; Edited October 5, 2014 by Iceman77 Share this post Link to post Share on other sites
dreadedentity 278 Posted October 5, 2014 Iceman always has to do things the complicated way :p player addEventHandler["Put", { clearItemCargo (_this select 1); if ((_this select 0) canAddItemToUniform (_this select 2)) then { ((_this select 0) addItemToUniform (_this select 2)); hintSilent "Please don't litter."; }else { if ((_this select 0) canAddItemToVest (_this select 2)) then { ((_this select 0) addItemToVest (_this select 2)); hintSilent "Please don't litter."; }else { if ((_this select 0) canAddItemToBackpack (_this select 2)) then { ((_this select 0) addItemToBackpack (_this select 2)); hintSilent "Please don't litter."; }else { hintSilent "How the hell did you get this in there?"; }; }; }; }]; The only problem with this is that I was unable to get removeItem to work properly so it deletes everything in the container. Be careful you don't try to drop items in to a filled container. Share this post Link to post Share on other sites
iceman77 18 Posted October 5, 2014 (edited) Iceman always has to do things the complicated way :p Silly goose? LOL. In any case, he was wanting to prevent weapons from being placed so... Put EH from the suggestion in my earlier post. player addEventHandler ["put", { _unit = _this select 0; _container = _this select 1; _item = _this select 2; _typeArray = [_item] call BIS_fnc_itemType; if ((_typeArray select 0) == "Weapon") then { if (_container isKindOf "GroundWeaponHolder") then { { deleteVehicle _x } forEach nearestObjects [player, ["GroundWeaponHolder"], 5]; } else { _container removeWeapon _item; }; player addWeaponGlobal _item; player selectWeapon _item; }; }]; Keep in mind I'm just fiddling here =). Edited October 5, 2014 by Iceman77 UPDATED CODE Share this post Link to post Share on other sites
BEAKSBY 11 Posted October 5, 2014 Ok thanks again guys, ...and yes setGroupIconsVisible is the one I was looking for. Share this post Link to post Share on other sites
iceman77 18 Posted October 5, 2014 Updated my first post with put EH :p. It's janky or w/e, but it essentially keeps players from placing weapons on the ground or in crates. Tweak it for your needs. Maybe combine a little of dread's code. ---------- Post added at 18:07 ---------- Previous post was at 18:04 ---------- The only problem with this is that I was unable to get removeItem to work properly so it deletes everything in the container. Be careful you don't try to drop items in to a filled container. Don't use clearItemCargo hehe. You only need to remove and replace the 1 item. Share this post Link to post Share on other sites