Jump to content
  • 0

Remove Wepons script Issue


LoadingSA

Question

I'm using this script here;

 

http://opendayz.net/threads/release-remove-weapons-ammunition-thermal-from-vehicle-epoch-version.18044/

 

I'm using is to remove the guns on the AH6J and adding guns to the AN2 but when using this it's adds the gun to the vechile and the ammo for it's giving both of them ~600 boxes of ammo;

 

fnc_remWepSG.sqf snippit

{
if (_object isKindOf "AN2_DZ") then {
_object addWeapon "TwinVickers";
_object addMagazine "500Rnd_TwinVickers";

};
if (_object isKindOf "AH6J_EP1") then {
                     _object removeWeapon "TwinM134";
                     _object removeWeapon "FFARLauncher_14";
                     _object removeWeapon "M134_2";
                     _object addWeapon "PKT_veh";
                     _object addMagazine "2000Rnd_762x54_PKT";
                     };

Not sure why it's doing this I can't see any reason for it to be giving so much ammo.

Link to comment
Share on other sites

11 answers to this question

Recommended Posts

  • 0

sure this;

 

fnc_remWepSG:

	//Remove Weapon SiothieGaming german Youtubechannel: http://www.youtube.com/user/SiothieGaming
	//Lines underneath are just a small tutorial
	// the Number in the Bracket is Important, -1  means Pilot seat
	//Try getting up with these numbers when you want to remove from another seat (e.g. gunner, front gunner, rear gunner etc. pp)
	// For every seat you have to do something like i did          
	//_object magazinesTurret [-1];
	//_object removeMagazinesTurret ["14Rnd_FFAR",[-1]]; If you want to remove something from another seat at the same time you need to do something like this:
	// _object magazinesTurret [1];
	//_object removeMagazinesTurret ["14Rnd_FFAR",[1]]; I'm not completly sure now which number is which seat. I only know that -1 is pilot seat.
{
{
if (_object isKindOf "AN2_DZ") then {
_object addWeapon "TwinVickers";
_object addMagazine "500Rnd_TwinVickers";

};
if (_object isKindOf "AH6J_EP1") then {
                     _object removeWeapon "TwinM134";
                     _object removeWeapon "FFARLauncher_14";
                     _object removeWeapon "M134_2";
                     _object addWeapon "PKT_veh";
                     _object addMagazine "2000Rnd_762x54_PKT";
                     };
                     
	//THIS IS STILL IN TESTING PHASE, IT COULD SCREW UP YOUR WHOLE SERVER
	//Just put the Classname of the Vehicle there and it should disable thear vision.
	// For example my server runs fine with it (Epoch Panthera) but a friend of mine screwed up his whole database
	if (_object isKindof "AH64D") then {
		 _object disableTIEquipment true;
	};
	//TESTING STUFF END
} forEach vehicles; //Not completly necessary, it just makes sure no vehicle is left out during the process (e.g. high server load)

Serverfunctions.SQF:

BIS_Effects_Burn =				{};
server_playerLogin =			compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_playerLogin.sqf";
server_playerSetup =			compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_playerSetup.sqf";
server_onPlayerDisconnect = 	compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_onPlayerDisconnect.sqf";
server_updateObject =			compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_updateObject.sqf";
server_playerDied =				compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_playerDied.sqf";
server_publishObj = 			compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_publishObject.sqf";
server_deleteObj =				compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_deleteObj.sqf";
server_swapObject =				compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_swapObject.sqf"; 
server_publishVeh = 			compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_publishVehicle.sqf";
server_publishVeh2 = 			compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_publishVehicle2.sqf";
server_publishVeh3 = 			compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_publishVehicle3.sqf";
server_tradeObj = 				compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_tradeObject.sqf";
server_traders = 				compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_traders.sqf";
server_playerSync =				compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_playerSync.sqf";
server_spawnCrashSite  =    	compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_spawnCrashSite.sqf";
server_spawnEvents =			compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_spawnEvent.sqf";
//server_weather =				compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_weather.sqf";
fnc_plyrHit   =					compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\fnc_plyrHit.sqf";
//Fnc for removing weapon by SiothieGaming
fnc_remWepSG =                compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\fnc_remWepSG.sqf";
server_deaths = 				compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_playerDeaths.sqf";
server_maintainArea = 			compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_maintainArea.sqf";

Server_monitor.sqf:

			_object setVariable ["CharacterID", _ownerID, true];
		    //Remove Weapon by SiothieGaming start
            call fnc_remWepSG;
            //Remove Weapon by SiothieGaming end
			clearWeaponCargoGlobal  _object;
			clearMagazineCargoGlobal  _object;

server_publishVehicles3.sqf

	// add items from previous vehicle here
	_weapons = 		getWeaponCargo _object;
	_magazines = 	getMagazineCargo _object;
	_backpacks = 	getBackpackCargo _object;
            //Remove Weapon by SiothieGaming start
            call fnc_remWepSG;
            //Remove Weapon by SiothieGaming end
	clearWeaponCargoGlobal  _object;
	clearMagazineCargoGlobal  _object;
	clearBackpackCargoGlobal _object;

server_publishVehicles2.sqf:

	if(_class in DZE_StripAmmo) then { _object setVehicleAmmo 0 };

	if(!_donotusekey) then {
		// Lock vehicle
		_object setvehiclelock "locked";
		_object setVariable ["BTC_Cannot_Lift",true,true];
	};
            //Remove Weapon by SiothieGaming start
            call fnc_remWepSG;
            //Remove Weapon by SiothieGaming end
	clearWeaponCargoGlobal  _object;
	clearMagazineCargoGlobal  _object;
Link to comment
Share on other sites

  • 0

I am also using this script here:

 

 

It makes it easy to make my custom vehicles spawn without ammo. The above script is used only for removing and replacing of vehicles weapons.

 

thanks for your help I thought it was looping as well somewhere but I just can't see it in the scripting.

Link to comment
Share on other sites

  • 0

It couldn't be this right?

// Adding a set of Twin Vickers to the AN2 and a 500Rnd mag

{

if (_object isKindOf "AN2_DZ") then {
                      _object addWeapon "TwinVickers";
                      _object addMagazine "500Rnd_TwinVickers";

};

//AH6J Removing Defult weapons and adding a PKT with 1 2000Rnd mag

{

if (_object isKindOf "AH6J_EP1") then {
                     _object removeWeapon "TwinM134";
                     _object removeWeapon "FFARLauncher_14";
                     _object removeWeapon "M134_2";
                     _object addWeapon "PKT_veh";
                     _object addMagazine "2000Rnd_762x54_PKT";

};
                     
} forEach vehicles;
Link to comment
Share on other sites

  • 0

This is why structured formatting is important.

/*
	Remove Weapon SiothieGaming german Youtubechannel: http://www.youtube.com/user/SiothieGaming
	Lines underneath are just a small tutorial
	the Number in the Bracket is Important, -1  means Pilot seat
	Try getting up with these numbers when you want to remove from another seat (e.g. gunner, front gunner, rear gunner etc. pp)
	For every seat you have to do something like i did          
	_object magazinesTurret [-1];
	_object removeMagazinesTurret ["14Rnd_FFAR",[-1]]; If you want to remove something from another seat at the same time you need to do something like this:
	_object magazinesTurret [1];
	_object removeMagazinesTurret ["14Rnd_FFAR",[1]]; I'm not completly sure now which number is which seat. I only know that -1 is pilot seat.
*/

{
	if (_object isKindOf "AN2_DZ") then {
		_object addWeapon "TwinVickers";
		_object addMagazine "500Rnd_TwinVickers";
	};
	
	if (_object isKindOf "AH6J_EP1") then {
		_object removeWeapon "TwinM134";
		_object removeWeapon "FFARLauncher_14";
		_object removeWeapon "M134_2";
		_object addWeapon "PKT_veh";
		_object addMagazine "2000Rnd_762x54_PKT";
	};

} forEach vehicles; //Not completly necessary, it just makes sure no vehicle is left out during the process (e.g. high server load)

You had two forEach opening brackets.

Link to comment
Share on other sites

  • 0

Yeah I was lazy and didn't bother, that will teach me I have no idea how I didn't see that but thanks I'm going to apply this to my testing server and see what's up.

 

^^^ still adding a lot of mags to it, it's added 1000 mags to both the AN2 and the AH6J

Link to comment
Share on other sites

  • 0

I'm going to mess with this thing a lot more on my test server, for now I have removed it from my live server due to massive RPT spam I think it's all being caused by the line mentioned above causing it to loop over and over again.

Duplicate weapon TwinVickers detected for AH6J_EP1

It will spam that for about 200-400 lines every restart, I'm thinking it's trying to add the gun(s) to the object over and over again for whatever reason. I will report back later.

Link to comment
Share on other sites

  • 0

Try removing the forEach.

/*
	Remove Weapon SiothieGaming german Youtubechannel: http://www.youtube.com/user/SiothieGaming
	Lines underneath are just a small tutorial
	the Number in the Bracket is Important, -1  means Pilot seat
	Try getting up with these numbers when you want to remove from another seat (e.g. gunner, front gunner, rear gunner etc. pp)
	For every seat you have to do something like i did          
	_object magazinesTurret [-1];
	_object removeMagazinesTurret ["14Rnd_FFAR",[-1]]; If you want to remove something from another seat at the same time you need to do something like this:
	_object magazinesTurret [1];
	_object removeMagazinesTurret ["14Rnd_FFAR",[1]]; I'm not completly sure now which number is which seat. I only know that -1 is pilot seat.
*/

if (_object isKindOf "AN2_DZ") then {
	_object addWeapon "TwinVickers";
	_object addMagazine "500Rnd_TwinVickers";
};
	
if (_object isKindOf "AH6J_EP1") then {
	_object removeWeapon "TwinM134";
	_object removeWeapon "FFARLauncher_14";
	_object removeWeapon "M134_2";
	_object addWeapon "PKT_veh";
	_object addMagazine "2000Rnd_762x54_PKT";
};
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...