Jump to content
Sign in to follow this  
Radioman

netID - Is it the same as the ID passed by the 'OnPlayerConnected' event?

Recommended Posts

I'm needing to get the player object of a client who just connected dynamically. I'm thinking that I could use the "ObjectfromnetID" function, but I need to get the netID first. The only way I see on the A3 scripting commands BIKI page is to run "NetID" object, but I don't have the object, because that's what I'm trying to get....

Ideas?

[90099] New: Added MP only scripting functions netId / objectFromNetId / groupFromNetId.

^ Added to Arma 2, but I can't find any additional notes on this build besides this....

Edited by Radioman

Share this post


Link to post
Share on other sites

getting the player object from OnPlayerConnected can be a timing issue.

this works for me on a server/client machine in 3 _cycles, just under 1 sec.

init.sqf

onPlayerConnected "nul=[_name, _uid] execVM ""Server\SQU_onPlayerConnected.sqf""";

SQU_onPlayerConnected.sqf

_name = _this select 0;
_uid = _this select 1;

_clientId = -1;
_cycles = 0;

while{_clientId == -1}do
{
 {
    if (getPlayerUID _x == _uid) exitWith
    {
       _clientId = owner _x;
    };
 } forEach playableUnits;  
 _cycles = _cycles + 1;
 sleep .02;
};

diag_log format["JIP: _cycles =  %1",_cycles];	

_clientID publicVariableClient  "SQU_valuesArray";

Edited by Squ33z3

Share this post


Link to post
Share on other sites
I'm needing to get the player object of a client who just connected dynamically. I'm thinking that I could use the "ObjectfromnetID" function, but I need to get the netID first. The only way I see on the A3 scripting commands BIKI page is to run "NetID" object, but I don't have the object, because that's what I'm trying to get....

Ideas?

^ Added to Arma 2, but I can't find any additional notes on this build besides this....

Probably not.

As of version Arma2 1.04, _id will return a number in float format, something like 1.4253e+10.

objectfromnetid expects string as per description.

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  

×