Comrades in Arms Discussion Board

Full Version: Weapon pickup on dedicated
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi guys.
In short, why is this not working on dedicated?

Code:
if (isServer) then { private ["_guns","_guncount"]; while {(alive player) and (player iskindOf "Man")} do { _guns = Weapons player; _guncount = {not (_x in ["Binocular", "ItemCompass", "ItemGPS", "ItemRadio", "ItemWatch", "ItemMap", "M9"])} count _guns; if !(_guncount < 1) then { Obj2 = true;publicVariable "Obj2";}; }; };
(11-03-2013, 06:01 PM)VanhA link Wrote:Hi guys.
In short, why is this not working on dedicated?

Dedicated servers don't have a player variable. This works on a hosted server since the hosted server always has at least one player, but not on dedicated. You'll have to replace player with a specific variable.
Right, so replacing player with _unit might do the trick.
Actually originally I was trying to have a trigger grp detect like this:

{_x PrimaryWeapon ""} count (units grpBat) >0

But of course I had issues there as well.....
(11-03-2013, 06:24 PM)VanhA link Wrote:Right, so replacing player with _unit might do the trick.
Actually originally I was trying to have a trigger grp detect like this:

{_x PrimaryWeapon ""} count (units grpBat) >0

But of course I had issues there as well.....

You can have the code run on the clients only as well, for each individual player. The publicVariable will make sure that if any player has a weapon, the condition will be true. I'd also add a "sleep 1" to it, that will ease off the load a bit. Especially if this is on Arma 3, it's already demanding enough Wink