JeyR 2 Posted April 6, 2018 Alright. Welcome everyone. I have a very interesting problem, and I couldn't find a solution for it. I have been really trying to get past this but I can't solve this riddle. I have this small code snippet inside the initPlayerLocal.sqf: if (didJIP) then { [getPlayerUID player] remoteExecCall ["CHAB_fnc_jipcam",[-2,-(clientOwner)],false]; }; And here is the CHAB_fnc_jipcam: _uid = _this select 0; private "_player"; private "_local"; private "_localID"; { if ((getPlayerUID _x) isEqualTo _uid) then{_player = _x;}; } forEach allPlayers; _local = ???; _localID = ???; As you can see, I clearly have no clue who is the owner of machine ? In my mind's eye remoteExec sends a message to every player that they have to run this script with the given parameters. Here is what I tried so far: Create a global variable (not public) for each player and give it the playerUID -> Result is that inside the jipcam the returned value is "any" on each PC. Create a missionnamespace variable (global but not public) and give it the playerUID -> same results as before I have completely run out of ideas, I tried mostly everything I could think of. Is there anyone who has more tricks up his sleeve? Share this post Link to post Share on other sites
HazJ 1289 Posted April 7, 2018 This maybe? https://community.bistudio.com/wiki/remoteExecutedOwner Share this post Link to post Share on other sites
JeyR 2 Posted April 7, 2018 Seems like you don't understand. I need the person that runs the script. Remoteexecowner only gives you the ID of the person that initiated the remoteexec Share this post Link to post Share on other sites
Muzzleflash 111 Posted April 7, 2018 Just use clientOwner ? Share this post Link to post Share on other sites
Muzzleflash 111 Posted April 7, 2018 Also, you send the uid of the (assuming joining) player as argument. Then you iterate all players to get the player object. Just send the player object instead, and use it to get the uid. if (didJIP) then { [player] remoteExecCall ["CHAB_fnc_jipcam",[-2,-(clientOwner)],false]; }; And CHAB_fnc_jipcam: params ["_player"]; // Remote player unit private _uid = getPlayerUID _player; // Remote unit UID private _localId = clientOwner; // Local machine ID private _local = player; // Local player Share this post Link to post Share on other sites
JeyR 2 Posted April 7, 2018 I need the playerUId of the clientowner. something like "746128923471236". _local has to be the player object that the player is playing with. Share this post Link to post Share on other sites
Muzzleflash 111 Posted April 7, 2018 I updated my example. Share this post Link to post Share on other sites
JeyR 2 Posted April 7, 2018 using player simply return "null object", it doesn't work. I already tried that Share this post Link to post Share on other sites
Muzzleflash 111 Posted April 7, 2018 When, then there is no local player. Share this post Link to post Share on other sites
JeyR 2 Posted April 7, 2018 There is, I tested with copyToClipboard format [" : %1 %2 ",player,getplayeruid player]; And this is what I get on my clipboard : <NULL OBJECT> any Share this post Link to post Share on other sites
Muzzleflash 111 Posted April 7, 2018 You example demonstrates that there is no player object on the machine you ran it on. Thus the <NULL OBJECT> and the command getPlayerUID failing to get the proper result. Share this post Link to post Share on other sites
JeyR 2 Posted April 7, 2018 How is that possibble? This is all I have and I don't run any other scripts. Share this post Link to post Share on other sites
Muzzleflash 111 Posted April 7, 2018 Are you running a dedicated server? Have you placed any player objects in the mission? Share this post Link to post Share on other sites
JeyR 2 Posted April 7, 2018 Btw if it copies to my clipboard there is supposed to be a player or am I wrong ?? Share this post Link to post Share on other sites
Muzzleflash 111 Posted April 7, 2018 The text may vary, but it is supposed to say something different than <NULL...> . Share this post Link to post Share on other sites
JeyR 2 Posted April 7, 2018 This is all tested on dedicated, 10 playable units are placed but they won't appear until a player takes control of them, Share this post Link to post Share on other sites
Muzzleflash 111 Posted April 7, 2018 Correct. The commander 'player' only returns the object the player sitting on that machine is controlling. So a dedicated server does not have a player object, in fact no machine at all has a player object until someone connects and takes a slot. Then only that connecting player now get a player object. Share this post Link to post Share on other sites
JeyR 2 Posted April 7, 2018 that's why I have waitUntil {!isNull player && player == player}; And I already joined the game when I told my friend to join, I was running around the base already. Share this post Link to post Share on other sites
Muzzleflash 111 Posted April 7, 2018 I don't know how it is set up now - I can only assume the line you just mentioned is above the very first part you showed. So you are going to have to show the entire script to debug. Else, I can only say the player command itself works fine. Share this post Link to post Share on other sites
JeyR 2 Posted April 7, 2018 initplayerlocal : waitUntil {!isNull player && player == player}; if (didJIP) then { [getPlayerUID player] remoteExecCall ["CHAB_fnc_jipcam",[-2,-(clientOwner)],false]; }; jipcam: _uid = _this select 0; private "_player"; private "_local"; private "_localID"; { if ((getPlayerUID _x) isEqualTo _uid) then{_player = _x;}; } forEach allPlayers; _local = ???; _localID = ???; Share this post Link to post Share on other sites
Muzzleflash 111 Posted April 7, 2018 Dunno, the getPlayerUID command is listed as being possibly unreliable when executed where the object is not local. So my suggestion would be did. First I don't believe you need the wait since initPlayerLocal.sqf is not run before the player object is ready. To ensure the UID is properly collected gather it from the joining player's machine, and since you can't rely on it find the player object, send it manually too: if (didJIP) then { [player, getPlayerUID player] remoteExecCall ["CHAB_fnc_jipcam",[-2,-(clientOwner)],false]; }; And CHAB_fnc_jipcam: params ["_joinedPlayer", "_joinedUID"]; // Remote player unit and remote unit UID private _localId = clientOwner; // Local machine ID private _local = player; // Local player Share this post Link to post Share on other sites
JeyR 2 Posted April 7, 2018 Spoiler Fine, i'll try it Okey, unfortunately it didn't work. Here is what I got after I changed my code to yours: this is in my clipboard after a player joined JIP -> clip: <NULL-object> + "" Oh and btw this is the description of the player command on the wiki: "Person controlled by player. In MP this value is different on each computer and on dedicated server this value is null." Share this post Link to post Share on other sites
Muzzleflash 111 Posted April 7, 2018 On that last comment, that is the same thing I said earlier. Anyway in order to test it, I modified to also send the message to the server and back again to myself, and I logged the values passed to CHAB_fnc_jipcam. The leftmost ID is what the player/server machine got of values. ID (3) sees, '_joinedPlayer' has value 'B Alpha 1-2:1 (Muzzleflash)' ID (3) sees, '_joinedUID' has value '76561234589382009' ID (3) sees, '_localId' has value '3' ID (3) sees, '_local' has value 'B Alpha 1-2:1 (Muzzleflash)' ID (2) sees, '_joinedPlayer' has value 'B Alpha 1-2:1 (Muzzleflash) REMOTE' ID (2) sees, '_joinedUID' has value '76561234589382009' ID (2) sees, '_localId' has value '2' ID (2) sees, '_local' has value '<NULL-object>' In this case ID 3 is me joining and ID 2 is the server. But suppose instead, another player was already joined when I connected, and the only he got the message, then he would see something like: ID (7) sees, '_joinedPlayer' has value 'B Alpha 1-2:1 (Muzzleflash)' ID (7) sees, '_joinedUID' has value '76561234589382009' ID (7) sees, '_localId' has value '7' ID (7) sees, '_local' has value 'B Alpha 1-3:2 (Leeroy Jenkins)' Share this post Link to post Share on other sites
JeyR 2 Posted April 7, 2018 Okey so from that I can only assume that the server thinks my ID is 2 ? And that my player == NULL-OBJECT. Why is that? Share this post Link to post Share on other sites
Muzzleflash 111 Posted April 7, 2018 ID 2 is always the server. If you are running a dedicated server then the server don't have a player object so it is always null -- like in my example above. If you are running a hosted server you should have a player object. Share this post Link to post Share on other sites