Jump to content

Recommended Posts

Can one of you nice people make a script for me, i want it to detect if a player in a certain white-list uses the F12 key and in sidechat format message people of another white-list group. I tried but i couldn't get it to work.

Share this post


Link to post
Share on other sites

You realise thats not a small task?

If you are talking about a whitelist?
What sort of Whitelist?

Database?
Plain text?
Player ID? 

 

You need to "define" your problem more. 

Share this post


Link to post
Share on other sites

its just small something like: 

 

 

Check_Me = [""];
_Tell_Me = [""];
publicVariable "_Check_Me";
publicVariable "_Tell_Me";
if (getplayerUID player in _Check_Me) then
{
waituntil {!isnull (finddisplay 46)};
 
(findDisplay 46) displayAddEventHandler ["KeyDown","_this select 1 call MY_KEYDOWN_FNC;false;"];
 
MY_KEYDOWN_FNC = {
switch (_this) do {
 
                //Key F12
case 88: {
if(getplayerUID player in _Tell_Me) then
{
player sideChat "TEST";
};
};  
};
};
 
};
 
Is what i tried to do, im learning C++ in school, thats all I know. I know how to edit files but cant make my own
So it will be user ID

Share this post


Link to post
Share on other sites

sideChat has local effect, so only shows "TEST" string on computer where F12 was pressed. If you want to detect pressing of F12 key remotely you shoud specify another function and call it remotely, e.g. using remoteExec.

Like this:

if (isServer) then {
	Check_Me = [""];
	Tell_Me = [""];
	publicVariable "Check_Me";
	publicVariable "Tell_Me";
}
if (hasInterface) {
	fnc_reportF12 = {
		if ((getPlayerUID player) in Tell_Me) then {
			player sideChat format ["F12 pressed by %1 (UID %2)", _this select 0, _this select 1];
		};
	};

	MY_KEYDOWN_FNC = {
		switch (_this) do {
			 //Key F12
			case 88: {
				[name player, getPlayerUID player] remoteExec ["fnc_reportF12", 0];
			};  
		};
	};

	if ((getPlayerUID player) in Check_Me) then {
		waituntil {!isnull (finddisplay 46)};
		(findDisplay 46) displayAddEventHandler ["KeyDown","(_this select 1) call MY_KEYDOWN_FNC; false;"];
	};
};

Don't forget to allow your report function in CfgRemoteExec

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

×