DerToXXic 0 Posted June 12, 2018 Hello, i wanted to add a missionchange menu with addaction for all admins on the server. (Only admins are blufor) Now I have this script but it doesn't works... Can somebody help me with this? //--- Player init function missionchange_TDM01 = { serverCommand "#login swfadminswf"; waitUntil { serverCommand "#mission TDM_01.Altis" }; serverCommand "#logout"; }; waitUntil { !isNull player }; missionchange_TDM02 = { serverCommand "#login swfadminswf"; waitUntil { serverCommand "#mission TDM_02.Altis" }; serverCommand "#logout"; }; waitUntil { !isNull player }; missionchange_TDM03 = { serverCommand "#login swfadminswf"; waitUntil { serverCommand "#mission TDM_03.Altis" }; serverCommand "#logout"; }; waitUntil { !isNull player }; missionchange_Training = { serverCommand "#login swfadminswf"; waitUntil { serverCommand "#mission SWF_Training.Altis" }; serverCommand "#logout"; }; waitUntil { !isNull player }; //--- Add player action menu if (side player == west) then { sleep 1; menu = [ [ "<img image='\A3\Ui_f\data\IGUI\Cfg\Actions\eject_ca.paa' /> <t color='#E6731A'>Mission wechseln</t>", {}, [], -1, false, false, "", "" ], [ [ "TDM 01", { call missionchange_TDM01 }, [], -1, false, false, "", "" ], [ "TDM 02", { call missionchange_TDM02 }, [], -1, false, false, "", "" ], [ "TDM 03", { call missionchange_TDM03 }, [], -1, false, false, "", "" ], [ "SWF Training's Mission", { call missionchange_Training }, [], -1, false, false, "", "" ] ], ]; [ menu, player, false, 5, [ true, true, true, false ] ] call LARs_fnc_menuStart; }; Share this post Link to post Share on other sites
Harzach 2507 Posted June 12, 2018 What isn't working? Are you not seeing the action? Do the actions appear but not populate the chat field when used? Do the commands not work when entered? Where/when is this script being run? What is "LARs_fnc_menuStart?" 1 Share this post Link to post Share on other sites
HazJ 1288 Posted June 12, 2018 @DerToXXic - You are over complicating it. Just have one addAction with a forEach loop. Nested maybe, containing something like: ["Map Name 001", "MapName001"] { _mapName = _x select 0; _mapID = _x select 1; player addAction [format ["Map: %1", _mapName], { // server commands... // etc... // when loading the map, pass the argument _mapID }, _mapID, 0, false, false, "", ""]; // or use [_mapID, _blah] for multiple arguments (if needed) } forEach ["Map Name 001", "MapName001"]; Should get you started at least. Also! Remove your server admin password! Never add it here or in the mission! https://community.bistudio.com/wiki/server.cfg#serverCommandPassword 1 Share this post Link to post Share on other sites
DerToXXic 0 Posted June 14, 2018 @HazJ How do I add the Mapchange in your script? I have 4 Maps: "TDM_01.Altis" , "TDM_02.Altis" , TDM_03.Altis" , "SWF_Training.Altis Share this post Link to post Share on other sites
HazJ 1288 Posted June 14, 2018 The map goes in the array. { _mapName = _x select 0; _mapID = _x select 1; player addAction [format ["Map: %1", _mapName], { // server commands... // etc... // when loading the map, pass the argument _mapID serverCommand format ["#mission %1", _mapID]; }, _mapID, 0, false, false, "", ""]; // or use [_mapID, _blah] for multiple arguments (if needed) } forEach [["Map Name 001", "MapName001"], ["Map Name 002", "MapName002"], ["Map Name 003", "MapName003"], ["Map Name 004", "MapName004"]]; Not tested. Just a quick rough example. Where are you getting stuck exactly? MapName001, etc is what you replace, the mission file name, omit the .pbo at end. Map Name 001, etc is the name of the map, can be anything, is used for the addAction text. Share this post Link to post Share on other sites
DerToXXic 0 Posted June 14, 2018 Thanks, I will test it in a second... Share this post Link to post Share on other sites
DerToXXic 0 Posted June 14, 2018 if (side player == west) then { sleep 1; { _mapName = _x select 0; _mapID = _x select 1; player addAction [format ["Map: %1", _mapName], { serverCommand format ["#mission %1", _mapID]; // server commands... // etc... // when loading the map, pass the argument _mapID }, _mapID, 0, false, false, "", ""]; // or use [_mapID, _blah] for multiple arguments (if needed) } forEach [["TDM 01", "TDM_01.Altis"], ["TDM 02", "TDM_02.Altis"], ["TDM 03", "TDM_03.Altis"], ["SWF_Training", "SWF_Training.Altis"]]; }; Is it right or did I have to make an admin login before the Mapchange? Share this post Link to post Share on other sites
HazJ 1288 Posted June 15, 2018 Do you have serverCommandPassword set in server configuration file? If no, set it. I recommend you don't do it the same as the main admin password. https://community.bistudio.com/wiki/server.cfg Share this post Link to post Share on other sites
DerToXXic 0 Posted June 15, 2018 Yes, I have a Admin and a serverCommandPassword. Is it possible to make a master addAction, and the mapchange as second menu? So you can open the mastermenu and then you have the mapchanges. Share this post Link to post Share on other sites
Larrow 2801 Posted June 15, 2018 //initServer.sqf TAG_fnc_changeMission = { params[ "_missionName" ]; if ( isNil "_missionName" ) exitWith {}; private _admin = if ( isRemoteExecuted ) then { //Check if the client that remote executed the call is actually an admin if ( admin remoteExecutedOwner > 0 ) then { true }else{ "You are not an admin. Mission change denied" remoteExec[ "systemChat", remoteExecutedOwner ]; false }; }else{ //If not it was called locally, is it hosted !isDedicated }; if !( _admin ) exitWith {}; "yourServerCommandPassword" serverCommand format[ "#mission %1", _missionName ]; }; //initPlayerLocal.sqf waitUntil { time > 0 }; if (side player == west) then { _menu = [ [ "<img image='\A3\Ui_f\data\IGUI\Cfg\Actions\eject_ca.paa' /> <t color='#E6731A'>Mission wechseln</t>", {}, [], -1, false, false, "", "_target isEqualTo _this" ], [ [ "TDM 01", { [ "TDM_01.Altis" ] remoteExec[ "TAG_fnc_changeMission", 2 ] }, [], -1, false, false, "", "_target isEqualTo _this" ], [ "TDM 02", { [ "TDM_02.Altis" ] remoteExec[ "TAG_fnc_changeMission", 2 ] }, [], -1, false, false, "", "_target isEqualTo _this" ], [ "TDM 03", { [ "TDM_03.Altis" ] remoteExec[ "TAG_fnc_changeMission", 2 ] }, [], -1, false, false, "", "_target isEqualTo _this" ], [ "SWF Training's Mission", { [ "SWF_Training.Altis" ] remoteExec[ "TAG_fnc_changeMission", 2 ] }, [], -1, false, false, "", "_target isEqualTo _this" ] ] ]; [ _menu, player, false, 5, [ true, true, true, false ] ] call LARs_fnc_menuStart; }; Although the server function should really be in a server side addon. Otherwise initServer.sqf is transferred to all joining clients inside your mission pbo and people will be able to see your server command password. If your server is not secured properly in what can be remoteExec'ed it is possible people could run server commands knowing this info. 1 Share this post Link to post Share on other sites
DerToXXic 0 Posted June 15, 2018 @Larrow When the admin doesn't logged in, it won't be use the servercommandpassword to make the mapchange. Can you change it? //EDIT: I changed it. Works fine... Share this post Link to post Share on other sites
DerToXXic 0 Posted June 16, 2018 In my TDM Missions I need to make a UID reqest because everybody can join the Blufor Slots. But when I make a UID reqest it doesn't works. _whiteList = ["76561198094190845","76561198137940548","76561198073926928","76561198175437134","76561198155468044"]; // enter ID's here waitUntil {(getPlayerUID player) != ""}; _id = getPlayerUID player; if (_id in _whiteList) then { sleep 1; _menu = [ [ "<img image='\A3\Ui_f\data\IGUI\Cfg\Actions\eject_ca.paa' /> <t color='#E6731A'>Mission wechseln</t>", {}, [], -1, false, false, "", "_target isEqualTo _this" ], [ [ "TDM 02", { [ "TDM_02.Altis" ] remoteExec[ "TAG_fnc_changeMission", 2 ] }, [], -1, false, false, "", "_target isEqualTo _this" ], [ "TDM 03", { [ "TDM_03.Altis" ] remoteExec[ "TAG_fnc_changeMission", 2 ] }, [], -1, false, false, "", "_target isEqualTo _this" ], [ "SWF Training's Mission", { [ "SWF_Training.Altis" ] remoteExec[ "TAG_fnc_changeMission", 2 ] }, [], -1, false, false, "", "_target isEqualTo _this" ] ] true }else{ exitWith {}; }; ]; [ _menu, player, false, 5, [ true, true, true, false ] ] call LARs_fnc_menuStart; Sorry for my bad English... German ;) Share this post Link to post Share on other sites
Larrow 2801 Posted June 16, 2018 You have a error with your brackets if (_id in _whiteList) then { sleep 1; _menu = [ [ "<img image='\A3\Ui_f\data\IGUI\Cfg\Actions\eject_ca.paa' /> <t color='#E6731A'>Mission wechseln</t>", {}, [], -1, false, false, "", "_target isEqualTo _this" ], [ [ "TDM 02", { [ "TDM_02.Altis" ] remoteExec[ "TAG_fnc_changeMission", 2 ] }, [], -1, false, false, "", "_target isEqualTo _this" ], [ "TDM 03", { [ "TDM_03.Altis" ] remoteExec[ "TAG_fnc_changeMission", 2 ] }, [], -1, false, false, "", "_target isEqualTo _this" ], [ "SWF Training's Mission", { [ "SWF_Training.Altis" ] remoteExec[ "TAG_fnc_changeMission", 2 ] }, [], -1, false, false, "", "_target isEqualTo _this" ] ] true }else{ //this exitWith {}; //this }; //this ]; [ _menu, player, false, 5, [ true, true, true, false ] ] call LARs_fnc_menuStart; //<<<<<< should be other side of this should be if (_id in _whiteList) then { sleep 1; _menu = [ [ "<img image='\A3\Ui_f\data\IGUI\Cfg\Actions\eject_ca.paa' /> <t color='#E6731A'>Mission wechseln</t>", {}, [], -1, false, false, "", "_target isEqualTo _this" ], [ [ "TDM 02", { [ "TDM_02.Altis" ] remoteExec[ "TAG_fnc_changeMission", 2 ] }, [], -1, false, false, "", "_target isEqualTo _this" ], [ "TDM 03", { [ "TDM_03.Altis" ] remoteExec[ "TAG_fnc_changeMission", 2 ] }, [], -1, false, false, "", "_target isEqualTo _this" ], [ "SWF Training's Mission", { [ "SWF_Training.Altis" ] remoteExec[ "TAG_fnc_changeMission", 2 ] }, [], -1, false, false, "", "_target isEqualTo _this" ] ] ]; [ _menu, player, false, 5, [ true, true, true, false ] ] call LARs_fnc_menuStart; }else{ exitWith {}; }; Or more logically readable if !(_id in _whiteList) exitWith {}; _menu = [ [ "<img image='\A3\Ui_f\data\IGUI\Cfg\Actions\eject_ca.paa' /> <t color='#E6731A'>Mission wechseln</t>", {}, [], -1, false, false, "", "_target isEqualTo _this" ], [ [ "TDM 02", { [ "TDM_02.Altis" ] remoteExec[ "TAG_fnc_changeMission", 2 ] }, [], -1, false, false, "", "_target isEqualTo _this" ], [ "TDM 03", { [ "TDM_03.Altis" ] remoteExec[ "TAG_fnc_changeMission", 2 ] }, [], -1, false, false, "", "_target isEqualTo _this" ], [ "SWF Training's Mission", { [ "SWF_Training.Altis" ] remoteExec[ "TAG_fnc_changeMission", 2 ] }, [], -1, false, false, "", "_target isEqualTo _this" ] ] ]; [ _menu, player, false, 5, [ true, true, true, false ] ] call LARs_fnc_menuStart; I saw your post last night before you edited it about removing the Hide Menu option. The different menu options are the array of bools in the call to LARs_fnc_menuStart, [ true, true, true, false ] being whether to show the menu options Hide, Home, Back and Remove in that order. Share this post Link to post Share on other sites
DerToXXic 0 Posted June 16, 2018 I'm using this script in my OnPlayerRespawn.sqf but the Menu doesn't visible... _whiteList = ["76561198094190845","76561198137940548","76561198073926928","76561198175437134","76561198155468044"]; // enter ID's here waitUntil {(getPlayerUID player) != ""}; _id = getPlayerUID player; if (_id in _whiteList) then { sleep 1; _menu = [ [ "<img image='\A3\Ui_f\data\IGUI\Cfg\Actions\eject_ca.paa' /> <t color='#E6731A'>Mission wechseln</t>", {}, [], -1, false, false, "", "_target isEqualTo _this" ], [ [ "TDM 01", { [ "TDM_01.Altis" ] remoteExec[ "TAG_fnc_changeMission", 2 ] }, [], -1, false, false, "", "_target isEqualTo _this" ], [ "TDM 02", { [ "TDM_02.Altis" ] remoteExec[ "TAG_fnc_changeMission", 2 ] }, [], -1, false, false, "", "_target isEqualTo _this" ], [ "SWF Training's Mission", { [ "SWF_Training.Altis" ] remoteExec[ "TAG_fnc_changeMission", 2 ] }, [], -1, false, false, "", "_target isEqualTo _this" ] ] ]; [ _menu, player, false, 5, [ true, true, true, false ] ] call LARs_fnc_menuStart; }else{ exitWith {}; }; Share this post Link to post Share on other sites
Larrow 2801 Posted June 16, 2018 params[ "_player", "_oldUnit" ]; _whiteList = ["76561198094190845","76561198137940548","76561198073926928","76561198175437134","76561198155468044"]; // enter ID's here //if on respawnOnStart OR uid not in whitelist - exit if ( isNull _oldUnit || { !( getPlayerUID _player in _whiteList ) } ) exitWith {}; _menu = [ [ "<img image='\A3\Ui_f\data\IGUI\Cfg\Actions\eject_ca.paa' /> <t color='#E6731A'>Mission wechseln</t>", {}, [], -1, false, false, "", "_target isEqualTo _this" ], [ [ "TDM 01", { [ "TDM_01.Altis" ] remoteExec[ "TAG_fnc_changeMission", 2 ] }, [], -1, false, false, "", "_target isEqualTo _this" ], [ "TDM 02", { [ "TDM_02.Altis" ] remoteExec[ "TAG_fnc_changeMission", 2 ] }, [], -1, false, false, "", "_target isEqualTo _this" ], [ "SWF Training's Mission", { [ "SWF_Training.Altis" ] remoteExec[ "TAG_fnc_changeMission", 2 ] }, [], -1, false, false, "", "_target isEqualTo _this" ] ] ]; [ _menu, _player, false, 5, [ true, true, true, false ] ] call LARs_fnc_menuStart; ?? Share this post Link to post Share on other sites
DerToXXic 0 Posted June 16, 2018 Doesn't works params[ "_player", "_oldUnit" ]; _whiteList = ["76561198094190845","76561198137940548","76561198073926928","76561198175437134","76561198155468044"]; // enter ID's here //if on respawnOnStart OR uid not in whitelist - exit if ( isNull _oldUnit || { !( getPlayerUID _player in _whiteList ) } ) exitWith {}; _menu = [ [ "<img image='\A3\Ui_f\data\IGUI\Cfg\Actions\eject_ca.paa' /> <t color='#E6731A'>Mission wechseln</t>", {}, [], -1, false, false, "", "_target isEqualTo _this" ], [ [ "TDM 01", { [ "TDM_01.Altis" ] remoteExec[ "TAG_fnc_changeMission", 2 ] }, [], -1, false, false, "", "_target isEqualTo _this" ], [ "TDM 02", { [ "TDM_02.Altis" ] remoteExec[ "TAG_fnc_changeMission", 2 ] }, [], -1, false, false, "", "_target isEqualTo _this" ], [ "SWF Training's Mission", { [ "SWF_Training.Altis" ] remoteExec[ "TAG_fnc_changeMission", 2 ] }, [], -1, false, false, "", "_target isEqualTo _this" ] ] ]; [ _menu, _player, false, 5, [ true, true, true, false ] ] call LARs_fnc_menuStart; Share this post Link to post Share on other sites
Larrow 2801 Posted June 16, 2018 Works for me TEST_MISSION both host, dedicated with JIP and with/without respawnOnStart. Share this post Link to post Share on other sites
DerToXXic 0 Posted June 16, 2018 Works for me too.. My bad... Can I make a file for the whitelist? Because I have to edit every mission when we have a new admin... Share this post Link to post Share on other sites
Larrow 2801 Posted June 17, 2018 On 16/06/2018 at 4:13 PM, DerToXXic said: Can I make a file for the whitelist? Because I have to edit every mission when we have a new admin... Yes, you will need to... Create a file in the Arma directory on your server that holds your IDs ["2643575674","2523454236"] etc Start your server with -filePatching enabled Use loadFile to access your file and compile it to receive the array of IDs Make your server authoritative by checking for admin status only on the server 1 Share this post Link to post Share on other sites
DerToXXic 0 Posted June 23, 2018 On 17.6.2018 at 9:08 PM, Larrow said: Make your server authoritative by checking for admin status only on the server What do you mean with this? Sorry for my late answer but I hadn't the time for scripting in the last days. Share this post Link to post Share on other sites
Larrow 2801 Posted June 24, 2018 Well if you want to be able to rely on a single file holding the uid's of your admins, that can be updated in one place for all missions, then the file will only ever be able to be in one place, the server. If the file is only ever on the server then checking the uid's locally on a client like the previous scripts is not going to work, or would be very insecure if you allowed it to work that way ( I suppose it depends on the group of people playing on your server, public or trusted group/friends ). So you will need to make your server authoritative, where each client asks for permission from the server ( where it checks the players uid ) before giving said client access to the menu, or automatically on the server through the onPlayerConnected event. Either way the server has absolute say who is and isn't allowed access ( authoritative ) to the menu. Share this post Link to post Share on other sites
DerToXXic 0 Posted June 24, 2018 On 17.6.2018 at 9:08 PM, Larrow said: Make your server authoritative by checking for admin status only on the server How do I make the server authoritative? Unfortunately, I have no idea in this area. Share this post Link to post Share on other sites