Jump to content
Migal

Block player to join a side in lobby

Recommended Posts

Hi I'm writing a multiplayer mission where partecipating sides that a player can join are selected at mission start.

 

I have a single mission.sqm with 3 platoon (west, east, independent), AI is disabled.

 

Now, In the lobby there are all three side and player can choose over all of them, even the "wrong" one (since this is the default Arma3 behaviour).

 

I tryed but didn't find a way to:

 

- access mission.sqm item and delete the one I don't want (I think this is not possibile).

- I don't want to make multiple mission.sqm with the various combination of sides.

- Try to hide or lock one side in the lobby.

 

I think that one possibility would be to let player choose also the "wrong" side then move it back to lobby with a notification but I prefer to use this option as last resort.

 

Thank you for your help

 

Share this post


Link to post
Share on other sites
On 2/22/2022 at 10:48 AM, Migal said:

I think that one possibility would be to let player choose also the "wrong" side then move it back to lobby with a notification but I prefer to use this option as last resort.


I believe this is the only option as there's no way that I know of to "lock" specific playable slots in the lobby without removing the "playable" option in the editor. I could be wrong though.

 

Larrow showed a similar approach for creating reserved slots in a server in this post, but I'll write out an example that suits your purposes below. I don't have a chance to test it right now, but it should give you a starting point.

 

The following will allow you to restrict specific sides in the multiplayer lobby via the parameters menu. If you prefer, you can change the variables in the initServer.sqf script to take their values from something else.

Description.ext

class Params
{
	class TAG_restrict_BLUFOR
	{
		title = "BLUFOR Restricted";
		values[] = {0,1};
		texts[] = {"No", "Yes"};
		default = 0;
	};
	class TAG_restrict_OPFOR
	{
		title = "OPFOR Restricted";
		values[] = {0,1};
		texts[] = {"No", "Yes"};
		default = 0;
	};
	class TAG_restrict_INDEPENDENT
	{
		title = "INDEPENDENT Restricted";
		values[] = {0,1};
		texts[] = {"No", "Yes"};
		default = 0;
	};
};

class CfgDebriefing
{
	class BLUFOR_NOT_ALLOWED
	{
		title = "BLUFOR IS RESTRICTED";
		description = "Please switch to another team.";
		picture = "";
	};
	class OPFOR_NOT_ALLOWED
	{
		title = "OPFOR IS RESTRICTED";
		description = "Please switch to another team.";
		picture = "";
	};
	class INDEPENDENT_NOT_ALLOWED
	{
		title = "INDEPENDENT IS RESTRICTED";
		description = "Please switch to another team.";
		picture = "";
	};
};

 

InitServer.sqf

TAG_restrict_BLUFOR = ["TAG_restrict_BLUFOR", 0] call BIS_fnc_getParamValue;
TAG_restrict_OPFOR = ["TAG_restrict_OPFOR", 0] call BIS_fnc_getParamValue;
TAG_restrict_INDEPENDENT = ["TAG_restrict_INDEPENDENT", 0] call BIS_fnc_getParamValue;

publicVariable "TAG_restrict_BLUFOR";
publicVariable "TAG_restrict_OPFOR";
publicVariable "TAG_restrict_INDEPENDENT";

 

initPlayerLocal.sqf

params ["_player", "_didJIP"];

switch (side _player) do
{
	case west:
	{
		if (TAG_restrict_BLUFOR == 1) then {endMission "BLUFOR_NOT_ALLOWED"};
	};
	case east:
	{
		if (TAG_restrict_OPFOR == 1) then {endMission "OPFOR_NOT_ALLOWED"};
	};
	case independent:
	{
		if (TAG_restrict_INDEPENDENT == 1) then {endMission "INDEPENDENT_NOT_ALLOWED"};
	};
	default {};
};

 

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

×