Page MenuHomeFeedback Tracker

[scripting command] clientIdToObject ?
New, NormalPublic

Description

Hello,

When we remoteExec a script on the server, we can use remoteExecutedOwner to get the id of the player which initiated Remote Execution call.
If I want to get the player object associated to this id, I need to loop through the whole player list and compare owner _x to remoteExecutedOwner.

_unit = objNull;
{
    if (owner _x isEqualTo remoteExecutedOwner) exitWith {_unit = _x};
} foreach playableUnits;
diag_log name _unit;

Another solution is to provide the player in the script parameters like

[param1, param2, player] remoteExec ["myScript", 2]; // client side
params ["_param1", "_param2", "_unit"]; // server side
diag_log name _unit;

And another solution could be to store all ids and objects within the onPlayerConnected event, in a global variable serverside...
As these solutions are not optimal, I think that it would be useful to have a command, to directly get the player object associated with a client ID.

Details

Severity
Feature
Resolution
Open
Reproducibility
N/A
Operating System
Windows 7
Category
Scripting

Event Timeline

reekoj created this task.Jun 10 2020, 4:14 PM
reekoj updated the task description. (Show Details)Jun 10 2020, 4:17 PM
dedmen added a subscriber: dedmen.Jun 12 2020, 1:16 PM

The command would do the exact same as you already do via script. So why? I don't see any need.
Why is passing objects as parameter suboptimal?