You are misunderstanding the syntax of onPlayerConnected
. It adds a single string script (that is, a commands inside "") which will be run whenever a player connects. e.g.
playerNames = ;
onPlayerConnected "playerNames = playerNames + [_name]; publicVariable 'playerNames'";
onPlayerDisconnected "playerNames = playerNames - [_name]; publicVariable 'playerNames'";
On the other hand, you don't need to public a variable again when someone JIPs, since they will automatically be synchronised with the last value that was publiced. Thus, you don't need to use onPlayerConnected
for what you are doing.
; set everything to defaults on every machine (overwritten by server using publicVariable later or on JIP).
"3" objStatus "hidden";
"4" objStatus "hidden";
; player will never be set on a dedicated server, so don't do anything more.
? isServer and (isNull player) : exit
; You can't get the group until the player spawns in.
// "group player" is exactly the same as "group leader player"