Jump to content
Sign in to follow this  
csk222

Help Updating init.sqf into initServer, initPlayerLocal, etc.

Recommended Posts

Hello. I am looking to update an init.sqf file. I want to split the relevant code into init, initServer, and initPlayerLocal. Within the init.sqf there is a code to run a file called "custom.sqf" I need some help sorting that out too.

 

 

init.sqf

///////////////////////////////////////////////////////////////////////////
// BOMSF THOR TASK MANAGEMENT SYSTEM
// By - Cobra [BOMSF] 1949-2014
// cobra@bomsf.com
// http://www.bomsf.com
// You may re-use any of this work as long as you provide credit back to me.
// Edit By - CSK222
// init.sqf
///////////////////////////////////////////////////////////////////////////

// defines
	#define PP preprocessfilelinenumbers
	#define TEG_terrainGrid 12.5
	#define TEG_viewDistance 2500

diag_log "===============BOMSF CLIENT INIT=====================================";

// includes
	#include "teg\lib\common.h"
	#include "tegConfig.sqf"

	TEG_customScripts = true;
	TEG_nvglights = true;
	TEG_gameLength = 180;
	TEG_scoreLimit = 320;

	initFinished = false; 
	gameStarted = false;
	gameOver = false;

	enableSaving [false, false];

	setViewDistance TEG_viewDistance;
	setTerrainGrid TEG_terrainGrid;
	
	
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// It seems that arma needs some time to issue variables to clients, even in editor mode
// Therefore we allow init to complete before spawning off all the stuff we want to do
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Server Side Scripts
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

			
	if (isServer or isDedicated) then
	{
		
		// Virtual Arsenal
		["Preload"] call BIS_fnc_Arsenal;
		
		// Compile preset teg scripts and functions
		[] call compile PP "teg\game_timer.sqf";
		[] call compile PP "teg\score\scoreunits_coop.sqf";
		[] spawn compile PP "teg\clearBodies.sqf";
		[] spawn compile PP "places_mil.sqf";
		
		// BOMSF bPad Setup Vars
		tsklist = []; publicVariable "tsklist"; // [_tskname, _tskmrkr]
		server_1 setVariable ["tskadd","false",true]; // init.sqf trigger for adding Assault Tasks
		server_1 setVariable ["crtdtsk", [], true]; // created task array [tsktype,tskname,tskcnt,targetpos,tskobj]
		server_1 setVariable ["opforadd", "false", true]; // task created opfor AI array [opfortype,opforname,opforgrp,opformrkr,targetpos,dopformrkr]
		server_1 setVariable ["opfornew", [], true]; // task created opfor AI array [opfortype,opforname,opforgrp,opformrkr,targetpos,dopformrkr]
		server_1 setVariable ["regionadd", "false", true]; // regional created opfor AI array [opfortype,opforname,opforgrp,opformrkr,targetpos,dopformrkr]
		server_1 setVariable ["regionnew", [], true]; // regional created opfor AI array [opfortype,opforname,opforgrp,opformrkr,targetpos,dopformrkr]
		server_1 setVariable ["tskcnt",0,true]; // Numbering for naming tasks
		server_1 setVariable ["mrkrcnt",0,true]; // Numbering for naming bPad created vehicles, markers, triggers, and groups
		server_1 setVariable ["combatao",2000,true]; // radius for combat area - leaving cao after activating task will give win to Opfor
		server_1 setVariable ["nrstmrkr",nil,true]; // nearest task marker for adding opfor forces
		
		proMissileActive = false; publicVariable "proMissileActive"; // Proteus Submarine Missile Status
		
		server_1 setVariable ["useNVG",TEG_nvglights,true]; // bPad BOMSF LoadOuts include NVG
		server_1 setVariable ["miMissileActive",proMissileActive,true]; // Proteus Submarine Missile Status
			
		bfvehlist = []; publicVariable "bfvehlist"; // bPad created blufor vehicles array			
			
		// Turn On-Off NVGs in bPad BOMSF LoadOuts and for AI in bpad\LV\militarize.sqf
		server_1 setVariable ["nvgs", "false", true];
		
		//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		// bPad required setups
		//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

		// All Tasks
		[] spawn
		{
			while {TRUE} do
			{
				sleep 3;
				if ((server_1 getVariable "tskadd") == "true") then
				{
					server_1 setVariable ["tskadd","false",true];
					crtdtsk = server_1 getVariable "crtdtsk"; 	// array from task_create.sqf [tsktype,tskname,tskcnt,targetpos,tskobj]
					tsktype = crtdtsk select 0;					// from tsd main dialog (Assault,Defend,SideTask)
					tskname = crtdtsk select 1; 				// tsktype + tskcnt from task_create.sqf
					tskcnt = crtdtsk select 2; 					// incremental from task_create.sqf
					targetpos = crtdtsk select 3; 				// mapclick from task_create.sqf
					tskobj = crtdtsk select 4; 					// SideTask Objective from tsd main dialog (ST1-9) or NONE
					nultskadd = [] spawn {nulct = [tsktype,tskname,tskcnt,targetpos,tskobj] execVM "bPad\tasks\task_add.sqf";};
				};
			};
		};

		// Check for bPad Task AI Opfor Patrol Spawns
		[] spawn
		{
			while {TRUE} do
			{
				sleep 3;
				if ((server_1 getVariable "opforadd") == "true") then
				{
					server_1 setVariable ["opforadd","false",true];
					opforarray = server_1 getVariable "opfornew";
					opfortype = opforarray select 0;
					opforname = opforarray select 1;
					opforgrp = opforarray select 2;
					opformrkr = opforarray select 3;
					targetpos = opforarray select 4;
					dopformrkr = opforarray select 5;
					nulofadd = [] spawn {nuloa = [opfortype,opforname,opforgrp,opformrkr,targetpos,dopformrkr] execVM "bPad\tasks\opfor_add.sqf";};
				};
			};
		};

		// Check for bPad Regional Opfor Patrol Spawns
		[] spawn
		{
			while {TRUE} do
			{
				sleep 3;
				if ((server_1 getVariable "regionadd") == "true") then
				{
					server_1 setVariable ["regionadd","false",true];
					opforarray = server_1 getVariable "regionnew";
					opfortype = opforarray select 0;
					opforname = opforarray select 1;
					opforgrp = opforarray select 2;
					opformrkr = opforarray select 3;
					targetpos = opforarray select 4;
					dopformrkr = opforarray select 5;
					nulregadd = [] spawn {nulregoa = [opfortype,opforname,opforgrp,opformrkr,targetpos,dopformrkr] execVM "bPad\ofr\regional\opfor_region_add.sqf";};
				};
			};
		};
		
		// Set up Markers On Leaders and Vehicles
		[] spawn
		{
			while {TRUE} do
			{
				sleep 5; // 10 original setting
				if (alive blufor1_1) then
				{
					"ofrsp" setMarkerPos position blufor1_1;
				};
				if (alive blufor1_2) then
				{
					"tlrsp" setMarkerPos position blufor1_2;
				};
				if (alive blufor1_3) then
				{
					"slrsp" setMarkerPos position blufor1_3;
				};
				if ((not isNil "sub3") || (not isNull sub3)) then
				{
					"proteusrsp" setMarkerPos [((position sub3) select 0) + 10,((position sub3) select 1) +10,(position sub3) select 2];
				};
				if (alive uh80_alpha) then
				{
					"alpha_chopper" setMarkerPos position uh80_alpha;
				};
				if (alive ch67_bravo) then
				{
					"bravo_chopper" setMarkerPos position ch67_bravo;
				};				
			};
		};
	
		// Check bPad Alpha-Bravo UH80 Move Requests
		[] spawn
		{
			// Set Airborne Server-side default variables
			{
				server_1 setVariable [_x,"false",true];
			} forEach ["abo_ains","abo_a600","abo_aseal","abo_arope","abo_brope","abo_artb","abo_bins","abo_b600","abo_bseal","abo_brtb"];

			private ["_airborne","_str"];
			_airborne = ["abo_ains","abo_a600","abo_aseal","abo_arope","abo_brope","abo_artb","abo_bins","abo_b600","abo_bseal","abo_brtb"];
			while {true} do
			{
				sleep 3;
				for "_i" from 0 to (count _airborne)-1 do
				{
					_str = _airborne select _i;
					if ((server_1 getVariable _str) == "true") then
					{
						server_1 setVariable [_str,"false",true];
						[] spawn compile PP format ["bPad\abo\airborne\%1.sqf",_str];
					};
				};
			};
		};
	
		// Check bPad SealTeam Platform Requests
		[] spawn
		{
			while {TRUE} do
			{
				sleep 3;
				
				if ((server_1 getVariable "stoadd") == "true") then
				{
					server_1 setVariable ["stoadd","false",true];
					targetpos = server_1 getVariable "stopos";
					anchor3 = "Sign_Pointer_F" createVehicle targetpos; publicVariable "anchor3";
					anchor3 setPosASL [targetpos select 0, targetpos select 1, targetpos select 2];
					nulstoadd = [] spawn {nulsp = [targetpos] execVM "bPad\abo\sealteam\sealteam_platform.sqf";};
				};
				if ((server_1 getVariable "stomov") == "true") then
				{
					server_1 setVariable ["stomov","false",true];
					targetpos = server_1 getVariable "stopos";
					anchor3 setPosASL [targetpos select 0, targetpos select 1, targetpos select 2];
					nulstomov = [] spawn {nulspmv = [targetpos] execVM "bPad\abo\sealteam\platform_mobile.sqf";};
				};
			};
		};

		// Periodically MOVE bPad placed Vehicle Markers
		[] spawn
		{
			while {TRUE} do
			{
				sleep 10;

				if (count bfvehlist > 0) then
				{
					{
						bfveh = (_x select 0);
						bfmrkr = (_x select 1);
						if (alive bfveh) then
						{
							bfmrkr setMarkerPos position bfveh;
						} else
						{
							bfvehlist = bfvehlist - [_x]; publicVariable "bfvehlist";
							deleteMarker bfmrkr;
						};
					} forEach bfvehlist;
					publicVariable "bfvehlist";
				};
			};
		};

		// Periodically REMOVE bPad placed Blufor Vehicles
		[] spawn
		{
			while {TRUE} do
			{
				sleep 20;
				if (count bfvehlist > 0) then
				{
					{
						bfveh = (_x select 0);
						bfmrkr = (_x select 1);
						bfArrayInVehicle =[];
						bfArrayInVehicle = crew bfveh;

						if (count bfArrayInVehicle > 0) then
						{
							bfvehlist = bfvehlist; publicVariable "bfvehlist"; // keep vehicle and or marker
						} else
						{
							bfvehactive = [];
							bfvehactive = (position bfveh) nearEntities ["Man", 1400]; // check for veh in active area
							if (count bfvehactive < 1) then
							{
								deleteVehicle bfveh;
								deleteMarker bfmrkr;
								bfvehlist = bfvehlist - [_x];
							};
						};
					} forEach bfvehlist;
					publicVariable "bfvehlist";
				};
			};
		};
	};


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////	
//Ensure we wait for JIP to complete then Save loadout
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


waitUntil {!isNull player && isPlayer player};	

	[] spawn
	{

		// Run a few miscellaneous client-side scripts
		[] spawn compile PP "scripts\zlb_target.sqf"; // laser Target
		//[] spawn compile PP "scripts\zlb_ctarget.sqf"; // cursor Target
		[] spawn compile PP "scripts\tegsf_radio.sqf";	
		[] spawn compile PP "bPad\mop\mission_time.sqf";
		[] spawn compile PP "bPad\mop\mission_weather.sqf"; // Weather Work In Progress	
	
		// Compile LoadOut scripts
		getLoadout = compile PP "fnc_get_loadout.sqf";
		setLoadout = compile PP "fnc_set_loadout.sqf";

		// Save default loadout
		[] spawn
		{
			while{true} do
			{
				sleep 10;
				if(alive player) then
				{
					loadout = [player,["ammo"]] call getLoadout;
				};
			};
		};	

		// BOMSF Customized Revive Medic Markers
		TEG_Revive=true;
		TEG_MedicMarkers=true;

		if (TEG_Revive) then 
		{
			[] spawn compile PP "BSF_revive\BSF_revive_init.sqf";
			if (TEG_MedicMarkers) then { nullmm = [] execVM "BSF_revive\medicMarkers.sqf"; };
		};
	
		// CfgUnitInsignia
		[player,"BOMSF"] call bis_fnc_setUnitInsignia;
	
		//Allow custom scripts to run
		[] spawn compile PP "custom.sqf";

		//Mission Briefing and Diary Records Setup	
		[] spawn
		{			
			if (!isNull player) then
			{
				TEG_Notes=[
				[
				"Mission Designers",
				"BOMSF THOR scripts by Cobra [BOMSF] <br />Edited by CSK222"
				],
				[
				"Objectives",
				"Tasks can be dynamically created by any player, but should be left up to the Group Leaders. Your objective is to clear all enemy forces at each Assault or Defend AO tasks."
				],
				[
				"Server Info",
				"TeamSpeak Server: ts44.gameservers.com:9230 <br />IP Address: 108.61.121.75 Port: 2302 <br/>Website: www.bomsf.enjin.com <br/>Youtube: www.youtube.com/csk222videos <br/><br/>We encourage the use of mods on our server. For a list of allowed mods please visit our website or join our BOMSF Steam Group for easy access to the BOMSF Mod Collection in the Steam Workshop."
				],
				[
				"BOMSF THOR SYSTEM",
				"T.HO.R. (Task Host Opposition Requisition) is a map task management system designed to assist in the conception, design and implementation of task parameters enabling the player or players to execute a variety of tasks.
				<br/><br/>Developed by BOMSF, THOR controls various modules with multiple functions designed to facilitate control of all the mission, asset and opposition parameters. 
				<br/><br/>THOR is a creative tool that empowers the player’s imagination. THOR allows a player or player’s to create tasks, load-outs, transportation, blue force and opposition force squad and technical assets. THOR also allows for the expansion of the task and various assets in real time. Additionally time settings may be altered and support units may be utilized using the THOR systems via an on screen controlled BOMSF Tablet.
				<br/><br/>Features:
				<br/><br/>Everything is done via the tablet.
				<br/><br/>Q. How do you access the tablet?
				<br/>Use the Scroll Wheel (Action Menu) select Operations Tablet or press the Insert (Ins) key.
				<br/><br/>Q. How to set the time of day?
				<br/>Parameters > Choose Time.
				<br/><br/>Q. How to call for transport?
				<br/>Specops > LZ > Click map location for Insertion/Extraction.
				<br/>Specops > RTB > Sends the helicopter back to base.
				<br/><br/>For Insertion there are other choices.
				<br/><br/>Specops > Parajump > Click map location for Insertion via parachute. The helicopter will hover at 600 Meters (Altitude). Wait for it to come to a complete stop and eject. 
				<br/><br/>Specops > Helicast > Click map location for SEAL Team Insertion. The helicopter will hover at 5 Meters (Altitude) over water. Wait for it to come to a complete stop and eject. 
				<br/><br/>Specops > Fastrope > Click map location for Insertion via fast-rope. The helicopter will hover at 20 Meters (Altitude). Wait for it to come to a complete stop > Use the Action Menu, scroll all the way down and select Toss Ropes > Use the Action Menu, select Fastrope. Note: Only 1 person should be in charge of the rope (Usually Group Leader). If the rope is tossed while the helicopter is moving, it can cause a crash. 30 Second timer.
				<br/>Group Leaders also have access to vanilla transport via the supports menu.
				<br/><br/>Q. How to create a blue force vehicle?
				<br/>Vehicles > Choose vehicle > Click map location to spawn your selection.
				<br/><br/>Q. How to recruit blue force squad?
 				<br/>Recruits > Choose Unit. The max number of units is 10.
				<br/><br/>Q. How to move the various insertion points?
				<br/>Set Markers Section on the Main page.
				<br/>Medic Station > Click map location. The medic station is where you respawn if you die (Respawn_West).
				<br/>Alpha, Bravo, Charlie > Click map location. Alpha and Bravo are the helicopter insertion markers but can be used independently. Charlie is just an extra insertion point. 
				<br/><br/>Q. How to teleport to the various insertion points?
				<br/>Use the Scroll Wheel (Action Menu) select Teleport Menu. Select teleport location from the list or click on the map to snap to nearest available location (Map is Interactive).			
				<br/><br/>Q. How to select loadouts?
				<br/>Loadouts > Choose Loadout.
				<br/>Use the Scroll Wheel (Action Menu) select Loadouts Menu. 4 Available choices BOMSF Loadouts will take you to the tablet for preset loadouts or Virtual Arsenal and Virtual Ammobox to create custom loadouts that can be saved and loaded at a later time. You will also have the option to Reammo. Reammo adds one magazine to your inventory. 
				<br/><br/>Q. How to pop smoke?
				<br/>Use the Scroll Wheel (Action Menu) select Pop Smoke. Used sparingly in emergencies, 4-5 smoke grenades provide cover. Note: Can cause major lag.
				<br/><br/>Q. How to call for artillery and air interdiction support?
				<br/>Supports Section on the Main Page.
				<br/><br/>Bolt >  Click map location. Zeus Lightning Bolt used for killing OPFOR that gets stuck in rocks or any situation like that. Can be fun to zap a friend too... DON'T DO IT!
				<br/><br/>CAS > Click map location. A164 Wipeout provides Close Air Support.
				<br/><br/>Artillery > Click map location. Drop artillery.
				<br/><br/>Missile > Click map location. Call in a missile strike from the Proteus Submarine."
				]				
				];
				for "_i" from 1 to (count TEG_Notes) do
				{
					private ["_x"];
					_x = EL(TEG_Notes,count TEG_notes - _i);
					nulnotes = player createDiaryRecord ["Diary",_x];
				};

				nulsub = player createDiarySubject ["HotKeys","Hot Keys"];
			
				nullkys = player createDiaryRecord ["HotKeys", ["BOMSF Operations Tablet", "On screen Controllable Tablet that allows Multiple Functions in game. <br/>INSERT key (INS) to toggle on-off or while open click the Power button."]];
			
				nullkys = player createDiaryRecord ["HotKeys", ["BOMSF Squad Situational Hud", "Mini Map Heads Up Display on the lower right side of screen. <br/>SHIFT + PAGEUP keys to toggle on-off."]];
			
				nullkys = player createDiaryRecord ["HotKeys", ["BOMSF Weapon Resting", "Virtual Bipod that allows you to steady your aim when prone or when near and object. <br/>LEFTCTRL + SPACE keys to toggle on-off or move away from rest position."]];
			
				nullkys = player createDiaryRecord ["HotKeys", ["BOMSF FlightPlan Indicator", "An in game 3D line is drawn on map click location. You must be in 3rd Person to use it. <br/>SHIFT + PAGEDOWN keys to toggle on-off."]];
			
			};
		};
		
		// Welcome message
		[] spawn compile PP "welcome.sqf";	
	};
	

custom.sqf

///////////////////////////////////////////////////////////////////////////
// BOMSF THOR TASK MANAGEMENT SYSTEM
// By - Cobra [BOMSF] 1949-2014
// cobra@bomsf.com
// http://www.bomsf.com
// You may re-use any of this work as long as you provide credit back to me.
// Edit By - CSK222
// custom.sqf
///////////////////////////////////////////////////////////////////////////

///////////////////////////////
// Setup at Game Start
//////////////////////////////

// Player Action Menus
	nulactmenu = [] execVM "scripts\action_menu.sqf";

// Disable Fatigue
	player enableFatigue false; 

// Status Hud
	call compile preprocessFile "status_hud\HUD.sqf";
	[] spawn ICE_HUD; 

//In Game User Placed 3D Markers 
	nul3DMarks = [] execVM "scripts\3Dmarkers.sqf";

// IR Strobe
	nulStrobe = [] execVM "scripts\irstrobe.sqf"; 

// Fast Rope
	nulFastRope = [] execVM "scripts\zlt_fastrope.sqf";
	
// Group Manager
	nulGrpMngr=[] execVM "scripts\group_manager.sqf";
	
///////////////////////////////////////////////////////////////////////////////////////////////
// The following code is join in progress compatible init.sqf scripting.
// Client side scripts should be run in the first two sections
// The first two sections are identical and may appear redundant, but are required for Join in progress compatibility in multiplayer.
// The final section is for server side scripts.
///////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//non-JIP player, someone who's went through role selection and briefing
////////////////////////////////////////////////////////////////////////////////////////////////////

if (!(isNull player)) then
	{

		player addEventHandler ["Respawn", {[player,loadout] call setLoadout;}];
		player addEventHandler ["Respawn", {[player] execVM "scripts\action_menu.sqf";}];
		player addEventhandler ["Respawn", {player enableFatigue false}]; 

		// Player Icons (In Game Map Player Markers)
		//	nulpi = [] execVM "scripts\icons.sqf";
	
		// Player Markers (In Game Map Player Markers)
		nulpm = ["players"] execVM "teg\player_markers.sqf";

		// Scorecard Display
		nulscard = [player] execVM "teg\score\scorecard.sqf";

		// Vehicle Crew Display
		nulcrw = [player] execVM "BSF_crw\bsf_crew.sqf";

		// Squad Hud Display
		nulsqh = [player] execVM "BSF_sqh\sqh_init.sqf";

		// Chopper Map Hud Display
		nulchud = [player] execVM "BSF_chud\chud_init.sqf";

		// BOMSF THOR KEY BIND
		nulthorkey = [player] execVM "bPad\thor_init.sqf";

		// BOMSF Unit Insignia
		[player,"BOMSF"] call BIS_fnc_setUnitInsignia;

	};

///////////////////////////////////////////////////////////////////
//JIP player, role selection then right into mission.
///////////////////////////////////////////////////////////////////

if (!isServer && isNull player) then
	{waitUntil {!isNull player};

		player addEventHandler ["Respawn", {[player,loadout] call setLoadout;}];
		player addEventHandler ["Respawn", {[player] execVM "scripts\action_menu.sqf";}];
		player addEventhandler ["Respawn", {player enableFatigue false}]; 

		// Player Icons (In Game Map Player Markers)
		//nulpi = [] execVM "scripts\icons.sqf";
	
		// Player Markers (In Game Map Player Markers)
		nulpm = ["players"] execVM "teg\player_markers.sqf";

		// Scorecard Display
		nulscard = [player] execVM "teg\score\scorecard.sqf";

		// Vehicle Crew Display
		nulcrw = [player] execVM "BSF_crw\bsf_crew.sqf";

		// Squad Hud Display
		nulsqh = [player] execVM "BSF_sqh\sqh_init.sqf";

		// Chopper Map Hud Display
		nulchud = [player] execVM "BSF_chud\chud_init.sqf";

		// BOMSF THOR KEY BIND
		nulthorkey = [player] execVM "bPad\thor_init.sqf";

		// BOMSF Unit Insignia
		[player,"BOMSF"] call BIS_fnc_setUnitInsignia;

	};

// remove NVG and add Flashlights for enemy AI
if (isServer or isDedicated) then
	{
		{
			if (side _x == east) then
			{
				_x unassignItem "NVGoggles_OPFOR";
				_x removeItem "NVGoggles_OPFOR";
				_x RemovePrimaryWeaponItem "acc_pointer_IR";
				_x addPrimaryWeaponItem "acc_flashlight";
				_x enableGunLights "forceon";
			};
		} foreach allunits;
	};

Thank you in advance for any help/information you may provide.

Share this post


Link to post
Share on other sites

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// Server Side Scripts

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

 

 

Everything beyond this, seems to belong into the initServer.sqf

 

 

The custom.sqf seems to have a mix of server code and client code. I'd suggest to execute that one fromt he init.sqf.

Share this post


Link to post
Share on other sites

Everything works properly as it is. It seems initServer.sqf will be the new init.sqf with the bulk of the code. I just thought some of the code could be spread out across the different init files.

 

I didn't want to move anything around. I don't really understand the following.

 

if (isServer or isDedicated) then <<< Does that mean everything under that goes in initServer.sqf? and if so, do I have to add if (isServer or isDedicated) then at the top of the initServer.sqf?

 

waitUntil {!isNull player && isPlayer player}; <<< Don't know

 

if (!(isNull player)) then <<< Don't know

 

if (!isServer && isNull player) then <<< Don't know
 {waitUntil {!isNull player};

Share this post


Link to post
Share on other sites

 

if (isServer or isDedicated) then <<< Does that mean everything under that goes in initServer.sqf?

This will return true on a local hosted MP or a Dedicated Server, but should still be safe to execute in initServer.sqf.

and if so, do I have to add if (isServer or isDedicated) then at the top of the initServer.sqf?

If it is a check to run on server vs. client, it should not be necessary. If it is code to handle something based on if the MP server is a local host vs. a dedicated server, those checks might be necessary. In the end, it shouldn't hurt to leave them there as the condition should immediately pass, but it is not necessary to leave them in *in most cases*.

waitUntil {!isNull player && isPlayer player}; <<< Don't know

Basically is checking the player has initialized as an object in game, and that the player truely is a player. This is a tricky situation because isServer and isPlayer will return true on local hosted MP games. Therefore this should probably remain in the init.sqf.

 

if (!(isNull player)) then <<< Don't know

Similar to the previous answer.

 

if (!isServer && isNull player) then <<< Don't know

 {waitUntil {!isNull player};

This is checking that the client is not the server, and then waiting until the player object is initialized. Since this is explicitly checking that we are not on a server, this can go in initPlayerLocal.sqf.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×