Jump to content

Remove Handgun Weapon (Epoch 1.0.6.1)


hellraver

Recommended Posts

Hi Guys,

because there is no command in Arma 2 which only removes the handgun weapon from the player's inventory, I wrote a command myself.

More specifically I wrote a script with a function which can be called with the "[] call" command. Perhaps someone can use this function. Have fun!

Create "player_removeHandgunWeapon.sqf" file and copy this code into this file.

This "player_removeHandgunWeapon.sqf" file must  of course  be initialized by each Client.

But the code does not have to be copied to a "player_removeHandgunWeapon.sqf". It can also be initialized in any other script.

// player_removeHandgunWeapon.sqf
// created by hellraver

removeHandgunWeapon = {
	_weaponClass = _this;

	{
		_nextClass = [];
		_handgunWeapon = _x;
		_result1 = (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)));
		_nextClass set [count _nextClass, _result1];

		{
			_result2 = (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)));

			if (_x == "Pistol") then {
				player removeWeapon _handgunWeapon;
				breakOut "exit";
			};

			if (_x != "Default") then {
				_nextClass set [count _nextClass, _result2];
			};

		} forEach _nextClass;

	} forEach _weaponClass;
};

To call the code just use:

weapons player call removeHandgunWeapon;

 

Best Regards hellraver

Sorry for my bad english. I speak german :-/

Link to comment
Share on other sites

@ebayShopper Thanks mate. That is very nice :-) But I have a question.

Only the type number -> 2 <- for the handgun weapon is defined in "basicsDefines.hpp" file.

Where is the text string ->type<-  defined for the query? ^^

Your code starts with a class name the query for >> "type".

And >> "type" must return the number -> 2 <- to compare it to a value.

 

@juandayz

Thank you for your feedback and motivation. I love scripting :D Scripting is more exciting than crossword puzzle :D I am working with Arma 2 Scripting since 2 years and have mastered it meanwhile to 90%. I can almost write almost every script or fix bugs in other scripts. Nevertheless, I am still learning and collecting new information. I'm fucking inquisitive xD I am writing since some time a special scriptpack for Epoch. The Name is "Hells Enpoch Pack". I integrate some scripts from other developers or rewrite the scripts completely. There are also scripts from me. Above all I integrate everything as if it were from the Epoch developers. I keep strictly to the style and the overview from the Epoch developers. Also the Epoch Admin tool I rewrite completely and integrate it cleanly and error-free into the Epoch mod. I would like to introduc a scriptpack par excellence and an Epoch version as I imagine it. For example, I wrote a change clothes script where the player can change his clothes directly to the body without having to add a item to his inventory. The corpse then has the clothes of the player after the change :D

 

Best Regard hellraver

Sorry for my bad english. I speak german :-)

Link to comment
Share on other sites

At the moment I adapt all scripts to Epoch 1.0.6.1. Vehicle Key Changer (i will write it completly new), Vehicle Sirens (Not local but public version), Vehicle Key Remote, DZAI, DZMS and more interesting Scripts :-) For all scripts I use the Epoch variables or functions if possible. I also build in the init.sqf file variables to enable or disable many custom scripts. I need a challenge :-)

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...