1para{god-father} 105 Posted April 21, 2017 I have created a simple dialog , but I only want admin or certain playersID to be able to use it any idea how I can just allow admin's or certain players to have aces to it and link it to a Key ? Thanks Share this post Link to post Share on other sites
M1ke_SK 230 Posted April 21, 2017 if (serverCommandAvailable "#kick") then { //admin only }; or if (getPlayerUID unit in [123456789, 0000000]) { //only player with ID } or in near future (v1.69) use function BIS_fnc_admin https://community.bistudio.com/wiki/BIS_fnc_admin 1 Share this post Link to post Share on other sites
1para{god-father} 105 Posted April 21, 2017 cool thanks Share this post Link to post Share on other sites
pierremgi 4905 Posted April 21, 2017 Even the BI command admin coming soon! Share this post Link to post Share on other sites
1para{god-father} 105 Posted April 21, 2017 OK so a little more help now please :) This is what i have so far , what I am trying to do is if I press f10 I need it to open up my dialog - but not having much luck :( /* ======================================================================================================= ======================================================================================================= */ private [ "_access" ]; _access = false; if ( isMultiplayer ) then { private [ "_uid" ]; _uid = getPlayerUID player; switch ( _uid ) do { case "76561198027698xxxxxx": { _access = true; }; case "76561198027698xxxxx": { _access = true; }; default { _access = false; }; }; } else { _access = true;}; if ( ! _access ) exitWith {}; ////Run My dialog if F10 is pressed run the dialog//// onKeyPress = compile preprocessFile "runthisscript.sqf"; /// run my dialoge waituntil {!(IsNull (findDisplay 46))}; (findDisplay 46) displaySetEventHandler ["KeyDown", "_this call onKeyPress;"]; Share this post Link to post Share on other sites
Larrow 2822 Posted April 22, 2017 #include "\a3\ui_f\hpp\definedikcodes.inc" _adminIDs = [ "76561198027698xxxxxx", "76561198027698xxxxxx" ]; if ( hasInterface && //Client machine { !isMultiplayer || //SP { getPlayerUID player in _adminIDs } || //Predefined admin { serverCommandAvailable "#exportjipqueue" } || //Logged in admin { !isNil { missionNamespace getVariable "BIS_fnc_admin" } && { call BIS_fnc_admin isEqualTo 2 } } //Logged in admin, A3 version 1.70 maybe? } ) then { waitUntil { !isNull ( findDisplay 46 ) }; ( findDisplay 46 ) displayAddEventHandler [ "KeyDown", { params[ "_display", "_keyCode", "_shft", "_ctr", "_alt" ]; if ( _keyCode isEqualTo DIK_F10 ) then { //open display here }; } ]; }; And you can take your pick from the conditions I have added in the IF statement to determine who is an admin. 1 Share this post Link to post Share on other sites
1para{god-father} 105 Posted April 23, 2017 Many thanks for that Awesome ! This is causing a A3 crash #include "a3\ui_f\hpp\definedikcodes.inc" Any idea why it said it is not found? Share this post Link to post Share on other sites
Larrow 2822 Posted April 23, 2017 59 minutes ago, 1para{god-father} said: This is causing a A3 crash #include "a3\ui_f\hpp\definedikcodes.inc" Any idea why it said it is not found? Sorry forgot the backslash in front of a3. Fixed code in previous post. Share this post Link to post Share on other sites
1para{god-father} 105 Posted April 23, 2017 perfect works like a charm :) Share this post Link to post Share on other sites
1para{god-father} 105 Posted April 28, 2017 Hi, To make this work on dedi would i just need to change as below ? , as tried that but still get nothing on dedi when i try i hit f10 !isMultiplayer || //SP to isMultiplayer || Thanks Share this post Link to post Share on other sites
M1ke_SK 230 Posted April 28, 2017 10 minutes ago, 1para{god-father} said: Hi, To make this work on dedi would i just need to change as below ? , as tried that but still get nothing on dedi when i try i hit f10 !isMultiplayer || //SP to isMultiplayer || Thanks isDedicated is your friend https://community.bistudio.com/wiki/isDedicated Share this post Link to post Share on other sites
1para{god-father} 105 Posted April 28, 2017 hmm must be me but still does not work on Dedi ? initplayerlocal.sqf #include "\a3\ui_f\hpp\definedikcodes.inc" _adminIDs = [ "76561198027698xxxxxx", "76561198027698xxxxxx" ]; if ( hasInterface && //Client machine { isDedicated || //Dedi { getPlayerUID player in _adminIDs } || //Predefined admin { serverCommandAvailable "#exportjipqueue" } || //Logged in admin { !isNil { missionNamespace getVariable "BIS_fnc_admin" } && { call BIS_fnc_admin isEqualTo 2 } } //Logged in admin, A3 version 1.70 maybe? } ) then { waitUntil { !isNull ( findDisplay 46 ) }; ( findDisplay 46 ) displayAddEventHandler [ "KeyDown", { params[ "_display", "_keyCode", "_shft", "_ctr", "_alt" ]; if ( _keyCode isEqualTo DIK_F10 ) then { //open display here }; } ]; }; Share this post Link to post Share on other sites
M1ke_SK 230 Posted April 28, 2017 BIS_fnc_admin is not yet in stable branch Share this post Link to post Share on other sites
Larrow 2822 Posted April 28, 2017 8 hours ago, 1para{god-father} said: To make this work on dedi would i just need to change as below ? There should be no need to change anything. Although there maybe a timing issue with player, that could possibly be null right at the beginning. There are other problems I see with using it from the intPlayerLocal.sqf the way you have, that the checks for logged in admin are only ever going to work if the client is logged in as admin before the initPlayerLocal runs. Try changing it around a bit and do the admin check on the key press instead, then if someone logs in as admin during the game it will also work for them... //initPlayerLocal.sqf #include "\a3\ui_f\hpp\definedikcodes.inc" if ( hasInterface ) then { //NOT a headless client //wait for main interface in a scheduler thread //so this does not stop anything else in the initPlayerLocal from initialising _h = [] spawn { //Wait for main display waitUntil { !isNull ( findDisplay 46 ) }; //Add Key event ( findDisplay 46 ) displayAddEventHandler [ "KeyDown", { params[ "_display", "_keyCode", "_shft", "_ctr", "_alt" ]; _adminIDs = [ "76561198027698xxxxxx", "76561198027698xxxxxx" ]; if ( _keyCode isEqualTo DIK_F10 && //F10 pressed { !isMultiplayer || //SP { getPlayerUID player in _adminIDs } || //Predefined admin { serverCommandAvailable "#exportjipqueue" } || //Logged in admin { ( !isNil { missionNamespace getVariable "BIS_fnc_admin" } && { call BIS_fnc_admin isEqualTo 2 } ) } //Logged in admin, A3 version 1.70 maybe? } ) then { //open display here }; } ]; }; }; 8 hours ago, M1ke_SK said: isDedicated is your friend This is not needed as explained above it is a client side dialog. god-fathers wording was misleading as this does not need to run on a dedicated BUT needs to work for a client on a dedicated. 2 hours ago, M1ke_SK said: BIS_fnc_admin is not yet in stable branch That is why the condition first checks if the function is defined before trying to use it. 1 Share this post Link to post Share on other sites