Norbak 10 Posted August 22, 2015 Hmm interesting. Then a player who can't make a "itemX" will only wait "waituntil {}" for 5 seconds... and a player who can make "Itemx" will wait for "itemx" or not. Interesting thing. Thanks for this great tip. I'll test later. Share this post Link to post Share on other sites
Norbak 10 Posted August 23, 2015 It didn't work.. Maybe i did something wrong. Share this post Link to post Share on other sites
Schatten 268 Posted August 23, 2015 Well, write in detail what you need. Share this post Link to post Share on other sites
Norbak 10 Posted August 24, 2015 I don't know gow to explain lol Share this post Link to post Share on other sites
Norbak 10 Posted August 31, 2015 I'm doing something wrong.it's not working now for me.do i need to place Onplayerdisconnected in init.sqf or in a trigger in the editor? Server side is a trigger in the editor ,yes?. Repeatable and local player? And another issue: YourOwnVehicles = [];onPlayerDisconnected " {_x spawn {deleteVehicle _this}} forEach YourOwnVehicles; YourOwnVehicles = [];";"YourOwnVehicle" addPublicVariableEventHandler { YourOwnVehicles set [count YourOwnVehicles, YourOwnVehicle]; YourOwnVehicle = nil;}; Every player ( player1 and player2) are able to spawn a "Yourownvehicle". When one of them disconnects the other Yourownvehicle item is deleted aswell, not only the player1's vehicle. Is this correct?. Is there any kind of fix this to delete only our own item? Share this post Link to post Share on other sites
Schatten 268 Posted September 2, 2015 do i need to place Onplayerdisconnected in init.sqf or in a trigger in the editor? You need place onPlayerDisconnected command only in SQF-file (for example, init.sqf) and only once, because repeated placing onPlayerDisconnected overwrites previous assigned code. Server side is a trigger in the editor ,yes?. Repeatable and local player? I'm not sure, but I think that triggers placed in editor are server objects, but activation statements, type, etc. are local for each player. Every player ( player1 and player2) are able to spawn a "Yourownvehicle". When one of them disconnects the other Yourownvehicle item is deleted aswell, not only the player1's vehicle. Is this correct?. Is there any kind of fix this to delete only our own item? Try this (needs Functions module). Player side: YourOwnVehicle = "Old_moto_TK_Civ_EP1" createVehicle [(getPos player) select 0, (getPos player) select 1, 0.3]; YourOwnVehicle setVariable ["ownerUid", getPlayerUID player, true]; publicVariableServer "YourOwnVehicle"; Server side: YourOwnVehicles = []; onPlayerDisconnected " _indexes = []; { if ((_x getVariable ['ownerUid', '']) == _uid) then { _indexes set [count _indexes, _forEachIndex]; _scriptHandler = _x spawn {deleteVehicle _this}; waitUntil { sleep 0.1; scriptDone _scriptHandler }; }; } forEach YourOwnVehicles; YourOwnVehicles = [YourOwnVehicles, _indexes] call BIS_fnc_removeIndex; "; "YourOwnVehicle" addPublicVariableEventHandler { YourOwnVehicles set [count YourOwnVehicles, YourOwnVehicle]; YourOwnVehicle = nil; }; Share this post Link to post Share on other sites
Norbak 10 Posted September 2, 2015 I see. Using UID is a good idea. I wasn't to know how to do this. So i'll test and i'll reply you,Schaten. But if we need to delete more than one item while disconnected?. maybe? ====> "YourOwnVehicle2" addPublicVariableEventHandler { YourOwnVehicles set [count YourOwnVehicles, YourOwnVehicle2]; YourOwnVehicle2 = nil; }; "YourOwnVehicle3" addPublicVariableEventHandler { YourOwnVehicles set [count YourOwnVehicles, YourOwnVehicle3]; YourOwnVehicle3 = nil; }; Share this post Link to post Share on other sites
Schatten 268 Posted September 3, 2015 But if we need to delete more than one item while disconnected?. maybe? ====> That is unnecessary to use addPublicVariableEventHandler for each public variable: YourOwnVehicle = "Old_moto_TK_Civ_EP1" createVehicle _position1; YourOwnVehicle setVariable ["ownerUid", getPlayerUID player, true]; publicVariableServer "YourOwnVehicle"; YourOwnVehicle = "hilux1_civil_3_open_EP1" createVehicle _position2; YourOwnVehicle setVariable ["ownerUid", getPlayerUID player, true]; publicVariableServer "YourOwnVehicle"; ... Server side is without changes. 1 Share this post Link to post Share on other sites
Norbak 10 Posted September 3, 2015 I meant a different item. "YourOwnVehicle" addPublicVariableEventHandler { YourOwnVehicles set [count YourOwnVehicles, YourOwnVehicle]; YourOwnVehicle = nil; }; "Anotheritem" addPublicVariableEventHandler { YourOwnVehicles set [count YourOwnVehicles, anotheritem]; anotheritem = nil; }; "Aflyingcarpet" addPublicVariableEventHandler { YourOwnVehicles set [count YourOwnVehicles, Aflyingcarpet]; Aflyingcarpet = nil; }; And so. Because those items are made yet with static names. Share this post Link to post Share on other sites
Schatten 268 Posted September 4, 2015 I meant a different item. And? You use same code several times! Because those items are made yet with static names. YourOwnVehicle = "Old_moto_TK_Civ_EP1" createVehicle _position1; YourOwnVehicle setVariable ["ownerUid", getPlayerUID player, true]; publicVariableServer "YourOwnVehicle"; Anotheritem = "hilux1_civil_3_open_EP1" createVehicle _position2; YourOwnVehicle = Anotheritem; YourOwnVehicle setVariable ["ownerUid", getPlayerUID player, true]; publicVariableServer "YourOwnVehicle"; Aflyingcarpet = ...; YourOwnVehicle = Aflyingcarpet; YourOwnVehicle setVariable ["ownerUid", getPlayerUID player, true]; publicVariableServer "YourOwnVehicle"; 1 Share this post Link to post Share on other sites
Norbak 10 Posted September 4, 2015 Great!. And is that for deleting differents items at the same time when disconnected?. So, it's great! Then i use this type of script to delete markers and triggers aswell? -marker- Mymarker1 = createmarker ["marker1",getpos player1]; Mymarker1 setmarkerText format ["Myposition",name player]; Mymarker1 setmarkerType "city"; Mymarker1 setMarkerColor "ColorRed"; Mymarker1 setmarkerpos getPos player1; YourOwnVehicle = Mymarker1; Yourownvehicle setVariable ["ownerUid", getPlayerUID player, true]; publicVariableServer "YourOwnVehicle"; -trigger- Mytrigger = createTrigger ["EmptyDetector", [0,0,0]];Mytrigger setTriggerArea [0, 0, 0, false];Mytrigger setTriggerActivation ["NONE", "present",true]; YourOwnVehicle = Mytrigger; YourOwnVehicle setVariable ["ownerUid", getPlayerUID player, true]; publicVariableServer "YourOwnVehicle"; Then those will delete Yourownvehicle at the same time if needed, when Yourownvehicle is: Yourownvehicle,Anotheritem,Aflyingcarpet,Mymarker1,Mytrigger? Share this post Link to post Share on other sites
Schatten 268 Posted September 9, 2015 Then i use this type of script to delete markers and triggers aswell? Yes, you can. Share this post Link to post Share on other sites
Norbak 10 Posted September 12, 2015 I think i'm really confused with this command. It's working randomly. Share this post Link to post Share on other sites
Sgt.Spunkmeyer 14 Posted September 23, 2015 You simply could use the Schatten's script...: YourOwnVehicles = []; onPlayerDisconnected " {_x spawn {deleteVehicle _this}} forEach YourOwnVehicles; YourOwnVehicles = []; "; "YourOwnVehicle" addPublicVariableEventHandler { YourOwnVehicles set [count YourOwnVehicles, YourOwnVehicle]; YourOwnVehicle = nil; }; And using a Trigger in the .sqf of the object ("AnotherItem" in this case) to make possible its elimination, just after the object creation line: AnotherItemTrig = createTrigger ["EmptyDetector", [0,0,0]]; AnotherItemTrig setTriggerArea [0, 0, 0, false]; AnotherItemTrig setTriggerActivation ["NONE", "present", false]; AnotherItemTrig setTriggerStatements ["!alive Player", "hint ""Player died and this object should be deleted now.""; deletevehicle AnotherItemTrig; deletevehicle AnotherItem", ""]; (Hint part could be erased. It's only for a debug) All this should work like: 1) Player disconnects and reset the player like a dead body. 2) Trigger detects the player and start deleting the trigger and the object. * Add a trigger in every .sqf of every object. Share this post Link to post Share on other sites