Jump to content
JR Nova

Script not running on dedicated servers

Recommended Posts

Hello I'm having some trouble making my mission work on dedicated servers. This is the code block which is causing problems

init.sqf

if (isServer) then {
	null=[true] execVM "waves.sqf";
	[] execVM "unlocks.sqf";
	null=[] execVM "support\request_support.sqf";

 	addMissionEventHandler ["EntityKilled", {

  		params ["_killed", "_killer", "_killerID"];

  		if ((isPlayer _killer) && (alive _killer)) then {
  			_killerID = owner _killer;
  			[_killed] remoteExec ["lmo_killMoney", _killerID, false];
  		};
  	}];
};

This works fine on hosted servers, but on dedicated servers none of the code is ran. From my understanding (from this article), isServer should return true for both local hosted MP servers and dedicated servers. Am I doing something wrong?

 

I also tried changing the first line to if (isServer || isDedicated) then {  but the same thing happens, it works on local hosted MP but not on a dedicated server. I honestly have no idea what to do, as I have no dedicated server experience. Any help would be greatly appreciated!

 

Here is a link to the mission on github

Share this post


Link to post
Share on other sites
15 hours ago, JR Nova said:

null=

why? seems useless, you use it in the top and the bottom one, but not in the middle? Its useless.

 

15 hours ago, JR Nova said:

isServer should return true for both local hosted MP servers and dedicated servers.

correct

 

15 hours ago, JR Nova said:

none of the code is ran.

Are you sure that NONE is running? have you tried adding logging?

 

 

https://github.com/novakoda/Alamo/blob/Alamo/Alamo.Altis/init.sqf#L41-L48

compileFinal makes no sense here

 

https://github.com/novakoda/Alamo/blob/Alamo/Alamo.Altis/init.sqf#L95

You are.. on the server waiting that a intro video shot is completed? Server has no AI, Server has no unit, it cannot follow a camera shot, that won't work.

 

https://github.com/novakoda/Alamo/blob/Alamo/Alamo.Altis/init.sqf#L99

There is no player on server

 

Why don't you just put your server-side only code into initServer.sqf? instead of putting it in init.sqf with a isServer check?

 

I would recommend you move your draw3D into a function (to workaround the eventhandler recompile bug) and only use a single Draw3D handler, you are wasting quite some performance there.

 

https://github.com/novakoda/Alamo/blob/Alamo/Alamo.Altis/init.sqf#L57

Don't use the old style eventhandlers, use the new one:

https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/addMissionEventHandler#PlayerDisconnected

 

https://github.com/novakoda/Alamo/blob/Alamo/Alamo.Altis/init.sqf#L51

Server will never get past this, player is never initialized on server.

 

https://github.com/novakoda/Alamo/blob/Alamo/Alamo.Altis/init.sqf#L28-L38

You should ALWAYS prefix your global variables. Like
NOV_twr
and such

 

 

https://github.com/novakoda/Alamo/blob/Alamo/Alamo.Altis/init.sqf#L26

If a Player joins in progress that might mess up your stuff.

 

https://github.com/novakoda/Alamo/blob/Alamo/Alamo.Altis/init.sqf#L5

This is absolute nonsense, player is either always local, or non existend (server)

 

"local player" check never makes sense.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

I would just create a new file called:  initServer.sqf and then place all your server sided stuff into there

  • Like 1

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

×