Jump to content
  • 0

Custom dialog closing for players


raymix

Question

Hi guys, long time reader, first time poster.

Sorry to bother ya all, but I've designed a custom dialog, it works for admins, but it shows up for players and instantly closes.

Here's what we are running:

Dayz.st

epoch chernarus

latest Infistar antihack + Battleye filters

 

script:

Script uses code inspired by Krixes bloodbag and Bike/Gyro deploy to check inventory for an item and add scroll menu that opens a dialog.

Dialog consists of listbox and 2 buttons, one button launches function and then closes, other button simply closes dialog.

 

Works like a charm for admins, players get to see the dialog for split second, but it gets closed instantly. No bans, no kicks, no restrictions, no log output.

 

I've read about whitelisting or disabling check on custom dialogs in infistar antihack, but I just can't find where.

 

Best Regards,
Ray

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

Hi Defent, first of all thanks for your contribution, love your EMS 0.3

 

Also here's the dialog part, i've cut out the unnecessary code:

 

fn_selfActions.sqf

_ruby = [currentWeapon player] + (weapons player) + (magazines player);
	if ("ItemRuby" in _ruby) then {
			hasRubyItem = true;
		} else { hasRubyItem = false;};

if((speed player <= 1) && hasRubyItem && _canDo) then {
	if (s_player_rubySpawn < 0) then {
		s_player_rubySpawn = player addaction[("<t color=""#ff00ff"">" + ("Ruby menu") +"</t>"),"test\gems.sqf","",5,false,true,"", ""];
	};
} else {
	player removeAction s_player_rubySpawn;
	s_player_rubySpawn = -1;
};

gems.sqf
 

disableSerialization; 
	createDialog "WGT_DIALOG";
	sleep .1;
//Define idc's for controls for easy access 
_listBoxA = 2666;  

//Add to our lb and combo lists 
{ 
    _index = lbAdd [_listBoxA, _x]; 
} forEach ["ItemMixOil","ItemHotwireKit","ItemComboLock"]; 




dialogs.hpp 
 

class items_list: RscListbox
{
idc = 2666;
style = ST_MULTI;
text = "List of Items";
x = 0.435885 * safezoneW + safezoneX;
y = 0.292182 * safezoneH + safezoneY;
w = 0.228104 * safezoneW;
h = 0.41659 * safezoneH;
tooltip = "Choose Type";
colorSelect[] = {0,0,1,1};
rowHeight = 0.01;
};

class btn_kk: RscButton
{
idc = -1;
text = "Ok";
x = 0.33656 * safezoneW + safezoneX;
y = 0.642718 * safezoneH + safezoneY;
w = 0.0856855 * safezoneW;
h = 0.0209851 * safezoneH;
action= "[] call fnc_Pos_fired;_nil=[]ExecVM ""test\ok.sqf"";closeDialog 0;";
};

ok.sqf (portion removed as players can't get even this far)
 

fnc_Pos_fired = {
_index = lbCurSel 2666; // index of selection
_returnText = lbText [2666, _index]; // name of selection
hint format["BAR : [%1] \n [%2]",_index,_returnText];// display the value
}

As I said, it works perfectly for admins, it also works for normal players, except that Dialog is instantly closed upon opening it.

I will be releasing this to public in few days, just want to make sure it works properly

 

Regards,

Ray

Link to comment
Share on other sites

  • 0

Hi, 

Thanks, I appreciate it :)

I don't see any UID check, this would probably be the simplest way to execute the admin part and keep the non authorized people out of the menu.

if ((getPlayerUID player) in ["0","0"]) exitWith {  //then could also be used
        disableSerialization; 
	createDialog "WGT_DIALOG";
	sleep .1;
//Define idc's for controls for easy access 
_listBoxA = 2666;  
 
//Add to our lb and combo lists 
{ 
    _index = lbAdd [_listBoxA, _x]; 
} forEach ["ItemMixOil","ItemHotwireKit","ItemComboLock"]; 
}
else {
closeDialog 2666; //not sure about this one - the CloseDiaglog works but idk what number
};

The reason admins can see it can also be because Infistar blocks CMD menus etc but makes an exception to this rule if the person is included in the admin list.

Try using a test server and disabling the CMD menu or w/e it is that may block it.

Link to comment
Share on other sites

  • 0

Thanks for swift answer, but I actually want players to access this dialog.

I have disabled CMDmenu check on infistar, but it still blocks it for players for some reason

/*  Check CMDMenus ?      */ _CCM = false;   /* true or false */	/* recommended:  true */	/* only disable this if you know what you are doing. */

That's the thing - I don't want UID check, ItemRuby is in the game, but it is not accessible or obtainable currently in game. The only way to obtain rubies will be trough our own custom events as a reward. This will allow players to participate and get rewarded, which will enable a dialog for them, allowing to exchange ItemRuby for an item added to listbox

 

Thanks again for helping

 

Best Regards,

Ray

Link to comment
Share on other sites

  • 0

Quick update:

I tested with clean server.pbo and it worked.

 

EDIT: spoke too soon. Didn't clean inifstar properly, so I have narrowed this problem down to AH.sqf

 

after commenting out these, it works:
dayz_server/init/server_functions.sqf

//this is at beginning of the file that I didnt notice
[] spawn {[] execVM "\z\addons\dayz_server\init\AH.sqf";};


//this is at the end of this file that confused me, left by guy who edited it previously. Path is obviously wrong, so I deleted this.
#include "AH.sqf";

I've looked at AH.sqf file and can't figure out what is causing this

Link to comment
Share on other sites

  • 0
/*  Check CMDMenus ?      */ _CCM = false;   /* true or false */	/* recommended:  true */	/* only disable this if you know what you are doing. */
/*  BLOCK ALL CMDMenus    */ _BCM = false;   /* true or false */	/* recommended:  true */	/* we don't need commandingMenus. so have this true. */
/*  Check Actions ?       */ _CSA = false;   /* true or false */ /* recommended:  true */ /* if you have custom mousewheel actions you can simply disable this */

Do you have all these on false? - Also you only need to call for AH.sqf once in your server_functions file

Link to comment
Share on other sites

  • 0

Yeah I removed the #include part, probably left over from previous antihack version

 

Also yes, I had those 3 options set on false all this time

I've also just tried to set 

/*  Remove "itemsAdded"   */ _RAI =  false;	/* true or false */	/* recommended:  true */	/* might remove items from a custom crafting system.. */

but it didn't work...

 

Very puzzled here. Gonna be fun reading trough 7766 lines of code in AH.sqf, lol. Might get lucky and find what's causing it.

Link to comment
Share on other sites

  • 0

Fixed it!

Solution was to add my dialog's IDC (10666) into a whitelist that actually looks like a damn blacklist when you look at it.... because of fnc called after statement, wth.

				sleep 0.01;
				if ((isNull (findDisplay 106)) && (isNull (findDisplay 10666)) && (isNull (findDisplay -1)) && (isNull (findDisplay 41144)) 
				&& (isNull (findDisplay 65431)) && (isNull (findDisplay 65432)) && (isNull (findDisplay 65433)) && (isNull (findDisplay 65434)) 
				&& (isNull (findDisplay 65440)) && (isNull (findDisplay 65441)) && (isNull (findDisplay 65442))) then
				{
					closeDialog 0;
				};

EDIT: even better solution is to use -1 instead of IDC on dialogs, this won't require editing AH.

Edited by raymix
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...