Jump to content

Recommended Posts

Hello everybody,

First of all I want to thank you that you entered to help me :)

So, I'm looking for a script that if someone is not in the Task Force Radio Room it's freezes his player and writes an error that he need to be in the Task Force Radio Room.

 

Thanks very much for helping.

Share this post


Link to post
Share on other sites

This is something I made a while back to check TFAR stuff, I'm no that good at this scripting thing so there's probably a better way of doing it but this might help you out.

// REMOVE DEFAULT A3 ADDONS from _addons
_addons = []; //array to be filled up with all non-arma addons
{
	if (!(["a3_", _x] call BIS_fnc_inString) && !(["curatoronly_", _x] call BIS_fnc_inString)) then {_addons pushBack _x;}
} forEach activatedAddons;
_otherAddons = ["map_vr","3den","core","a3data"];
{
	_addons deleteAt (_addons find _x);
} forEach _otherAddons;

// array with all addons in TFAR and CBA, copied from loading game with these two loaded and getting the _addons array from above code.
_TFARaddons = ["task_force_radio_items","cba_common","cba_events","cba_hashes","cba_keybinding","cba_modules","cba_network","cba_settings","cba_statemachine","cba_strings","cba_ui_helper","cba_vectors","cba_ai","cba_arrays","cba_diagnostic","cba_help","cba_jr_prep","cba_ui","cba_versioning","cba_jr","asdg_jointrails","asdg_jointmuzzles","cba_main","cba_main_a3","cba_xeh","cba_xeh_a3","extended_eventhandlers","cba_extended_eventhandlers","cba_ee","task_force_radio","cba_accessory","mrt_accfncs"];

// check if all items in _TFARaddons is in _addons
_addonCheck = true;
{
	if !(_x in _addons) exitWith {_addonCheck = false};
} forEach _TFARaddons;

// if player is missing some addons then display a warning, warning will stick forever cause player needs to restart Arma.
if !(_addonCheck) exitWith
{
	_warningtxt = format ["You need to have the 'Task Force Radio' and 'CBA' mod loaded to play this mission. Please join our TeamSpeak %1 if you need help.", GD_Set_TSIP];
	[true, _warningtxt] call GD_Fnc_Warning;
};
// check if player is on the right server
if !((call TFAR_fnc_getTeamSpeakServerName) isEqualTo GD_Set_TSServer) then
{
	_warningtxt = format ["You need to be on our teamspeak (%1) to play this mission.", GD_Set_TSIP];
	[true, _warningtxt] call GD_Fnc_Warning;
	waitUntil {(call TFAR_fnc_getTeamSpeakServerName) isEqualTo GD_Set_TSServer};
	[false] call GD_Fnc_Warning;
};
// check if player is in the right channel
_TSChannel = GD_Set_TSChannel;
if (_TSChannel == "") then {_TSChannel = "TaskForceRadio"};
if !((call TFAR_fnc_getTeamSpeakChannelName) isEqualTo GD_Set_TSChannel) then
{
	_warningtxt = format ["You need to be in the right channel (%1) to play this mission. You might need to relog or ask someone for the password.", GD_Set_TSChannel];
	[true, _warningtxt] call GD_Fnc_Warning;
	waitUntil {(call TFAR_fnc_getTeamSpeakChannelName) isEqualTo GD_Set_TSChannel};
	[false] call GD_Fnc_Warning;
};

 

Share this post


Link to post
Share on other sites
7 minutes ago, JSD said:

This is something I made a while back to check TFAR stuff, I'm no that good at this scripting thing so there's probably a better way of doing it but this might help you out.


// REMOVE DEFAULT A3 ADDONS from _addons
_addons = []; //array to be filled up with all non-arma addons
{
	if (!(["a3_", _x] call BIS_fnc_inString) && !(["curatoronly_", _x] call BIS_fnc_inString)) then {_addons pushBack _x;}
} forEach activatedAddons;
_otherAddons = ["map_vr","3den","core","a3data"];
{
	_addons deleteAt (_addons find _x);
} forEach _otherAddons;

// array with all addons in TFAR and CBA, copied from loading game with these two loaded and getting the _addons array from above code.
_TFARaddons = ["task_force_radio_items","cba_common","cba_events","cba_hashes","cba_keybinding","cba_modules","cba_network","cba_settings","cba_statemachine","cba_strings","cba_ui_helper","cba_vectors","cba_ai","cba_arrays","cba_diagnostic","cba_help","cba_jr_prep","cba_ui","cba_versioning","cba_jr","asdg_jointrails","asdg_jointmuzzles","cba_main","cba_main_a3","cba_xeh","cba_xeh_a3","extended_eventhandlers","cba_extended_eventhandlers","cba_ee","task_force_radio","cba_accessory","mrt_accfncs"];

// check if all items in _TFARaddons is in _addons
_addonCheck = true;
{
	if !(_x in _addons) exitWith {_addonCheck = false};
} forEach _TFARaddons;

// if player is missing some addons then display a warning, warning will stick forever cause player needs to restart Arma.
if !(_addonCheck) exitWith
{
	_warningtxt = format ["You need to have the 'Task Force Radio' and 'CBA' mod loaded to play this mission. Please join our TeamSpeak %1 if you need help.", GD_Set_TSIP];
	[true, _warningtxt] call GD_Fnc_Warning;
};
// check if player is on the right server
if !((call TFAR_fnc_getTeamSpeakServerName) isEqualTo GD_Set_TSServer) then
{
	_warningtxt = format ["You need to be on our teamspeak (%1) to play this mission.", GD_Set_TSIP];
	[true, _warningtxt] call GD_Fnc_Warning;
	waitUntil {(call TFAR_fnc_getTeamSpeakServerName) isEqualTo GD_Set_TSServer};
	[false] call GD_Fnc_Warning;
};
// check if player is in the right channel
_TSChannel = GD_Set_TSChannel;
if (_TSChannel == "") then {_TSChannel = "TaskForceRadio"};
if !((call TFAR_fnc_getTeamSpeakChannelName) isEqualTo GD_Set_TSChannel) then
{
	_warningtxt = format ["You need to be in the right channel (%1) to play this mission. You might need to relog or ask someone for the password.", GD_Set_TSChannel];
	[true, _warningtxt] call GD_Fnc_Warning;
	waitUntil {(call TFAR_fnc_getTeamSpeakChannelName) isEqualTo GD_Set_TSChannel};
	[false] call GD_Fnc_Warning;
};

 

Hey mate,

I need to put this code in the 'init'?

Share this post


Link to post
Share on other sites
27 minutes ago, NivZiv said:

Hey mate,

I need to put this code in the 'init'?

You will need to put it in the initPlayerLocal.sqf, though I don't know if anything has changed but I seem to remember something about activatedAddons being deactivated in MP? I may be thinking of something else, but here is another alternative if that is the case (this is untested):

 

0 = [] spawn
{
	waitUntil {time > 1 && !isNull player && !isNull (findDisplay 46)};
	_teamspeakServer = "myTeamSpeakServer";
	_teamspeakChannel = "myTeamSpeakChannel";
	_timeout = 60;
	_timePassed = 0;
	
	_h = [_teamspeakServer,_teamspeakChannel] spawn
	{
		params ["_teamspeakServer","_teamspeakChannel"];
		if (isClass (configFile >> "CfgPathces" >> "task_force_radio")) then
		{
			scopeName "serverCheckScope";
			if !(call TFAR_fnc_getTeamSpeakServerName isEqualTo _teamspeakServer) then
			{
				systemChat format ["Please join the TeamSpeak (%1)!",_teamspeakServer];
				sleep 4;
				breakTo "serverCheckScope";
			} else
			{
				scopeName "channelCheckScope";
				if !(call call TFAR_fnc_getTeamSpeakChannelName isEqualTo _teamspeakChannel) then
				{
					systemChat format["Please join the correct TeamSpeak channel (%1)",_teamspeakChannel];
					sleep 4;
					breakTo "channelCheckScope";
				};
			};
		} else
		{
			systemChat "You must have TFAR loaded to play this mission.";
			sleep 1;
			endMission "end2";
		};
		waitUntil {_timePassed = _timePassed + 1; sleep 1; scriptDone _h || _timePassed >= _timeout;};
		if (_timePassed >= _timeout) then
		{
			systemChat "TFAR check has timed out please make sure to be in the TeamSpeak and the proper channel.";
			sleep 1;
			endMission "end2";
		} else
		{
			systemChat "Welcome to the mission!";
		};
	};
};

 

Share this post


Link to post
Share on other sites

@NivZiv What I put here earlier won't work for you because it uses some things from other scripts, you'd prolly be better off following what jshock said above :p

Share this post


Link to post
Share on other sites
On 6/15/2017 at 0:09 AM, JSD said:

@NivZiv What I put here earlier won't work for you because it uses some things from other scripts, you'd prolly be better off following what jshock said above :p

 

On 6/14/2017 at 10:11 PM, jshock said:

You will need to put it in the initPlayerLocal.sqf, though I don't know if anything has changed but I seem to remember something about activatedAddons being deactivated in MP? I may be thinking of something else, but here is another alternative if that is the case (this is untested):

 


0 = [] spawn
{
	waitUntil {time > 1 && !isNull player && !isNull (findDisplay 46)};
	_teamspeakServer = "myTeamSpeakServer";
	_teamspeakChannel = "myTeamSpeakChannel";
	_timeout = 60;
	_timePassed = 0;
	
	_h = [_teamspeakServer,_teamspeakChannel] spawn
	{
		params ["_teamspeakServer","_teamspeakChannel"];
		if (isClass (configFile >> "CfgPathces" >> "task_force_radio")) then
		{
			scopeName "serverCheckScope";
			if !(call TFAR_fnc_getTeamSpeakServerName isEqualTo _teamspeakServer) then
			{
				systemChat format ["Please join the TeamSpeak (%1)!",_teamspeakServer];
				sleep 4;
				breakTo "serverCheckScope";
			} else
			{
				scopeName "channelCheckScope";
				if !(call call TFAR_fnc_getTeamSpeakChannelName isEqualTo _teamspeakChannel) then
				{
					systemChat format["Please join the correct TeamSpeak channel (%1)",_teamspeakChannel];
					sleep 4;
					breakTo "channelCheckScope";
				};
			};
		} else
		{
			systemChat "You must have TFAR loaded to play this mission.";
			sleep 1;
			endMission "end2";
		};
		waitUntil {_timePassed = _timePassed + 1; sleep 1; scriptDone _h || _timePassed >= _timeout;};
		if (_timePassed >= _timeout) then
		{
			systemChat "TFAR check has timed out please make sure to be in the TeamSpeak and the proper channel.";
			sleep 1;
			endMission "end2";
		} else
		{
			systemChat "Welcome to the mission!";
		};
	};
};

 

Worked for me, thanks guys.

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

×