Jump to content
Sign in to follow this  
pebcak

Prevent Gear Pick-ups

Recommended Posts

Is there a way to prevent a player in a MP game from picking up extra weapons? For example, prevent someone playing a Civilian from picking up any weapons greater than pistols. They would need to be allowed to pick up extra pistol ammo and perhaps nades, however.

Share this post


Link to post
Share on other sites

it wouldn't be possible to 'prevent' them from picking up weapons, but you can use the hasweapon command to check what weapon the player has (using an array of the weapons he's not allowed), if it's one of the banned weapons then you can then use the removeweapon command to take it off them.

Share this post


Link to post
Share on other sites

Hmmn. Right. Okay. Not quite sure how to do that yet. Quick code sample to get me on the way..? huh.gif

Share this post


Link to post
Share on other sites

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_allowWeapons = ["M9","M9SD","Makarov","MakarovSD"];

{

If( not (_x In _allowWeapons) ) Then {

Hint Format["The weapon %1 is not allowed!!!", _x];

};

} forEach Weapons _u;

This example will tell you if the unit is in possesion of a forbidden weapon. The only weapons allowed in this example are M9 and Makarov pistols, including suppressed versions.

Note that grenades are magazines, not weapons, so if you want to check for them, you need to use the magazines command.

Variable '_u' refers to the unit whose weapons you want to check.

Variable '_x' is a "magic variable" available within the forEach scope, which is refering to one of the unit's weapons.

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  

×