Jump to content
ZaellixA

Client Owner and remoteExec

Recommended Posts

Hey all,

 

I have a (hopefully) quick question. I am trying to get the clientOwner from the "PlayerConnected" mission event handler, which is supposed to be the fifth argument given to the script. I manage to get the number but when I test it in the editor (play in Multiplayer) I get as clientOwner the number 2.

 

Now, I intend to use this to execute some scripts with remoteExec. But on the other hand if I use 2 in remoteExec the command/script will be executed only on the server.

 

The real question is: Do I get 2 as the clientOwner because I test the mission in the editor so, my machine is the server too?

 

Unfortunately I can't test it on a real server (I could use TADST server but I won't be able to do that anytime soon), so if you guys have any idea about it I would be glad to hear it.

 

Thanks in advance, have fun, take care and ArmA a lot :),

 

Achilles.

Share this post


Link to post
Share on other sites

Hey whiztler, thanks for the answer.

 

As I wrote I won't be able to use TADST anytime soon due to not being able to work on a PC (currently on Mac). If I could use TADST I would definitely do so.

 

Now regarding the, you can see a short snippet adapted for the forums needs (some extra explanatory comments were added).

playerIDs = [[], []]; // Initialize a global variable to hold the IDs and the clientOwner info

// Adding the mission event handler
addMissionEventHandler["PlayerConnected", {
  private _ID = _this select 0; // Get the player's ID (used to find markers)
  private _owner = _this select 4; // Get the player's clientOwner number

  (playerIDs select 0) pushBackUnique _ID; // Add the player's ID to the respective array
  (playerIDs select 1) pushBackUnique _owner; // Add the associated player's clientOwner to the respective array
}];

/*
 * Now while running in multiplayer from the editor when I run
 * --- systemChat str (playerIDs select 1); --- 
 * I get 2 as the result.
 */

Now, again, the question is: Do I get 2 as a result due to the fact that my machine is also the server, or I misunderstood something? I believe that clientOwner number is the same number used when you use remoteExec in order to decide on which machine you want the command/function executed. Is that right, or I am mistaken somehow?

Share this post


Link to post
Share on other sites
12 hours ago, ZaellixA said:

Do I get 2 as a result due to the fact that my machine is also the server,

Yes

 

12 hours ago, ZaellixA said:

I believe that clientOwner number is the same number used when you use remoteExec

Correct

  • Thanks 1

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

×