Jump to content
Sign in to follow this  
Devastator_cm

Ammo box issue

Recommended Posts

Hi Guys,

I have a problem with the ammo boxes in my dedicated server mission.

I deleted the content of the box with

 

I have following code in the init of the ammo box

 

clearWeaponCargoGlobal this;  
clearMagazineCargoGlobal this;  
clearItemCargoGlobal this;  
this addmagazinecargoGlobal ["TMT_15Rnd_9x19_M92_M", 10];  
this addmagazinecargoGlobal ["TMT_17Rnd_9x19_Glock17_M", 10];  
 
 
problem is, only the first person who joins to server can take those magazines. People who joined later on can see them but can"t move them to his/her inventory...
Any idea what can be the issue??
I used ACE3 default supply box for the model

Share this post


Link to post
Share on other sites

["AmmoboxInit",[this,true]] call BIS_fnc_arsenal;

 

I just use virtual arsenals. I always find stuff like that is buggy and i can never get it to work

Share this post


Link to post
Share on other sites

but I need a pre-setup for ammo box. I don't want the players to choose what ever they want..

Share this post


Link to post
Share on other sites

Change to this:

if (isServer) then {
	clearWeaponCargoGlobal this;
	clearMagazineCargoGlobal this;
	clearItemCargoGlobal this;
	this addmagazinecargoGlobal ["TMT_15Rnd_9x19_M92_M", 10];
	this addmagazinecargoGlobal ["TMT_17Rnd_9x19_Glock17_M", 10];
};

Also, use the editing/scripting subforum for questions like that.

https://forums.bistudio.com/forum/154-arma-3-mission-editing-scripting/

Share this post


Link to post
Share on other sites

Do I need to use if (isServer) then for all kind of object inits?
For example I adjust the uniform and so on with commands in object init but I didnt use 
if (isServer) there 

 

  
 

Share this post


Link to post
Share on other sites

Check the wiki for the locality of the commands you are using.:

https://community.bistudio.com/wiki/Category:Commands_by_effects_and_arguments_locality (look for the little icons that show argument- and effect-locality)

 

clearWeaponCargoGlobal is a command that is transmitted to all clients anyway so its important that it only gets called once or it it can lead to unexpected results.

 

clearWeaponCargo in the contrary has only a local effect, so you'd have to run this on every client that should be affected

Share this post


Link to post
Share on other sites

Is this box pre-placed in the editor or are you spawning it in via script later on?

 

If it's pre placed just use the Equipment Storage functionality found in the Object Attributes of an object.

Share this post


Link to post
Share on other sites

it is preplaced. Tajin's advise with server check worked. I will try also your suggestion and will report back

Share this post


Link to post
Share on other sites

it is preplaced. Tajin's advise with server check worked. I will try also your suggestion and will report back

 

Just like using the arsenal to equip a soldier, using the Equipment Storage part of an objects attributes is JIP friendly and works in a dedi environment.

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  

×