uncookedzebra 13 Posted September 26, 2016 Hi guys! I have been looking for a little bit now and I have been having an issue. I have it so that a player can create one item with a keystroke. If they press the key again it deletes that item and creates a new one. That I have no trouble with. What I have trouble with is getting the server to delete that particular item when that particular players leaves the game on a dedicated server. I been pulling my hair out trying to use publicVariableServer, getVariable, addmissionEventhandle and get everything to jive right. Thank you in advance! Share this post Link to post Share on other sites
fn_Quiksilver 1636 Posted September 27, 2016 publicvariable + getplayeruid + handledisconnect event handler Share this post Link to post Share on other sites
uncookedzebra 13 Posted September 27, 2016 Okay this is what I have.Flag_maker.sqf _id = clientOwner; _UID = getplayerUID player; _id publicVariableClient "Flag_UID_array"; flag = createVehicle ["FlagChecked_F", player modeltoworld [0,1,0], [], 0, "can_collide"]; _temp_array = [[_UID,flag]]; Flag_UID_array = Flag_UID_array + _temp_array; publicVariableServer "Flag_UID_array"; Init.sqf _handler1 = addMissionEventHandler ["HandleDisconnect",{ { UIDlookup = (Flag_UID_array select _x) select 0); if (UIDlookup == (_this select 1)) then { deleteVehicle (Flag_UID_array select _x) select 1); deleteVehicle (Flag_UID_array select _x) select 2); diag_log "Deleted Flag"; }; } foreach Flag_UID_array; }; ]; Share this post Link to post Share on other sites
Tajin 349 Posted September 27, 2016 That can be done much easier btw.: Flag_maker.sqf _flag = createVehicle ["FlagChecked_F", player modeltoworld [0,1,0], [], 0, "can_collide"]; player setVariable ["flag",_flag,true]; Init.sqf if (isServer) then { _handler1 = addMissionEventHandler ["HandleDisconnect",{ _player = _this select 0; _flag = _player getVariable ["flag",objNull]; deleteVehicle _flag; }]; }; Share this post Link to post Share on other sites
uncookedzebra 13 Posted September 28, 2016 Well, I did exactly that and it didn't work. :/I also tried replacing isServer with isDedicated since I am running it off dedicated. Still no dice. Share this post Link to post Share on other sites
davidoss 552 Posted September 28, 2016 This looks suspicious. player setVariable ["flag",flag,true]; Try change to _flag = createVehicle ["FlagChecked_F", player modeltoworld [0,1,0], [], 0, "can_collide"]; player setVariable ["flag",_flag,true]; Share this post Link to post Share on other sites
uncookedzebra 13 Posted September 28, 2016 Just tested. :( didn't work. Do you want my files for this? Share this post Link to post Share on other sites
davidoss 552 Posted September 28, 2016 Maybe the attached variable are removed before this eventhandler fires. Share this post Link to post Share on other sites
uncookedzebra 13 Posted September 28, 2016 I will try Diag_log to see whats going on. Share this post Link to post Share on other sites
uncookedzebra 13 Posted October 3, 2016 Well none of my diag_logs are firing. Does it have to do with the isServer? if (isServer) then { _handler1 = addMissionEventHandler ["HandleDisconnect",{ diag_log "DISCONNECT FIRED"; _player = _this select 0; diag_log _player; diag_log "DISCONNECTED"; _flag = _player getVariable ["flag",objNull]; deleteVehicle _flag; }]; }; Share this post Link to post Share on other sites