Odderino 0 Posted August 22, 2017 I currently have a script in a sqf file that allows me to whitelist certain weapons to certain classes. It looks like this: (Only the parts that matter) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #define AT_MSG "Only AT Soldiers may use this weapon system. Launcher removed." _missileSoldiers = ["B_soldier_LAT_F","B_soldier_AA_F","B_soldier_AT_F","B_officer_F","B_recon_LAT_F"]; _missileSpecialised = ["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"]; if (({player hasWeapon _x} count _missileSpecialised) > 0) then { if (({player isKindOf _x} count _missileSoldiers) < 1) then { player removeWeapon (secondaryWeapon player); titleText [AT_MSG,"PLAIN",3]; }; }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (this is not my code, but I do understand everything except why the >0 and <1 is there.) _missileSpecialised would be the rocket launcher itself _missileSoldiers would be the class I would want to have it (and it would be restricted to only that class) I am trying to make it so no matter what I put in _missileSpecialised (mainly weapon, uniform, vest, backpack and helmet) it will take it away from the player if they are not in the _missileSoldiers parameter. The script currently only takes away weapons, and how seeing how there is no counterpart to the hasWeapon command (ex. there is no hasUniform or hasVest) I would be very grateful for some extra help. AT_MSG is just the message displayed when the weapon is taken away from you I tried to fiddle with the code myself, but I have just started learning and this is way outside my skillset, seeing how it probably needs an entire rewrite, as it is only taking away the secondary weapon as of now, and only detecting if you have a WEAPON in the _missileSpecialised section, and not any other items. Also, I am trying to run this on a dedicated server, which to my understanding may require slightly altering parts of code (something with underscores I believe). Thank you to any kind soul in advance. Share this post Link to post Share on other sites
das attorney 858 Posted August 22, 2017 Anyway, 1 hour ago, Odderino said: I currently have a script in a sqf file that allows me to whitelist certain weapons to certain classes. It looks like this: (Only the parts that matter) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #define AT_MSG "Only AT Soldiers may use this weapon system. Launcher removed." _missileSoldiers = ["B_soldier_LAT_F","B_soldier_AA_F","B_soldier_AT_F","B_officer_F","B_recon_LAT_F"]; _missileSpecialised = ["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"]; if (({player hasWeapon _x} count _missileSpecialised) > 0) then { if (({player isKindOf _x} count _missileSoldiers) < 1) then { player removeWeapon (secondaryWeapon player); titleText [AT_MSG,"PLAIN",3]; }; }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (this is not my code, but I do understand everything except why the >0 and <1 is there.) _missileSpecialised would be the rocket launcher itself _missileSoldiers would be the class I would want to have it (and it would be restricted to only that class) I am trying to make it so no matter what I put in _missileSpecialised (mainly weapon, uniform, vest, backpack and helmet) it will take it away from the player if they are not in the _missileSoldiers parameter. The script currently only takes away weapons, and how seeing how there is no counterpart to the hasWeapon command (ex. there is no hasUniform or hasVest) I would be very grateful for some extra help. AT_MSG is just the message displayed when the weapon is taken away from you I tried to fiddle with the code myself, but I have just started learning and this is way outside my skillset, seeing how it probably needs an entire rewrite, as it is only taking away the secondary weapon as of now, and only detecting if you have a WEAPON in the _missileSpecialised section, and not any other items. Also, I am trying to run this on a dedicated server, which to my understanding may require slightly altering parts of code (something with underscores I believe). Thank you to any kind soul in advance. Why not just post the entire script? https://github.com/steve00010/AltisLife/blob/master/scripts/restrictions.sqf I presume that's where you got it from. I didn't know @fn_Quiksilver was coding from Altis Life.. Anyway, there are commands to check for uniform and vest. They are: uniform and vest So you'll have to write something like: { if (uniform player == uniform _x) exitWith { // your stuff here } } forEach _missileSoldiers; Check this page for the commands. All the ones you need (like removeUniform) are on there: https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3 Share this post Link to post Share on other sites
Odderino 0 Posted August 22, 2017 13 hours ago, das attorney said: { if (uniform player == uniform _x) exitWith { // your stuff here } } forEach _missileSoldiers; Check this page for the commands. All the ones you need (like removeUniform) are on there: https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3 This doesn't really help, as I said I'm new to coding, so I have no idea how to string anything together. I have already been on the Arma 3 scripting sight, and I did try to do something similar to what you did above to no success. Share this post Link to post Share on other sites
das attorney 858 Posted August 22, 2017 8 minutes ago, Odderino said: This doesn't really help, as I said I'm new to coding, so I have no idea how to string anything together. I have already been on the Arma 3 scripting sight, and I did try to do something similar to what you did above to no success. But earlier you said "I do understand everything except why the >0 and <1 is there." so I thought you would be able to join the dots. Short of writing it for you then, there's not much more I can do here. This should probably be better off in the find or offer editing forum Share this post Link to post Share on other sites