Jump to content
Sign in to follow this  
JacobJ

restrict a addaction menu to one player only?

Recommended Posts

Hey

I have added an action to a unit, but by now all other players on his team can access this menu. Is there anyway to only let the player with the addaction in his init use the action?

Share this post


Link to post
Share on other sites

addaction command takes a condition as it's last parameter, you should look into that.

Share this post


Link to post
Share on other sites

Could you explain how to use those commands, I havnt been able to get the hideOnUse to work and I think I am doing something wrong.

command = player1 addaction ["Start game", "confirm.sqf", (hideonuse)];

Share this post


Link to post
Share on other sites

check out the biki it has all info need for addaction

http://community.bistudio.com/wiki/addAction

condition: String - (optional, Arma 2 only, default:true) Code that must return true for action to be shown. Special variables "_target" (unit to which action is attached to) and "_this" (caller/executing unit) can be used in the evaluation.
so you might want someting like

"_target == _this"

in the condition

Share this post


Link to post
Share on other sites

Alternatively, just put the addAction in an if statement, e.g.:

if (player == <guywhoshouldhavetheaction>) then {player addAction [blahblahblah..]}

Share this post


Link to post
Share on other sites

in this example....

check out the biki it has all info need for addaction

http://community.bistudio.com/wiki/addAction

so you might want someting like

"_target == _this"

in the condition

this works exactly as desired until the player enters a vehicle. Then _this no longer equals target (because the player is now the vehicle instead of the player in the vehicle). Is there a sexy way to pull this off without a ton of lines? Something along the lines of ((_this == _target) or (vehicle _this == _target)).

Thanks

DasClark

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  

×