Jump to content

Noel Collins

Member
  • Content Count

    9
  • Joined

  • Last visited

  • Medals

Everything posted by Noel Collins

  1. Thanks @mrcurry i did exactly that over the weekend, went back to first principles and nuttted it out. i have something that works now, but it not fully teste. i will put it up here when im 100% confident in it 🙂 thanks!
  2. wait one, i have changed the mission while exploring other options, let me rebuild And yes, im looking to save position and loadout from players to their own profilesnamespace, so that we can start from the same position and with the same gear thefollowing week. https://drive.google.com/drive/folders/1i9-ks-ml41RtxMi3STlhRU_d3sdxY3oW?usp=sharing mission folder and the multiplayer file thanks for your patience gents, im really stuggling to get my head around this one!
  3. Thanks, trying that now but no avail. the image you posted has not come through, so i cannot see what you are trying to show. as its sits now in my init.sqf: TAG_fnc_loadClientData = { params ["_loadout", "_positionASL", "_dir"]; waitUntil {!isNull player}; player setUnitLoadout _loadout; player setDir _dir; player setPosASL _positionASL; }; if (isServer) then { profileNamespace setVariable ["TAG_disconnectedLoadouts",nil]; // only for resetting the variable on server. Important if not previously a hashmap ! addMissionEventHandler ["HandleDisconnect", { params ["_body", "_id", "_uid", "_name"]; if(!isNull _body) then { private _loadout = getUnitLoadout _body; private _position = getPos _body; private _direction = getDir _body; if(isNil {profileNamespace getVariable "TAG_disconnectedLoadouts"}) then { profileNamespace setVariable ["TAG_disconnectedLoadouts",createHashMapFromArray [[_uid,[_loadout,_position,_direction]]]]; } else { (profileNamespace getVariable "TAG_disconnectedLoadouts") set [_uid,[_loadout,_position,_direction]]; }; diag_log [_uid,(profileNamespace getVariable "TAG_disconnectedLoadouts")]; }; false } ]; addMissionEventHandler ["PlayerConnected", { params ["_id", "_uid", "_name", "_jip", "_owner"]; if(_jip) then { private _clientData = profileNamespace getVariable ["TAG_disconnectedLoadouts", []]; if (_clientData isEqualTo []) exitWith {}; private _value = _clientData get _uid; diag_log ["<<<<<after connect>>>>",_value,_this]; [_value,TAG_fnc_loadClientData] remoteExec ["spawn", _owner]; }; } ]; };
  4. thanks @pierre MGI the above is my experience, I can script, but im a little out of my depth on this one. what am i missing here? thanks
  5. Original Attempt was with code in init.sqf exactly as above on hosted server, with nothing else done. This attempt the same code was as below, only change marked in red.: i dont see a namespace in the handle disconnect EH? thanks TAG_fnc_loadClientData = { _this params ["_loadout", "_positionASL", "_dir"]; player setUnitLoadout _loadout; player setDir _dir; player setPosASL _positionASL; }; if(isServer) then { addMissionEventHandler [ "HandleDisconnect", { params ["_body", "_id", "_uid", "_name"]; if(!isNull _body) then { //Init storage var if(isNil "TAG_disconnectedLoadouts") then { TAG_disconnectedLoadouts = []; }; //Get data private _loadout = getUnitLoadout _body; private _position = getPos _body; private _direction = getDir _body; //Find in storage private _uidIndex = TAG_disconnectedLoadouts find _uid; if(_uidIndex > -1) then { //Found -> update private _loadoutIndex = _uidIndex + 1; TAG_disconnectedLoadouts set [_loadoutIndex, [_loadout, _position, _direction]]; } else { //Not found -> Add new TAG_disconnectedLoadouts pushBack _uid; TAG_disconnectedLoadouts pushBack [_loadout, _position, _direction]; }; }; false } ]; addMissionEventHandler [ "PlayerConnected", { params ["_id", "_uid", "_name", "_jip", "_owner"]; if(_jip) then { private _clientData = profileNamespace getVariable ["TAG_disconnectedLoadouts", []]; private _uidIndex = _clientData find _uid; if(_uidIndex > -1) then { private _loadoutIndex = _uidIndex + 1; (_clientData select _loadoutIndex) remoteExec ["TAG_fnc_loadClientData", _owner]; }; }; } ]; };
  6. So i tried again, changing missionNamespace to profileNamespace. no joy. as per above, hosted server. There is stuff mentioned above about whitelists, etc, which i do not understand. Is there anyone who uses this script that can help? thanks
  7. I tried to use the script above over the weekend: - blank mission with one playable character, an arsenal and a vehicle. - The code above copied into in it.sqf. - on joining I walked about 15 metres and to the right, turned 180 from starting orientation, and dripped numerous weapons and items from inventory. - I then disconnected and logged back on. I spawned back in original position, with original gear. Can anyone confirm this script still works, and if there are any other server side settings I need to make it work? Thanks!
×