Jump to content
  • 0

serverside skript - 20 players condition until it starts


Metalfoundry

Question

Hey folks,

 

I´m using a serverside script (Loot crates from Darth_Rogue), it´s awesome, but I want to build in a condition, that it only starts, if more than 20 player are at the server.

 

How can I do it?

 

This doesnt work in the main script file OR the fn_init.sqf:

 

waitUntil {count playableUnits >= 2;};

 

 

I tried it in a separate loadscript.sqf with the code from ZCP capture points AND in the original script file, but it doesnt work for me too..

 

ZCP_Minimum_Online_Players = 3;
waitUntil { count( playableUnits ) > ( ZCP_Minimum_Online_Players - 1 ) };

execVM "\x\addons\a3_custom_crates\content\fn_random_crateLoot.sqf";

 

RPT:

 

 10:09:23 "Starting Custom Crates PBO"
10:09:23 "Starting Custom Crates PBO"
10:09:23 Suspending not allowed in this context
10:09:23 Error in expression <= 3;
waitUntil { count( playableUnits ) > ( ZCP_Minimum_Online_Players - 1 ) };
>
10:09:23   Error position: <> ( ZCP_Minimum_Online_Players - 1 ) };
>
10:09:23   Error Generic error in expression
10:09:23 File x\addons\a3_custom_crates\content\fn_random_crateLoot.sqf, line 19
10:09:23 "Altis-specific settings loaded"
10:09:23 "[crateLoot.sqf] --- >>> worldname is altis"
10:09:23 "_fn_spawnCrate [4575,15423,3.8], 0, false, false"
10:09:23 "Static crates loaded successfully!"

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Suspending not allowed in this context

 

You cannot use sleep, uisleep, or waituntil in a nonscheduled environment, KillZoneKid:Arma Scripting Tutorials: Code Performance

 

fn_init.sqf

diag_log format ["Starting Custom Addons PBO"];

[] spawn {
		waitUntil {uiSleep 0.2;(count playableUnits) >= 2;};
		call compile preprocessFileLineNumbers "\x\addons\a3_custom_crates\content\fn_random_crateLoot.sqf";
		diag_log format ["Starting fn_random_crateLoot, player count: %1",(count playableUnits)];
	};
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...