Jump to content
Sign in to follow this  
tay-uk

Calling a script just once on server?

Recommended Posts

I have this script, called from the init.sqf with

execVM "intelmover.sqf";

The script moves (attaches) an editor placed intel document to one of 10 editor placed tables, but I have a feeling that in a multiplayer game when each player joins, the intel would be moved to another table, is this the case?

_table = [table1,table2,table3,table4,table5,table6,table7,table8,table9,table10];

_randPos = _table call bis_fnc_selectrandom; 

intel1 attachTo [_randPos,[0,0,0.43]];

How would I ensure that the script is only called once at the beginning of the mission? Any help would be appreciated.

 

Share this post


Link to post
Share on other sites

create a file in the mission root called initServer.sqf and put it in there

Share this post


Link to post
Share on other sites

Thanks for the quick reply both of you, so to clarify, would I put the call line in the initServer.sqf or add the If (isserver) then {execVM " bla"}   around the call in the init.sqf or would either option work?

Share this post


Link to post
Share on other sites

both works.

the only difference is that in method 1 you paste the if(isserver) then { execVM "bla"} in it and it filters out the clients. and with the other method you create a initserver.sqf and just paste execVM "bla" this script is only executed by the server.

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  

×