Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  

Recommended Posts

I have a Target Range setup in ArmA2 for my Battlions Bootcamp, in ArmA1 we could shoot the targets and after the cycle of targets it would tell us each lanes score. In arma2 it cycles the targets we shoot them now it won't post the scores in sideChat any ideas why?

_targetTime = _this select 0;

if (not RangeRunning) then
{
rangeRunning = true;

playSound "voice1";

Hits_Lane1 = 0;
Hits_Lane2 = 0;
Hits_Lane3 = 0;
Hits_Lane4 = 0;
Hits_Lane5 = 0;
Hits_Lane6 = 0;

if (isServer) then
{
	sleep 5.5;

	_i = 0;
	while {_i < 10} do
	{
		_target = [1, 6] call CSL_GetRandomInteger;

		switch (_target) do
		{
			case 1:
			{
				_eh = t50_1  addeventhandler ["hit", {Hits_Lane1 = Hits_Lane1 + 1; _this select 0 setDamage 0;}];
				_eh = t50_2  addeventhandler ["hit", {Hits_Lane2 = Hits_Lane2 + 1; _this select 0 setDamage 0;}];
				_eh = t50_3  addeventhandler ["hit", {Hits_Lane3 = Hits_Lane3 + 1; _this select 0 setDamage 0;}];
				_eh = t50_4  addeventhandler ["hit", {Hits_Lane4 = Hits_Lane4 + 1; _this select 0 setDamage 0;}];
				_eh = t50_5  addeventhandler ["hit", {Hits_Lane5 = Hits_Lane5 + 1; _this select 0 setDamage 0;}];
				_eh = t50_6  addeventhandler ["hit", {Hits_Lane6 = Hits_Lane6 + 1; _this select 0 setDamage 0;}];

				t50_1  animate["terc",0];
				t50_2  animate["terc",0];
				t50_3  animate["terc",0];
				t50_4  animate["terc",0];
				t50_5  animate["terc",0];
				t50_6  animate["terc",0];
			};
			case 2:
			{
				_eh = t75_1  addeventhandler ["hit", {Hits_Lane1 = Hits_Lane1 + 1; _this select 0 setDamage 0;}];
				_eh = t75_2  addeventhandler ["hit", {Hits_Lane2 = Hits_Lane2 + 1; _this select 0 setDamage 0;}];
				_eh = t75_3  addeventhandler ["hit", {Hits_Lane3 = Hits_Lane3 + 1; _this select 0 setDamage 0;}];
				_eh = t75_4  addeventhandler ["hit", {Hits_Lane4 = Hits_Lane4 + 1; _this select 0 setDamage 0;}];
				_eh = t75_5  addeventhandler ["hit", {Hits_Lane5 = Hits_Lane5 + 1; _this select 0 setDamage 0;}];
				_eh = t75_6  addeventhandler ["hit", {Hits_Lane6 = Hits_Lane6 + 1; _this select 0 setDamage 0;}];

				t75_1  animate["terc",0];
				t75_2  animate["terc",0];
				t75_3  animate["terc",0];
				t75_4  animate["terc",0];
				t75_5  animate["terc",0];
				t75_6  animate["terc",0];
			};
			case 3:
			{
				_eh = t100_1  addeventhandler ["hit", {Hits_Lane1 = Hits_Lane1 + 1; _this select 0 setDamage 0;}];
				_eh = t100_2  addeventhandler ["hit", {Hits_Lane2 = Hits_Lane2 + 1; _this select 0 setDamage 0;}];
				_eh = t100_3  addeventhandler ["hit", {Hits_Lane3 = Hits_Lane3 + 1; _this select 0 setDamage 0;}];
				_eh = t100_4  addeventhandler ["hit", {Hits_Lane4 = Hits_Lane4 + 1; _this select 0 setDamage 0;}];
				_eh = t100_5  addeventhandler ["hit", {Hits_Lane5 = Hits_Lane5 + 1; _this select 0 setDamage 0;}];
				_eh = t100_6  addeventhandler ["hit", {Hits_Lane6 = Hits_Lane6 + 1; _this select 0 setDamage 0;}];

				t100_1 animate["terc",0];
				t100_2 animate["terc",0];
				t100_3 animate["terc",0];
				t100_4 animate["terc",0];
				t100_5 animate["terc",0];
				t100_6 animate["terc",0];
			};
			case 4:
			{
				_eh = t125_1  addeventhandler ["hit", {Hits_Lane1 = Hits_Lane1 + 1; _this select 0 setDamage 0;}];
				_eh = t125_2  addeventhandler ["hit", {Hits_Lane2 = Hits_Lane2 + 1; _this select 0 setDamage 0;}];
				_eh = t125_3  addeventhandler ["hit", {Hits_Lane3 = Hits_Lane3 + 1; _this select 0 setDamage 0;}];
				_eh = t125_4  addeventhandler ["hit", {Hits_Lane4 = Hits_Lane4 + 1; _this select 0 setDamage 0;}];
				_eh = t125_5  addeventhandler ["hit", {Hits_Lane5 = Hits_Lane5 + 1; _this select 0 setDamage 0;}];
				_eh = t125_6  addeventhandler ["hit", {Hits_Lane6 = Hits_Lane6 + 1; _this select 0 setDamage 0;}];

				t125_1 animate["terc",0];
				t125_2 animate["terc",0];
				t125_3 animate["terc",0];
				t125_4 animate["terc",0];
				t125_5 animate["terc",0];
				t125_6 animate["terc",0];
			};
			case 5:
			{
				_eh = t150_1  addeventhandler ["hit", {Hits_Lane1 = Hits_Lane1 + 1; _this select 0 setDamage 0;}];
				_eh = t150_2  addeventhandler ["hit", {Hits_Lane2 = Hits_Lane2 + 1; _this select 0 setDamage 0;}];
				_eh = t150_3  addeventhandler ["hit", {Hits_Lane3 = Hits_Lane3 + 1; _this select 0 setDamage 0;}];
				_eh = t150_4  addeventhandler ["hit", {Hits_Lane4 = Hits_Lane4 + 1; _this select 0 setDamage 0;}];
				_eh = t150_5  addeventhandler ["hit", {Hits_Lane5 = Hits_Lane5 + 1; _this select 0 setDamage 0;}];
				_eh = t150_6  addeventhandler ["hit", {Hits_Lane6 = Hits_Lane6 + 1; _this select 0 setDamage 0;}];

				t150_1 animate["terc",0];
				t150_2 animate["terc",0];
				t150_3 animate["terc",0];
				t150_4 animate["terc",0];
				t150_5 animate["terc",0];
				t150_6 animate["terc",0];
			};
			case 6:
			{
				_eh = t200_1  addeventhandler ["hit", {Hits_Lane1 = Hits_Lane1 + 1; _this select 0 setDamage 0;}];
				_eh = t200_2  addeventhandler ["hit", {Hits_Lane2 = Hits_Lane2 + 1; _this select 0 setDamage 0;}];
				_eh = t200_3  addeventhandler ["hit", {Hits_Lane3 = Hits_Lane3 + 1; _this select 0 setDamage 0;}];
				_eh = t200_4  addeventhandler ["hit", {Hits_Lane4 = Hits_Lane4 + 1; _this select 0 setDamage 0;}];
				_eh = t200_5  addeventhandler ["hit", {Hits_Lane5 = Hits_Lane5 + 1; _this select 0 setDamage 0;}];
				_eh = t200_6  addeventhandler ["hit", {Hits_Lane6 = Hits_Lane6 + 1; _this select 0 setDamage 0;}];

				t200_1 animate["terc",0];
				t200_2 animate["terc",0];
				t200_3 animate["terc",0];
				t200_4 animate["terc",0];
				t200_5 animate["terc",0];
				t200_6 animate["terc",0];
			};
		};//switch (_target) do

		sleep _targetTime;

		switch (_target) do
		{
			case 1:
			{
				t50_1  animate["terc",1];
				t50_2  animate["terc",1];
				t50_3  animate["terc",1];
				t50_4  animate["terc",1];
				t50_5  animate["terc",1];
				t50_6  animate["terc",1];
			};
			case 2:
			{
				t75_1  animate["terc",1];
				t75_2  animate["terc",1];
				t75_3  animate["terc",1];
				t75_4  animate["terc",1];
				t75_5  animate["terc",1];
				t75_6  animate["terc",1];
			};
			case 3:
			{
				t100_1 animate["terc",1];
				t100_2 animate["terc",1];
				t100_3 animate["terc",1];
				t100_4 animate["terc",1];
				t100_5 animate["terc",1];
				t100_6 animate["terc",1];
			};
			case 4:
			{
				t125_1 animate["terc",1];
				t125_2 animate["terc",1];
				t125_3 animate["terc",1];
				t125_4 animate["terc",1];
				t125_5 animate["terc",1];
				t125_6 animate["terc",1];
			};
			case 5:
			{
				t150_1 animate["terc",1];
				t150_2 animate["terc",1];
				t150_3 animate["terc",1];
				t150_4 animate["terc",1];
				t150_5 animate["terc",1];
				t150_6 animate["terc",1];
			};
			case 6:
			{
				t200_1 animate["terc",1];
				t200_2 animate["terc",1];
				t200_3 animate["terc",1];
				t200_4 animate["terc",1];
				t200_5 animate["terc",1];
				t200_6 animate["terc",1];
			};
		};//switch (_target) do

		sleep 1;

		t50_1  removeAllEventHandlers "hit";
		t50_2  removeAllEventHandlers "hit";
		t50_3  removeAllEventHandlers "hit";
		t50_4  removeAllEventHandlers "hit";
		t50_5  removeAllEventHandlers "hit";
		t50_6  removeAllEventHandlers "hit";
		t75_1  removeAllEventHandlers "hit";
		t75_2  removeAllEventHandlers "hit";
		t75_3  removeAllEventHandlers "hit";
		t75_4  removeAllEventHandlers "hit";
		t75_5  removeAllEventHandlers "hit";
		t75_6  removeAllEventHandlers "hit";
		t100_1 removeAllEventHandlers "hit";
		t100_2 removeAllEventHandlers "hit";
		t100_3 removeAllEventHandlers "hit";
		t100_4 removeAllEventHandlers "hit";
		t100_5 removeAllEventHandlers "hit";
		t100_6 removeAllEventHandlers "hit";
		t125_1 removeAllEventHandlers "hit";
		t125_2 removeAllEventHandlers "hit";
		t125_3 removeAllEventHandlers "hit";
		t125_4 removeAllEventHandlers "hit";
		t125_5 removeAllEventHandlers "hit";
		t125_6 removeAllEventHandlers "hit";
		t150_1 removeAllEventHandlers "hit";
		t150_2 removeAllEventHandlers "hit";
		t150_3 removeAllEventHandlers "hit";
		t150_4 removeAllEventHandlers "hit";
		t150_5 removeAllEventHandlers "hit";
		t150_6 removeAllEventHandlers "hit";
		t200_1 removeAllEventHandlers "hit";
		t200_2 removeAllEventHandlers "hit";
		t200_3 removeAllEventHandlers "hit";
		t200_4 removeAllEventHandlers "hit";
		t200_5 removeAllEventHandlers "hit";
		t200_6 removeAllEventHandlers "hit";

		_i = _i + 1;

	}; //while {_i < 10} do

	t50_1  animate["terc",1];
	t50_2  animate["terc",1];
	t50_3  animate["terc",1];
	t50_4  animate["terc",1];
	t50_5  animate["terc",1];
	t50_6  animate["terc",1];
	t75_1  animate["terc",1];
	t75_2  animate["terc",1];
	t75_3  animate["terc",1];
	t75_4  animate["terc",1];
	t75_5  animate["terc",1];
	t75_6  animate["terc",1];
	t100_1 animate["terc",1];
	t100_2 animate["terc",1];
	t100_3 animate["terc",1];
	t100_4 animate["terc",1];
	t100_5 animate["terc",1];
	t100_6 animate["terc",1];
	t125_1 animate["terc",1];
	t125_2 animate["terc",1];
	t125_3 animate["terc",1];
	t125_4 animate["terc",1];
	t125_5 animate["terc",1];
	t125_6 animate["terc",1];
	t150_1 animate["terc",1];
	t150_2 animate["terc",1];
	t150_3 animate["terc",1];
	t150_4 animate["terc",1];
	t150_5 animate["terc",1];
	t150_6 animate["terc",1];
	t200_1 animate["terc",1];
	t200_2 animate["terc",1];
	t200_3 animate["terc",1];
	t200_4 animate["terc",1];
	t200_5 animate["terc",1];
	t200_6 animate["terc",1];


	_scores = "player sideChat '";

	if ((count list Lane1ShootingArea) > 0) then {_scores = format["%1Lane 1 %2 hits. ", _scores, Hits_Lane1];};
	if ((count list Lane2ShootingArea) > 0) then {_scores = format["%1Lane 2 %2 hits. ", _scores, Hits_Lane2];};
	if ((count list Lane3ShootingArea) > 0) then {_scores = format["%1Lane 3 %2 hits. ", _scores, Hits_Lane3];};
	if ((count list Lane4ShootingArea) > 0) then {_scores = format["%1Lane 4 %2 hits. ", _scores, Hits_Lane4];};
	if ((count list Lane5ShootingArea) > 0) then {_scores = format["%1Lane 5 %2 hits. ", _scores, Hits_Lane5];};
	if ((count list Lane6ShootingArea) > 0) then {_scores = format["%1Lane 6 %2 hits. ", _scores, Hits_Lane6];};

	_scores = format["%1';", _scores];

	//player sideChat _scores;

	ChatLogic = "Logic" createVehicle [random 100, random 100];
	ChatLogic setVehicleInit _scores;

	processInitCommands;

	rangeRunning = false;
	publicVariable "rangeRunning";

};//if (isServer) then




};//if (not rangeRunning) then


sleep 30;

deleteVehicle ChatLogic;

Share this post


Link to post
Share on other sites
Sign in to follow this  

×