Search the Community
Showing results for tags 'player connected'.
Found 1 result
-
I'm making a guerilla style coop mission the code works well in single player but as soon as i go on a Server not verry much happens I plan on having a persistent server witch initializes with the start so i only have JIPs I have been trying to just execute code on new Players either by 1. writing them in a list and updating it every 0.1 sec. or (and looping thrue them later) 2. by (Player) execVM ... i tried playing with waitUntil it doesnt seem to have any effect (apart from delying the script) i failed with both attempts there must be something im missing maybe locality? here is my code (you can also Just answer my question im shure its a simple one for some of you) : 1. : while {true} do { for "_thisPlayerNum" from 0 to (count allPlayers) do { _thisPlayer = (allPlayers select _thisPlayerNum); if (!isNil "_thisPlayer") then { if (alive _thisPlayer) then { if (!(_thisPlayer in myLivePlayers)) then { // executed on Player spawn //waitUntil {alive _thisPlayer}; myLivePlayers = (myLivePlayers + [_thisPlayer]); _thisPlayer setCaptive true; } else { if (!(alive _thisPlayer)) then { // executed on Player death myLivePlayers = (myLivePlayers - [_thisPlayer]); if (_thisPlayer in HostilePlayers) then { TimeLastShot = TimeLastShot - [(TimeLastShot select (HostilePlayers find _thisPlayer))]; HostilePlayers = HostilePlayers - [_thisPlayer]; }; }; }; if ((_checkNewPlayer != (count allPlayers)) and (_thisPlayer in myLivePlayers)) then { _thisPlayer execVM "GW_3_0_PlayerConnected.sqf"; }; _checkNewPlayer = (count allPlayers); }; }; }; sleep 0.1; }; 2. : while {true} do { if ((count allPlayers) > 0) then { if (_checkNewPlayer < (count allPlayers)) then { waitUntil{isNull (allPlayers select ((count allPlayers)-1))} (allPlayers select ((count allPlayers)-1)) execVM "GW_3_1_Main.sqf"; } _checkNewPlayer = (count allPlayers); }; sleep 0.1; }; I would verry much appreciate your help this holds me back for a week now THX in advance
- 12 replies
-
- multiplayer
- server
-
(and 2 more)
Tagged with: