Jump to content
Sign in to follow this  
terox

Serverside code: Marker Deletion/creation reporting not working during briefing

Recommended Posts

The following is an edited version of a Killzone kid script which reports who is creating or deleting markers.

The creator of this, made it into a serverside addon and reported it as working in the briefing

I have lightly edited it to run some debug lines and work of cfgfunctions preinit=1, initially it required CBA

This does not work in the briefing, only after Mission start and I cannot figure out why.

eg there is no systemchat messages seen during the briefing either when adding or deleting markers.

Not even the clientside eventhandler systemchats are being seen let alone the PV'd messages

(Tested in a dedi server environment, one client connected)

I would really appreciate some help here.

Many thanks in advance.

Code as follows:

_init = '
if ( !isDedicated ) then {
	a3g_serverbriefing = this;
	[] spawn {
		KK_fnc_collectMrkInfo = { [
			_x,
			markerText _x,
			markerPos _x,
			mapGridPosition markerPos _x,
			markerDir _x,
			markerSize _x,
			markerType _x,
			markerShape _x,
			markerBrush _x,
			markerColor _x,
			markerAlpha _x
		] };
		KK_fnc_setMrkEHs = {
			scopeName "func";
			waitUntil {
				if ( _this == 53 && getClientState == "GAME LOADED" ) then {
					breakOut "func";
				};
				!isNull findDisplay _this
			};
			findDisplay _this displayAddEventHandler [ "KeyDown", {
				if ( _this select 1 == 211 ) then {
					_mrknames = allMapMarkers;
					_mrkdetails = [];
					{
						_mrkdetails pushBack ( _x call KK_fnc_collectMrkInfo );
					} forEach _mrknames;
					0 = [ _mrknames, _mrkdetails ] spawn {
						_mrknames = _this select 0;
						_mrkdetails = _this select 1;
						MrkOpPV = [
							"deleted marker",
							name player,
							getplayerUID player
						];
                                                       // Terox added following debiug line
						systemchat "DEBUG MARKER OPERATION .....  DELETING";
						{
							_i = _mrknames find _x;
							if ( _i > -1 ) then {
								MrkOpPV pushBack ( _mrkdetails select _i );
							};
						} forEach ( _mrknames - allMapMarkers );
						if ( count MrkOpPV > 3 ) then {
							publicVariableServer "MrkOpPV";
						};
					};
					false
				};
			} ];
			findDisplay _this displayAddEventHandler [ "ChildDestroyed", {
				if ( ctrlIdd ( _this select 1 ) == 54 && _this select 2 == 1 ) then {
					0 = all_mrkrs spawn {
						MrkOpPV = [
							"placed marker",
							name player,
							getplayerUID player
						];

                                                       // Terox added following debiug line
						systemchat "DEBUG MARKER OPERATION .....  CREATING";
						{
							MrkOpPV pushBack ( _x call KK_fnc_collectMrkInfo );
						} forEach ( allMapMarkers - _this );
						if ( count MrkOpPV > 3 ) then {
							publicVariableServer "MrkOpPV";
						};
					};
				};
			} ];
			findDisplay _this displayCtrl 51 ctrlAddEventHandler [ "MouseButtonDblClick", {
				0 = 0 spawn {
					if ( !isNull findDisplay 54 ) then {
						findDisplay 54 displayCtrl 1
						buttonSetAction "all_mrkrs = allMapMarkers";
					};
				};
			} ];
		};
		0 = 12 spawn KK_fnc_setMrkEHs;
		0 = 53 spawn KK_fnc_setMrkEHs;
		"a3g_happening" addPublicVariableEventHandler {
			_player = a3g_happening select 1;
			_did = a3g_happening select 0;
			_name = a3g_happening select 3 select 1
                               // Terox edited following line which was originally a globalchat;
			systemchat format [ "____MARKER OPERATION___ : %1 %2 %3", _player, _did, _name ];
		};
	};
};
';
"logic" createUnit [ [ 1, 1, 1 ], ( createGroup sideLogic ), _init, 0.5, "corporal" ];
0 = 0 spawn {
"MrkOpPV" addPublicVariableEventHandler {
	a3g_happening = _this select 1;
	diag_log a3g_happening;
	publicVariable "a3g_happening";
};
};

Edited by Terox

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  

×