Jump to content
Sign in to follow this  
VanhA-ICON

currentWeapon in MP

Recommended Posts

Hi guys.

I've been bashing my head in trying to make the game detect that a player is holding a primary weapon in dedicated server.

The units are all equipped with only M9 and the idea is to make a task success when a player picks up a rifle of sorts.

I tried combining the currentWeapon with primaryWeapon commands and once succeeded with

!(currentWeapon player =="M9")

condition but of course on dedicated server that won't do.... or it shows only for that particular unit.

Any help appreciated since I can't script much..

EDIT:

I modified something older script I had and trying this solution:

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";};
};
};

Edited by VanhA-ICON

Share this post


Link to post
Share on other sites
if (isServer || isDedicated) then 
{
private ["_units","_i","_unit"];
while {true} do
{
	_units = playableUnits;
	for "_i" from 0 to ((count _units)-1) do
	{
		_unit = _units select _i;
		if ((alive _x) && (_x iskindOf "Man") && (primaryWeapon _x != "")) then {
			hint format ["%1 is one badass motherfucker",_x];
			sleep 1;
		};
	} forEach _units;
};
};

Edited by Waffle_SS

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  

×