Robustcolor 31 Posted November 21, 2019 Hi, when hosting local and playing with zeus module active and command #adminLogged, you loose access to zeus after respawn. Is there a way to loop a script that reenables it #adminLogged? Share this post Link to post Share on other sites
Mr H. 402 Posted November 21, 2019 1) save the assignedcurator as a variable on the player 2) add a respawn eventHandler 3) get the logic from the saved variable and reassign in the EH No need for a loop Share this post Link to post Share on other sites
Robustcolor 31 Posted November 21, 2019 40 minutes ago, Mr H. said: 1) save the assignedcurator as a variable on the player 2) add a respawn eventHandler 3) get the logic from the saved variable and reassign in the EH No need for a loop I see, after adding the variable on the zeus module, what is the command to get it within the eventhandler? Share this post Link to post Share on other sites
Mr H. 402 Posted November 21, 2019 no assign it to the player. // in your initplayerlocal.sqf player setVariable ["My_zeus",getAssignedCuratorLogic player]; player addEventHandler ["Respawn",{ private _zeus = player getVariable "My_zeus"; [[player,_zeus], {(_this select 0) assignCurator (_this select 1)}]remoteExec ["Call",2] }]; this was typed quickly double check my syntax 1 Share this post Link to post Share on other sites
Robustcolor 31 Posted November 21, 2019 4 hours ago, Mr H. said: no assign it to the player. // in your initplayerlocal.sqf player setVariable ["My_zeus",getAssignedCuratorLogic player]; player addEventHandler ["Respawn",{ private _zeus = player getVariable "My_zeus"; [[player,_zeus], {(_this select 0) assignCurator (_this select 1)}]remoteExec ["Call",2] }]; This did not work, still lost zeus control after respawn. And how will this work in a dedicated enviroment? If you login as an admin with a module active with #adminLogged? Will it work for JIP? Will it assign the zeus only to the player who's admin? I found this, not tested yet. OnPlayerRespawn.sqf params ["_newUnit","_oldUnit"]; private _cur = getAssignedCuratorLogic _oldUnit; if !(isNull _cur) then { [_newUnit,_cur] spawn { params ["newUnit","_cur"]; waitUntil { sleep 1; alive _newUnit}; [_newUnit,_cur] remoteExec ["assignCurator",2]; }; }; Share this post Link to post Share on other sites
anfo 118 Posted November 22, 2019 @Robustcolor I have yet to test these, but if you would like to try either one, it would help me to know if they're worth keeping: initPlayerServer.sqf Spoiler { if (!isnull (getassignedcuratorunit _x)) then { _unit = getassignedcuratorunit _x; if (isnull (getassignedcuratorlogic _unit)) then { unassignCurator _x; sleep 1; _unit assignCurator _x; }; }; } foreach allcurators; or... initServer.sqf Spoiler addMissionEventHandler ["PlayerConnected", { params ["_id", "_uid", "_name", "_jip", "_owner"]; _player =_uid call BIS_fnc_getUnitByUid; if (vehicle player == VariableNameOfYourZeusSlot) then {_player assignCurator myCurator;}; }]; or... init.sqf [] execVM "zeus_fix.sqf"; Spoiler [] spawn { // Delay until the server time has sync'd waitUntil {time > 5}; // For JIP, wait until the main screen loads waitUntil {!isNull (findDisplay 46) }; // Check if player name contains the word "curator" if (["curator", format["%1",player]] call BIS_fnc_inString) then { _checkIfValidCuratorSlot = { private _curatorList = _this; // Check that Zeus has been assigned to player if (isNull (getAssignedCuratorLogic player)) then { private _exitLoop = false; { // Find an unassigned Zeus slot and assign it to the player if (isNull (getAssignedCuratorUnit _x)) then { [player, _x] remoteExecCall ["assignCurator",2]; sleep 2.0; // Check if a valid Zeus slot if (isNull (getAssignedCuratorLogic player)) then { // Broken Zeus slot, so clear and repeat _x remoteExecCall ["unassignCurator",2]; sleep 2.0; } else { hint format["Zeus assigned to curator %1", _x]; _exitLoop = true; }; }; if (_exitLoop) exitWith {}; } forEach _curatorList; }; }; // Find all curators and reverse list so to lessen chance of admin Zeus conflicts private _curatorList = allcurators; reverse _curatorList; // Check that Zeus has been initially assigned to player _curatorList call _checkIfValidCuratorSlot; // Ensure Zeus keeps slot, despite admin logging while {true} do { // Check that Zeus has been assigned to player _curatorList call _checkIfValidCuratorSlot; sleep 10.0; }; }; }; Share this post Link to post Share on other sites
Mr H. 402 Posted November 22, 2019 7 hours ago, Robustcolor said: his did not work, still lost zeus control after respawn. And how will this work in a dedicated enviroment? If you login as an admin with a module active with #adminLogged? Will it work for JIP? Will it assign the zeus only to the player who's admin? I found this, not tested yet. OnPlayerRespawn.sqf params ["_newUnit","_oldUnit"]; private _cur = getAssignedCuratorLogic _oldUnit; if !(isNull _cur) then { [_newUnit,_cur] spawn { params ["newUnit","_cur"]; waitUntil { sleep 1; alive _newUnit}; [_newUnit,_cur] remoteExec ["assignCurator",2]; }; }; This should work in a dedi, should work for JIP players. If they had an assigned curator when they died, adds a little delay, maybe its necessary. 1 Share this post Link to post Share on other sites
Robustcolor 31 Posted December 12, 2019 Onplayerrespawn.sqf; params ["_newUnit","_oldUnit"]; private _cur = getAssignedCuratorLogic _oldUnit; if !(isNull _cur) then { [_newUnit,_cur] spawn { params ["newUnit","_cur"]; waitUntil { sleep 1; alive _newUnit}; [_newUnit,_cur] remoteExec ["assignCurator",2]; }; }; Gives error, local variable in global space. What's wrong? Share this post Link to post Share on other sites
anfo 118 Posted December 14, 2019 @Robustcolor This seems to be working for our group at the moment. initPlayerServer.sqf { if (!isnull (getassignedcuratorunit _x)) then { _unit = getassignedcuratorunit _x; if (isnull (getassignedcuratorlogic _unit)) then { unassignCurator _x; sleep 1; _unit assignCurator _x; }; }; } foreach allcurators; 1 Share this post Link to post Share on other sites
Robustcolor 31 Posted December 14, 2019 Thanks @anfo I noticed my script was missing an underscore at "_newUnit". params ["_newUnit","_oldUnit"]; private _cur = getAssignedCuratorLogic _oldUnit; if !(isNull _cur) then { [_newUnit,_cur] spawn { params ["_newUnit","_cur"]; waitUntil { sleep 1; alive _newUnit}; [_newUnit,_cur] remoteExec ["assignCurator",2]; }; }; 2 Share this post Link to post Share on other sites