Jump to content
Jonas353

Add UIDs and Playernames to Action

Recommended Posts

Is it possible to check all player uids and names then add all of them to actions?

Example

_aa = [];

{

_uid = getPlayerUID _x;

_aa pushback _uid;

} forEach allPlayers;

 

hint format["%1",_aa];

 

and then

player addaction[something]

Share this post


Link to post
Share on other sites

What exactly are you trying to accomplish? 

 

Do you want to add actions to all players? 

Do you want to add an action for each player? 

Do you want to add action to players filtered by their uid? 

 

Need more information... 

Share this post


Link to post
Share on other sites

I want to add actions with player uids and names just for me to execute commands on each person as i sometimes run random events.

Share this post


Link to post
Share on other sites

Right... If you mean to pass the uid and name into the action code do that via the argument parameter (see https://community.bistudio.com/wiki/addAction).

Example: 

{
	_uid = getPlayerUID _x;
	_name = name _x;
	_x addAction [
		"Title", 
		{ 
			private _args = _this select 3; //Fetch arguments
			private _uid = _args select 0;  //Parse them into local vars (or dont, your choice).
			private _name = _args select 1;
			
			hint format ["Hello! My name is %1 and my UID is %2. What is your name?", _name, _uid]; //Use in fancy ways
		}, 
		[_uid, _name] //Arguments parameter
	];
} forEach allPlayers;

If you mean just executing stuff on all players do:

//If local effect
{
   //Your stuff here, _x refers to each player respectivly 
   _x addAction ["Meeh", {}];
} forEach allPlayers;

//If global effect
[
  [],
  {
    if(hasinterface) then {
       player addAction ["Meeh", {}];
    };
  }
] remoteExec ["call"];

If I completely misunderstood you provide a fully fledged example of what exactly you'd like to do, preferably with a step by step description.

Share this post


Link to post
Share on other sites

Your script worked fine but thats not what im looking for. I wan't to make a script that adds multiple actions for me with users uids and player names and then i can execute something on each specific player. :f:

 

When i join the server it adds actions with player names and uids

Example

player addAction["Player1"]{[]spawn something;}];

 

something = {

player addAction["Give 1k"]{give money to player1;}];

};


When i click on the actions it asks me if i wan't to give money or something like that

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

×