grollig 19 Posted September 28, 2021 Hi there! Basically what I'm trying to do is to remoteExec a function on the server (dedicated) from the clients that uses the player (object) as parameter. To be more precise: I want to run the code below in initPlayerLocal.sqf to make certain players of our group become zeus when they join the mission. I am utilizing a function included in ZEN (Zeus Enhanced Mod) which handles curator module creation, etc. Problem is: The function has to be executed on the server and needs the player object as parameter. So this, executed on the server via debug-console, will work: [alpha1] call zen_common_fnc_createZeus; I am struggeling with how to handover the player object to the server from local script. This is my initPlayerLocal.sqf (not working code!): // Make worthy players become zeus by their UID _worthyPlayersUIDs = [ "12312312312312312", // John "45645645645645645" // Mike ]; _playerUID = getPlayerUID player; if (_playerUID in _worthyPlayersUIDs) then { [player] call zen_common_fnc_createZeus; }; I know that with the above code the player variable is not resolved on the server and that I have to resolve it on the client (see Example 5 in the BI Wiki: https://community.bistudio.com/wiki/remoteExec) However this code doesn't work: {[player] call zen_common_fnc_createZeus;} remoteExec ["call", 2]; Any help is appreciated. Thx in advance! Share this post Link to post Share on other sites
RCA3 581 Posted September 28, 2021 8 hours ago, grollig said: I want to run the code below in initPlayerLocal.sqf Wouldn't using initPlayerServer.sqf instead help? 1 Share this post Link to post Share on other sites
grollig 19 Posted September 29, 2021 Thank you for pointing me there. Tried the following Code: --> initPlayerServer.sqf: // Make worthy players become zeus by their UID _worthyPlayersUIDs = [ "12312312312312312", // John "45645645645645645" // Mike ]; params ["_playerUnit", "_didJIP"]; _playerUID = getPlayerUID _playerUnit; if (_playerUID in _worthyPlayersUIDs) then { waitUntil { time > 0 }; [_playerUnit] call zen_common_fnc_createZeus; }; Unfortunately this will only work for JIP players, not for players present at missonstart. 1 Share this post Link to post Share on other sites
grollig 19 Posted September 29, 2021 In the meantime I've also tried using addMissionEventHandler in initServer.cfg with no success: Code in initServer.sqf : FAS_Zeus_UIDs = [ "12312312312312312", // John "45645645645645645" // Mike ]; addMissionEventHandler ["PlayerConnected", { params ["_id", "_uid", "_name", "_jip", "_owner", "_idstr"]; _playerUnit = _uid call BIS_fnc_getUnitByUID; if (_uid in FAS_Zeus_UIDs) then { [_playerUnit] call zen_common_fnc_createZeus; [format ["%1",_playerUnit]] remoteExec ["hint", 0]; }; }]; _playerUnit gets correctly hinted as alpha1, but the createZeus function has no effect. I just don't understand why executing: [alpha1] call zen_common_fnc_createZeus; from the debug console on the server will work just fine. 1 Share this post Link to post Share on other sites
RCA3 581 Posted September 30, 2021 Got it working with this on initPlayerServer.sqf (just me testing on dedicated though, so try with more people please): // Make worthy players become zeus by their UID private _worthyPlayersUIDs = [ "12312312312312312", // John "45645645645645645" // Mike ]; params ["_playerUnit", "_didJIP"]; private _playerUID = getPlayerUID _playerUnit; if (_playerUID in _worthyPlayersUIDs) then { waitUntil {time > 1}; [format ["%1",_playerUnit]] remoteExec ["hint", 0]; [_playerUnit] remoteExecCall ["zen_common_fnc_createZeus", 0]; }; 1 Share this post Link to post Share on other sites
grollig 19 Posted September 30, 2021 6 hours ago, RCA3 said: Got it working with this on initPlayerServer.sqf (just me testing on dedicated though, so try with more people please): Thank you very much for your effort! I can confirm that it works on our server. However, I have only been able to test it on my own so far. I will give a feedback when we could test it with more players. 1 Share this post Link to post Share on other sites
grollig 19 Posted September 30, 2021 @RCA3 We just did a quick test with two players. Everything works as desired. Players with the corresponding ID become Zeus (from normal missionstart, JIP and rejoining after a disconnect). Thanks a lot! Btw: We also found out that the function only needs to be executed on the server side, not on all machines: [_playerUnit] remoteExecCall ["zen_common_fnc_createZeus", 2]; 1 Share this post Link to post Share on other sites