Jump to content
Sign in to follow this  
device_zero

Multiplayer Ammobox (bug?)

Recommended Posts

Hello everyone, I'm experiencing difficulties with custom ammoboxes.

I can clear the ammobox without problems and I can also add weapons/ammo with addWeaponCargoGlobal/addMagazineCargoGlobal but sometimes the items within the ammobox seem to bug out for some players on multiplayer. Basically what happens is that some players can not take out some items from the ammobox, even though it is right there. Other players have to take out the items and drop it on the ground for that player to be able to pick it up... so the items are present.

Here's a code exerpt from one ammobox which bugged out last match, this code is in the init section:

clearMagazineCargoGlobal this;
this addMagazineCargoGlobal ["30Rnd_45ACP_Mag_SMG_01", 2];
this addMagazineCargoGlobal ["30Rnd_9x21_Mag", 2];

The items are cleared/added just fine, but sometimes players can not take anything out and it is really puzzling.

Anyone have a clue what may be the problem? anyone had any similar issues?

Share this post


Link to post
Share on other sites

This is sometimes caused by enableSimulation false; But I guess you didn't use that.

Share this post


Link to post
Share on other sites

Initline

null = [this] execVM "script.sqf";

Script

///////// MP Ammo Box script

///////// By: Riouken

///////// For Arma 3

if (! isServer) exitWith {};

_crate = _this select 0;

while {alive _crate} do

{

clearMagazineCargoGlobal _crate;

clearWeaponCargoGlobal _crate;

clearItemCargoGlobal _crate;

//Adding all the required items

_crate addItemCargoGlobal ["",10];

_crate addItemCargoGlobal ["",3];

_crate addItemCargoGlobal ["",3];

_crate addItemCargoGlobal ["",3];

_crate addItemCargoGlobal ["",10];

_crate addItemCargoGlobal ["",1];

_crate addItemCargoGlobal ["",1];

_crate addItemCargoGlobal ["",2];

_crate addItemCargoGlobal ["",10];

_crate addItemCargoGlobal ["",10];

//Adding all the required medic gear

_crate addItemCargoGlobal ["",25];

_crate addItemCargoGlobal ["",25];

_crate addItemCargoGlobal ["",25];

_crate addItemCargoGlobal ["",25];

_crate addItemCargoGlobal ["",25];

_crate addItemCargoGlobal ["",30];

_crate addItemCargoGlobal ["",10];

_crate addItemCargoGlobal ["",25];

//Adding the weapons

_crate addWeaponCargoGlobal ["UK3CB_BAF_L85A2_RIS",30];

_crate addWeaponCargoGlobal ["Laserdesignator",10];

_crate addWeaponCargoGlobal ["tf47_at4_heat",30];

_crate addWeaponCargoGlobal ["UK3CB_BAF_L129A1_Grippod",10];

_crate addWeaponCargoGlobal ["UK3CB_BAF_L110A2",10];

_crate addWeaponCargoGlobal ["UK3CB_BAF_L7A2_FIST",30];

_crate addWeaponCargoGlobal ["UK3CB_BAF_L131A1",30];

//Adding the ammunition

_crate addMagazineCargoGlobal ["UK3CB_BAF_30Rnd",300];

_crate addMagazineCargoGlobal ["UK3CB_BAF_17Rnd_9mm",60];

_crate addMagazineCargoGlobal ["UK3CB_BAF_20Rnd_T",100];

_crate addMagazineCargoGlobal ["UK3CB_BAF_75Rnd_T",140];

_crate addMagazineCargoGlobal ["UK3CB_BAF_100Rnd",120];

_crate addMagazineCargoGlobal ["Laserbatteries",20];

_crate addMagazineCargoGlobal ["1Rnd_HE_Grenade_shell",60];

_crate addMagazineCargoGlobal ["DemoCharge_Remote_Mag",60];

//Adding all the attachment options

_crate addItemCargoGlobal ["UK3CB_BAF_LLM_IR",10];

_crate addItemCargoGlobal ["UK3CB_BAF_TA648_308",3];

_crate addItemCargoGlobal ["UK3CB_BAF_SpecterLDS_Dot_3D",10];

_crate addItemCargoGlobal ["STKR_HMNVS",30;

_crate addItemCargoGlobal ["ACE_acc_pointer_green_IR",30];

_crate addItemCargoGlobal ["ACE_acc_pointer_green",30];

//Adding the three different uniforms

_crate addItemCargo ["",3];

_crate addItemCargo ["",3];

//Adding the headgear options and glasses

_crate addItemCargoGlobal ["Beret_para",3];

_crate addItemCargoGlobal ["STKR_MK7",3];

//Adding the vests

_crate addItemCargoGlobal ["",1];

_crate addItemCargoGlobal ["",1];

//Adding the backpacks

_crate addBackpackCargoGlobal ["",1];

_crate addBackpackCargoGlobal ["",1];

sleep 500;

};

Share this post


Link to post
Share on other sites

clearMagazineCargoGlobal this;
this addMagazineCargoGlobal ["30Rnd_45ACP_Mag_SMG_01", 2];
this addMagazineCargoGlobal ["30Rnd_9x21_Mag", 2];

When using commands in init, they will execute every time a player joins. So every time player appears this ammo box deletes its content and adds new content. Basically you are asking for trouble and seems like you already got it!

Share this post


Link to post
Share on other sites
When using commands in init, they will execute every time a player joins. So every time player appears this ammo box deletes its content and adds new content. Basically you are asking for trouble and seems like you already got it!

Never knew that it executes every time a player joins, this was causing the problem like you mentioned.

I solved it with a simple if statement in the init to only run it on the server once:

if(isServer) then {
   clearMagazineCargoGlobal this;
   this addMagazineCargoGlobal ["30Rnd_45ACP_Mag_SMG_01", 2];
   this addMagazineCargoGlobal ["30Rnd_9x21_Mag", 2];
}

Thanks for the help everyone!

Edited by device_zero

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×