Jump to content
Sign in to follow this  
Valfunction

addAction only for self use

Recommended Posts

I have a script that is run from an addAction. The addAction is added to the playable units (MP). I want to make it so only the person who the addAction is attached to is able to use it. In other words, player A cannot access the action which is attached to player B. Is there a way to do this?

Share this post


Link to post
Share on other sites

yes

need more info!

only a human player shall have the actcion (cheating)?

only a role in the mission shall have the action?

private ["_coding","_ids"];
_coding = "76561197996296785";
_ids = [_coding];
{
if (getPlayerUID player == _x) then
{
	//player addAction["AH-99", {"B_Heli_Attack_01_F" createVehicle (getPos player);}];
};
}
forEach _ids;

Edited by Coding

Share this post


Link to post
Share on other sites

addAction is local anyway, so just have the player add it to themselves via script instead of from the map.

if (local unit1) then {
   unit1 addAction ["Say cheese!", {unit1 sideChat "Cheese!"}];
};

Might work :)

Share this post


Link to post
Share on other sites

Sorry I'll be a bit more specific. Each unit has a "beacon" which is activated/deactivated via an action. Each unit should be able to turn on their own beacon on/off but not another unit's beacon (all units are human so don't have to worry about AI).

@kylania

On a dedicated server now I have no addAction options at all. My assumption is that it is adding the actions locally to the server so the clients cannot see them.

@coding

I don't know how to get UIDs but stepping through the code I don't really see how it is different from just adding the actions via the init field for each unit.

EDIT: I seem to have sussed it by fiddling the parameters. Now looks like this: _unit addAction ["Beacon", "beacon.sqf", [] , 1 , true , true , "" , "_this == _target"]; This way it checks if the unit the action is attached to and the one triggering the action are the same.

Edited by Valfunction

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  

×