yokai134 10 Posted July 1, 2016 Hello, I have been trying to create a mission that allows players to join at the start of the mission or the end. I attempted to write a JIP function that when a client joined, the server would send the client the requested variables, but have been unsuccessful in my attempts. I also tried to find examples but many are out of date, for Arma 2 or URLs from forums/sites to others' forums/sites are dead and not leading me anywhere. I was wondering if anyone knew of a tutorial or could help me figure out how to do / handle JIP players. I'm not looking at doing a lot just when a player joins the server at the start or during the mission, the server sends the client needed variables for the mission and best ways of sending variables to/from server/client. I've read that using publicVariable was bad and to use BIS_FNC_MP and vice versa. So any help or direction would be greatly appreciated as the documentation for the Arma scripting language is not all there or is a bit lacking in examples. Thanks Share this post Link to post Share on other sites
kylania 568 Posted July 1, 2016 https://community.bistudio.com/wiki/remoteExec Share this post Link to post Share on other sites
MrCopyright 107 Posted July 1, 2016 Any variables broadcast with the publicVariable command will be sent to future clients upon their connection. And no command is 'bad' unless excessively used. Share this post Link to post Share on other sites
das attorney 858 Posted July 1, 2016 Hello, I have been trying to create a mission that allows players to join at the start of the mission or the end. I attempted to write a JIP function that when a client joined, the server would send the client the requested variables, but have been unsuccessful in my attempts. You should post your attempts up so others can help. Share this post Link to post Share on other sites
yokai134 10 Posted July 1, 2016 Init.sqf if(isServer) then { diag_log "[DEBUG] Starting Mission Server Init"; [] execVM "Server\init.sqf"; }; true spawn { if(!isDedicated) then { titleText ["Please wait for your player to setup", "BLACK", 0]; waitUntil {player == player}; client_initEH = player addEventHandler ["Respawn", {removeAllWeapons (_this select 0);}]; }; }; if(!isDedicated) then { waitUntil {player == player}; _ownedDLCs = getDLCs 1; //if(332350 in _ownedDLCs) then { hasMarksmanDLC = true;}; [] execVM "Client\init.sqf"; }; Client's Init.sqf playerCompiledScripts = false; playerSetupComplete = false; player call compile preprocessFileLineNumbers "Client\PlayerVariables.sqf"; player call compile preprocessFileLineNumbers "Client\PlayerVariableFunctions.sqf"; player call compile preprocessFileLineNumbers "Client\clientCompile.sqf"; waitUntil{playerCompiledScripts}; 0 = ["player","ai","allsides"] execVM "Client\player_markers.sqf"; waitUntil {player == player && !isNil{PlayArea}}; waitUntil {time > 2}; player call playerSetup; waitUntil {playerSetupComplete}; if(!isNil "client_initEH") then {player removeEventHandler ["Respawn", client_initEH];}; player addEventHandler ["Respawn", {[_this] call playerRespawn;}]; player addEventHandler ["Killed", {[_this select 0,_this select 1] call playerKilled;}]; [] execVM "Client\playerHUD.sqf"; PlayerVariableFunctions.sqf // Just one example of PV "PlayArea" addPublicVariableEventHandler { private ["_arr","_pt","_rad"]; _arr = _this select 1; _pt = _arr select 0; _rad = _arr select 1; CenterPoint = _pt; CenterRadius = _rad; } Server Init.sqf call compile preProcessFile "server\functions.sqf"; call compile preProcessFile "server\ai_Functions.sqf"; call compile preProcessFile "server\unitFunctions.sqf"; call compile preProcessFile "server\privateVariables.sqf"; call compile preProcessFile "server\publicVariables.sqf"; call compile preProcessFile "server\publicVariableEventHandlers.sqf"; PlayArea = [Paros,1000]; diag_log "[DEBUG] Broadcasting play area to clients"; publicVariable "PlayArea"; // Rest of setup down here There's some code. I used PV to announce where the mission will be taking place to the client. However if a new client joins later, they don't get the PlayArea variable passed to them even though they have null/nil values set initially. I am not sure if its due to nothing being called OnPlayerConnected perhaps or the client side variable isnt initialized before the server sends it? I can add more of my code I use, but I didn't want to make too long of a reply nor add non-relevant code. Share this post Link to post Share on other sites