RizlaUK 4 Posted October 5, 2016 Hi, I was hoping for a little help with a weapons restriction script we have running on our server at the moment. As it stands, when the script kicks in, it deletes the restricted weapon. What we are trying to achieve is for it to drop it on the floor and keep doing that if they try and pick it up again. Is this possible please? /*Author: QuiksilverLast modified: 23/10/2014 ArmA 1.32 by QuiksilverDescription: Restricts certain weapon systems to different roles_________________________________________________*/private ["_opticsAllowed","_specialisedOptics","_optics","_sniperOpt"];#define AT_MSG "Only AT Soldiers may use this weapon system. Launcher removed."#define SNIPER_MSG "Only Snipers may use this weapon system. Sniper rifle removed."#define AUTOTUR_MSG "You are not allowed to use this weapon system, Backpack removed."#define MG_MSG "Only Autoriflemen may use this weapon system. LMG removed."#define SOPT_MSG "SOS and LRPS are designated for Snipers and Spotters only. Optic removed."#define MRK_MSG "Only Marksman and Spotters may use this weapon system. Rifle removed."//===== UAV TERMINAL_uavOperator = ["B_T_officer_F","B_T_soldier_UAV_F","B_soldier_UAV_F","B_officer_F","B_T_soldier_SL_F"];_uavRestricted = ["B_UavTerminal","O_UavTerminal","I_UavTerminal"];//===== AT / MISSILE LAUNCHERS (excl RPG)_missileSoldiers = ["B_T_soldier_AT_F","B_T_soldier_LAT_F","B_T_soldier_LAT_F","B_soldier_AA_F","B_soldier_AT_F","B_officer_F","B_recon_LAT_F","B_T_soldier_SL_F"];_missileSpecialised = ["launch_O_Titan_short_ghex_F","launch_O_Titan_ghex_F","launch_B_Titan_short_tna_F","launch_B_Titan_tna_F","launch_NLAW_F","launch_B_Titan_F","launch_O_Titan_F","launch_I_Titan_F","launch_B_Titan_short_F","launch_O_Titan_short_F","launch_I_Titan_short_F"];//===== SNIPER RIFLES_snipers = ["B_T_sniper_F","B_T_officer_F","B_sniper_F","B_officer_F"];_sniperSpecialised = ["srifle_GM6_ghex_F","srifle_LRR_tna_F","srifle_DMR_07_hex_F","srifle_DMR_07_ghex_F","srifle_DMR_07_blk_F","srifle_GM6_F","srifle_GM6_LRPS_F","srifle_GM6_SOS_F","srifle_LRR_F","srifle_LRR_LRPS_F","srifle_LRR_SOS_F","srifle_GM6_camo_F","srifle_GM6_camo_LRPS_F","srifle_GM6_camo_SOS_F","srifle_LRR_camo_F","srifle_LRR_camo_LRPS_F","srifle_LRR_camo_SOS_F"];/*===== BACKPACKS_backpackRestricted = ["O_Mortar_01_support_F","I_Mortar_01_support_F","O_Mortar_01_weapon_F","I_Mortar_01_weapon_F","O_UAV_01_backpack_F","I_UAV_01_backpack_F","O_HMG_01_support_F","I_HMG_01_support_F","O_HMG_01_support_high_F","I_HMG_01_support_high_F","O_HMG_01_weapon_F","I_HMG_01_weapon_F","O_HMG_01_A_weapon_F","I_HMG_01_A_weapon_F","O_GMG_01_weapon_F","I_GMG_01_weapon_F","O_GMG_01_A_weapon_F","I_GMG_01_A_weapon_F","O_HMG_01_high_weapon_F","I_HMG_01_high_weapon_F","O_HMG_01_A_high_weapon_F","I_HMG_01_A_high_weapon_F","O_GMG_01_high_weapon_F","I_GMG_01_high_weapon_F","O_GMG_01_A_high_weapon_F","I_GMG_01_A_high_weapon_F","I_AT_01_weapon_F","O_AT_01_weapon_F","I_AA_01_weapon_F","O_AA_01_weapon_F"];*///===== LMG_autoRiflemen = ["B_T_soldier_AR_F","B_T_officer_F","B_soldier_AR_F","B_officer_F","B_T_soldier_SL_F"];_autoSpecialised = ["LMG_03_F","MMG_02_black_F","MMG_02_camo_F","MMG_02_sand_F","MMG_02_black_RCO_BI_F","MMG_02_sand_RCO_LP_F","MMG_01_base_F","MMG_01_hex_F","MMG_01_hex_ARCO_LP_F","MMG_01_tan_F","LMG_Mk200_F","LMG_Mk200_MRCO_F","LMG_Mk200_pointer_F"];//===== SNIPER OPTICS_sniperTeam = ["B_T_sniper_F","B_sniper_F","B_spotter_F","B_T_soldier_SL_F"];_sniperOpt = ["optic_SOS","optic_LRPS"];//===== MARKSMAN_marksman = ["B_T_soldier_M_F","B_soldier_M_F","B_spotter_F","B_recon_M_F","B_T_soldier_SL_F"];_marksmanGun = ["srifle_DMR_02_ACO_F","srifle_DMR_02_ARCO_F","srifle_DMR_02_camo_AMS_LP_F","srifle_DMR_02_DMS_F","srifle_DMR_02_MRCO_F","srifle_DMR_02_sniper_AMS_LP_S_F","srifle_DMR_02_F","srifle_DMR_02_camo_F","srifle_DMR_02_sniper_F","srifle_DMR_02_SOS_F","srifle_DMR_03_ACO_F","srifle_DMR_03_AMS_F","srifle_DMR_03_ARCO_F","srifle_DMR_03_DMS_F","srifle_DMR_03_DMS_snds_F","srifle_DMR_03_MRCO_F","srifle_DMR_03_SOS_F","srifle_DMR_03_tan_AMS_LP_F","srifle_DMR_03_F","srifle_DMR_03_khaki_F","srifle_DMR_03_multicam_F","srifle_DMR_03_tan_F","srifle_DMR_03_woodland_F","srifle_DMR_04_ACO_F","srifle_DMR_04_ARCO_F","srifle_DMR_04_DMS_F","srifle_DMR_05_ACO_F","srifle_DMR_05_ARCO_F","srifle_DMR_05_DMS_F","srifle_DMR_05_DMS_snds_F","srifle_DMR_05_KHS_LP_F","srifle_DMR_05_MRCO_F","srifle_DMR_05_SOS_F","srifle_DMR_05_blk_F","srifle_DMR_05_hex_F","srifle_DMR_05_tan_f","srifle_DMR_06_camo_F","srifle_DMR_06_camo_khs_F","srifle_DMR_06_olive_F"];restrict_LMG = true;restrict_sOptics = true;restrict_Marksman = true;while {true} do { //------------------------------------- Launchers if (({player hasWeapon _x} count _missileSpecialised) > 0) then { if (({player isKindOf _x} count _missileSoldiers) < 1) then { player removeWeapon (secondaryWeapon player); systemChat "Only AT Soldiers may use this weapon system. Launcher removed."; }; }; sleep 1; //------------------------------------- Sniper Rifles if (({player hasWeapon _x} count _sniperSpecialised) > 0) then { if (({player isKindOf _x} count _snipers) < 1) then { player removeWeapon (primaryWeapon player); systemChat "Only Snipers may use this weapon system. Sniper rifle removed."; }; }; sleep 1; //------------------------------------- UAV private["_assignedItems","_optics","_sniperOpt"]; _assignedItems = assignedItems player; if (({"B_UavTerminal" == _x} count _assignedItems) > 0) then { if (({player isKindOf _x} count _uavOperator) < 1) then { player unassignItem "B_UavTerminal"; player removeItem "B_UavTerminal"; systemChat "Only UAV operator may use this Item, UAV terminal removed."; }; }; sleep 1; //------------------------------------- sniper optics if (restrict_sOptics) then { _sniperOpt = ["optic_SOS","optic_LRPS"]; _optics = primaryWeaponItems player; if (({_x in _optics} count _sniperOpt) > 0) then { if (({player isKindOf _x} count _sniperTeam) < 1) then { {player removePrimaryWeaponItem _x;} count _sniperOpt; systemChat "SOS and LRPS are designated for Snipers and Spotters only. Optic removed."; }; }; sleep 1; }; //------------------------------------- LMG if (restrict_LMG) then { if (({player hasWeapon _x} count _autoSpecialised) > 0) then { if (({player isKindOf _x} count _autoRiflemen) < 1) then { player removeWeapon (primaryWeapon player); systemChat "Only Autoriflemen may use this weapon system. LMG removed."; }; }; sleep 1; }; //------------------------------------- Marksman if (restrict_Marksman) then { if (({player hasWeapon _x} count _marksmanGun) > 0) then { if (({player isKindOf _x} count _marksman) < 1) then { player removeWeapon (primaryWeapon player); systemChat "Only Marksman and Spotters may use this weapon system. Rifle removed."; }; }; sleep 1; }; //------------------------------------- Opfor turret backpacks/* if ((backpack player) in _backpackRestricted) then { removeBackpack player; titleText [AUTOTUR_MSG, "PLAIN", 3]; };*/ }; Thanks for reading. Rizla Share this post Link to post Share on other sites
Bnae 1431 Posted October 5, 2016 Instead of removing the weapon use DropWeapon action > https://community.bistudio.com/wiki/ArmA:_Actions#DropWeapon 1 Share this post Link to post Share on other sites
RizlaUK 4 Posted October 5, 2016 So i just replace removeWeapon with dropWeapon in the script and that is it? On a side note, would the dropped weapons be picked up by clean up scripts after so long of being on the floor? Thanks Share this post Link to post Share on other sites
Bnae 1431 Posted October 5, 2016 _ground = "GroundWeaponHolder" createVehicle (getPos player); sleep 1; player action ["dropWeapon", _ground, primaryWeapon player]; Corret me if i'm wrong but it didn't create a WeaponHolder as it should, but this should work for. Use handgunWeapon for pistols, secondaryWeapon for launcher and so on. I'd recommend to remove the weapons after awhile. 1 Share this post Link to post Share on other sites
RizlaUK 4 Posted October 6, 2016 Hi, Sorry to be a pain in the arse, but can i ask for the exact code i should put into the script example above please? I'm not the best at scripting and don't want to do it incorrectly! I'd recommend to remove the weapons after awhile. Will these dropped weapons automatically be picked up by our clean up scripts or do they need to be defined somewhere? Thanks a lot for your help. Regards Rizla Share this post Link to post Share on other sites
RizlaUK 4 Posted October 8, 2016 OK then, Same old story, get a flat tire, a nice person on the forum hands you a tire iron, but you don't know how to use it!? This is what i've tried, obviously wrong, and certain some coder is looking at my effort with sheer contempt, yes i suck at coding, so please tell me the answer so i can leave your world! /* Author: Quiksilver Last modified: 23/10/2014 ArmA 1.32 by Quiksilver Description: Restricts certain weapon systems to different roles _________________________________________________*/ private ["_opticsAllowed","_specialisedOptics","_optics","_sniperOpt"]; #define AT_MSG "Only AT Soldiers may use this weapon system. Launcher removed." #define SNIPER_MSG "Only Snipers may use this weapon system. Sniper rifle removed." #define AUTOTUR_MSG "You are not allowed to use this weapon system, Backpack removed." #define MG_MSG "Only Autoriflemen may use this weapon system. LMG removed." #define SOPT_MSG "SOS and LRPS are designated for Snipers and Spotters only. Optic removed." #define MRK_MSG "Only Marksman and Spotters may use this weapon system. Rifle removed." //===== UAV TERMINAL _uavOperator = ["B_T_officer_F","B_T_soldier_UAV_F","B_soldier_UAV_F","B_officer_F","B_T_soldier_SL_F"]; _uavRestricted = ["B_UavTerminal","O_UavTerminal","I_UavTerminal"]; //===== AT / MISSILE LAUNCHERS (excl RPG) _missileSoldiers = ["B_T_soldier_AT_F","B_T_soldier_LAT_F","B_T_soldier_LAT_F","B_soldier_AA_F","B_soldier_AT_F","B_officer_F","B_recon_LAT_F","B_T_soldier_SL_F"]; _missileSpecialised = ["launch_O_Titan_short_ghex_F","launch_O_Titan_ghex_F","launch_B_Titan_short_tna_F","launch_B_Titan_tna_F","launch_NLAW_F","launch_B_Titan_F","launch_O_Titan_F","launch_I_Titan_F","launch_B_Titan_short_F","launch_O_Titan_short_F","launch_I_Titan_short_F"]; //===== SNIPER RIFLES _snipers = ["B_T_sniper_F","B_T_officer_F","B_sniper_F","B_officer_F"]; _sniperSpecialised = ["srifle_GM6_ghex_F","srifle_LRR_tna_F","srifle_DMR_07_hex_F","srifle_DMR_07_ghex_F","srifle_DMR_07_blk_F","srifle_GM6_F","srifle_GM6_LRPS_F","srifle_GM6_SOS_F","srifle_LRR_F","srifle_LRR_LRPS_F","srifle_LRR_SOS_F","srifle_GM6_camo_F","srifle_GM6_camo_LRPS_F","srifle_GM6_camo_SOS_F","srifle_LRR_camo_F","srifle_LRR_camo_LRPS_F","srifle_LRR_camo_SOS_F"]; /*===== BACKPACKS _backpackRestricted = ["O_Mortar_01_support_F","I_Mortar_01_support_F","O_Mortar_01_weapon_F","I_Mortar_01_weapon_F","O_UAV_01_backpack_F","I_UAV_01_backpack_F","O_HMG_01_support_F","I_HMG_01_support_F","O_HMG_01_support_high_F","I_HMG_01_support_high_F","O_HMG_01_weapon_F","I_HMG_01_weapon_F","O_HMG_01_A_weapon_F","I_HMG_01_A_weapon_F","O_GMG_01_weapon_F","I_GMG_01_weapon_F","O_GMG_01_A_weapon_F","I_GMG_01_A_weapon_F","O_HMG_01_high_weapon_F","I_HMG_01_high_weapon_F","O_HMG_01_A_high_weapon_F","I_HMG_01_A_high_weapon_F","O_GMG_01_high_weapon_F","I_GMG_01_high_weapon_F","O_GMG_01_A_high_weapon_F","I_GMG_01_A_high_weapon_F","I_AT_01_weapon_F","O_AT_01_weapon_F","I_AA_01_weapon_F","O_AA_01_weapon_F"]; */ //===== LMG _autoRiflemen = ["B_T_soldier_AR_F","B_T_officer_F","B_soldier_AR_F","B_officer_F","B_T_soldier_SL_F"]; _autoSpecialised = ["LMG_03_F","MMG_02_black_F","MMG_02_camo_F","MMG_02_sand_F","MMG_02_black_RCO_BI_F","MMG_02_sand_RCO_LP_F","MMG_01_base_F","MMG_01_hex_F","MMG_01_hex_ARCO_LP_F","MMG_01_tan_F","LMG_Mk200_F","LMG_Mk200_MRCO_F","LMG_Mk200_pointer_F"]; //===== SNIPER OPTICS _sniperTeam = ["B_T_sniper_F","B_sniper_F","B_spotter_F","B_T_soldier_SL_F"]; _sniperOpt = ["optic_SOS","optic_LRPS"]; //===== MARKSMAN _marksman = ["B_T_soldier_M_F","B_soldier_M_F","B_spotter_F","B_recon_M_F","B_T_soldier_SL_F"]; _marksmanGun = ["srifle_DMR_02_ACO_F","srifle_DMR_02_ARCO_F","srifle_DMR_02_camo_AMS_LP_F","srifle_DMR_02_DMS_F","srifle_DMR_02_MRCO_F","srifle_DMR_02_sniper_AMS_LP_S_F","srifle_DMR_02_F","srifle_DMR_02_camo_F","srifle_DMR_02_sniper_F","srifle_DMR_02_SOS_F","srifle_DMR_03_ACO_F","srifle_DMR_03_AMS_F","srifle_DMR_03_ARCO_F","srifle_DMR_03_DMS_F","srifle_DMR_03_DMS_snds_F","srifle_DMR_03_MRCO_F","srifle_DMR_03_SOS_F","srifle_DMR_03_tan_AMS_LP_F","srifle_DMR_03_F","srifle_DMR_03_khaki_F","srifle_DMR_03_multicam_F","srifle_DMR_03_tan_F","srifle_DMR_03_woodland_F","srifle_DMR_04_ACO_F","srifle_DMR_04_ARCO_F","srifle_DMR_04_DMS_F","srifle_DMR_05_ACO_F","srifle_DMR_05_ARCO_F","srifle_DMR_05_DMS_F","srifle_DMR_05_DMS_snds_F","srifle_DMR_05_KHS_LP_F","srifle_DMR_05_MRCO_F","srifle_DMR_05_SOS_F","srifle_DMR_05_blk_F","srifle_DMR_05_hex_F","srifle_DMR_05_tan_f", "srifle_DMR_06_olive_F"]; restrict_LMG = true; restrict_sOptics = true; restrict_Marksman = true; _ground = "GroundWeaponHolder" createVehicle (getPos player); sleep 1; player action ["dropWeapon", _ground, primaryWeapon player]; _ground = "GroundWeaponHolder" createVehicle (getPos player); sleep 1; player action ["dropWeapon", _ground, secondaryWeapon player]; while {true} do { //------------------------------------- Launchers if (({player hasWeapon _x} count _missileSpecialised) > 0) then { if (({player isKindOf _x} count _missileSoldiers) < 1) then { player dropWeapon (secondaryWeapon player); systemChat "You look down at all the blinking lights and twisty knobs and feel a migraine coming on. You decide to drop the weapon system for a specialist to use."; }; }; sleep 1; //------------------------------------- Sniper Rifles if (({player hasWeapon _x} count _sniperSpecialised) > 0) then { if (({player isKindOf _x} count _snipers) < 1) then { player dropWeapon (primaryWeapon player); systemChat "The weight and feel of this gun seem wrong to you. You decide that you couldn't shoot straight with it. You drop the weapon for a specialist Sniper to use. You also remember that the teams Sniper would not take kindly to being left with a pistol."; }; }; sleep 1; //------------------------------------- UAV private["_assignedItems","_optics","_sniperOpt"]; _assignedItems = assignedItems player; if (({"B_UavTerminal" == _x} count _assignedItems) > 0) then { if (({player isKindOf _x} count _uavOperator) < 1) then { player unassignItem "B_UavTerminal"; player removeItem "B_UavTerminal"; systemChat "You drop the UAV terminal after taking one look at buttons and flashing lights that could mean anything. One slip and the sky could fall! You decide that this equipment is best left to UAV Operators."; }; }; sleep 1; //------------------------------------- sniper optics if (restrict_sOptics) then { _sniperOpt = ["optic_SOS","optic_LRPS"]; _optics = primaryWeaponItems player; if (({_x in _optics} count _sniperOpt) > 0) then { if (({player isKindOf _x} count _sniperTeam) < 1) then { {player removePrimaryWeaponItem _x;} count _sniperOpt; systemChat "You decide that a Court Martial is not worth stealing from the Snipers' lockeroom again and decide to drop the Sniper and Spotters equipment for them to use."; }; }; sleep 1; }; //------------------------------------- LMG if (restrict_LMG) then { if (({player hasWeapon _x} count _autoSpecialised) > 0) then { if (({player isKindOf _x} count _autoRiflemen) < 1) then { player dropWeapon (primaryWeapon player); systemChat "Good Grief! This is heavy! You decide to drop the weapon for a specialist Autorifleman to carry. Phew!"; }; }; sleep 1; }; //------------------------------------- Marksman if (restrict_Marksman) then { if (({player hasWeapon _x} count _marksmanGun) > 0) then { if (({player isKindOf _x} count _marksman) < 1) then { player dropWeapon (primaryWeapon player); systemChat "The weight and feel of this gun seem wrong to you. You struggle to imagine trying to shoot it straight. Instead you decide to drop the weapon for a Designated Marksman to use. You also remember that the teams Marksman would not take kindly to being left with a pistol."; }; }; sleep 1; }; //------------------------------------- Opfor turret backpacks /* if ((backpack player) in _backpackRestricted) then { removeBackpack player; titleText [AUTOTUR_MSG, "PLAIN", 3]; }; */ }; Share this post Link to post Share on other sites