thedubl 43 Posted October 30, 2015 Hello, If I have a script that is run on the server, is it better to have the a script execVM in the initServer.sqf or the init.sqf with if (isServer) then {}; wrapped around it? Does it even matter? I have seen it done a few ways now and was wondering if it even matters. Travis aka dubl Share this post Link to post Share on other sites
shuko 59 Posted October 30, 2015 I'd say it doesn't matter, but I'm sure smarter people will correct me. That if isserver is/was done because initserver.sqf didnt exist. Share this post Link to post Share on other sites
Kingsley1997 39 Posted October 30, 2015 I think it matters if you need to make sure certain files execute before/after each other. So splitting them up between the two could be problematic and harder to debug. 1 Share this post Link to post Share on other sites
shuko 59 Posted October 30, 2015 Yep https://community.bistudio.com/wiki/Initialization_Order Share this post Link to post Share on other sites
fn_Quiksilver 1636 Posted October 30, 2015 It doesn't matter too much, but it saves locality headache to avoid isServer checks where you can. There's just no reason to use init.sqf anymore except to load deprecated/obsolete/A2 code. In reality, this is all the init structure is: initFunctions.sqf //--- Execute automatic scripts if ((count (supportInfo "n:is3DEN") > 0 && {!is3DEN}) || (count (supportInfo "n:is3DEN") == 0)) then { if (isserver) then { [] execvm "initServer.sqf"; "initServer.sqf" call bis_fnc_logFormat; }; //--- Run mission scripts if !(isDedicated) then { [player,_didJIP] execvm "initPlayerLocal.sqf"; [[[player,_didJIP],"initPlayerServer.sqf"],"bis_fnc_execvm",false,false] call bis_fnc_mp; "initPlayerLocal.sqf" call bis_fnc_logFormat; "initPlayerServer.sqf" call bis_fnc_logFormat; }; 0.90 call bis_fnc_progressloadingscreen; //--- Call postInit functions _fnc_scriptname = "postInit"; { { _time = diag_ticktime; [_x,_didJIP] call { private ["_didJIP","_time"]; ["postInit",_this select 1] call (missionnamespace getvariable (_this select 0)) }; ["%1 (%2 ms)",_x,(diag_ticktime - _time) * 1000] call bis_fnc_logFormat; } foreach _x; } foreach _this; 1.0 call bis_fnc_progressloadingscreen; }; Share this post Link to post Share on other sites
thedubl 43 Posted October 30, 2015 Thanks for the replies.These few scripts aren't anyhting that need to be initailatzed immediately. I noticed that the resvered slots script somethimes allows the unreserverd player to get in a slot. I was think the maybe there is to much in the initServer that might be stepping on it. My though was to have it initalize in the init last. Can you put a sleep in a init to give it a second to initialize? Maybe that is dumb idea. idk. dubl Share this post Link to post Share on other sites
dreadedentity 278 Posted November 1, 2015 initServer.sqf only gets run on the server, so no if (isServer) check is necessary (it really shouldn't be ever anyway, now that this functionality exsists) Share this post Link to post Share on other sites
thedubl 43 Posted November 1, 2015 OK, got it. Well I just learned that my issue has more to do with patch 1.50. I thought maybe it was being stepped on during initialization, which is why I asked the original question. According to what Larrow pointed out in another post and what I read, it needs to have the -filepatching in the start up params and allowedfilepatch = 1; in the server.cfg since the script in question reads a txt file. Although it is still not working with the changes in the start up params and entry in the server.cfg, I think I am on the right path. Thanks for the replies. UPDATE: all is fixed... https://forums.bistudio.com/topic/182520-script-to-lock-out-player-slots/ dubl Share this post Link to post Share on other sites
CrossFireDev 1 Posted November 2, 2015 Yes it matters depends on what script it is also say you have a script like this would need to go in the init server because the barrels our all server side so it would be init server not init you would want to initialize it over the server. Share this post Link to post Share on other sites
csk222 23 Posted November 5, 2015 Somewhat related question: I inherited a mission over a year ago where it only contains an init.sqf file with a customscript.sqf to run other scripts. I would like to update that to the new standard of init.sqf - initserver.sqf - initplayerlocal.sqf. Is there a place/section on the forums or a site to post code where other users can check/review it? Share this post Link to post Share on other sites
thedubl 43 Posted November 5, 2015 Under the ARMA 3 - MISSION EDITING & SCRIPTING section and start a new thread. dubl Share this post Link to post Share on other sites