{"name":"serverCommandExecutable","operator":null,"title":"serverCommandExecutable","type":"command","url":"https://community.bistudio.com/wiki/serverCommandExecutable","revid":369186,"updated":"2024-09-03T10:34:46Z","groups":["Multiplayer"],"status":"ok","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"1.34"}],"since":{"game":"arma3","name":"Arma 3","version":"1.34"},"arma3_since":"1.34","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Returns true if the serverCommand can be performed on the machine and in this exact environment, otherwise false. serverCommand can be executed only from User Interface Event Handlers, and this command also checks if that's the case.","syntaxes":[{"syntax":"serverCommandExecutable command","since":null,"effect":null,"exec":null,"params":[{"name":"command","type":"String","optional":false,"default":null,"description":"see Multiplayer Server Commands for all available commands","types":["String"],"since":null,"text":"command: String - see Multiplayer Server Commands for all available commands"}],"returns":{"type":"Boolean","types":["Boolean"],"description":null,"text":"Boolean"},"form":"unary","operator":null,"left":null,"right":{"text":"command","types":["String"]}}],"examples":[{"text":"```sqf\n_canKick = serverCommandAvailable \"#kick\";\n```","code":["_canKick = serverCommandAvailable \"#kick\";"]},{"text":"Add button to the main map to lock server, which could only be activated by admin:\n\n```sqf\nwith uiNamespace do {\n    ctrl = findDisplay 12 ctrlCreate [\"RscButton\", -1];\n    ctrl ctrlSetPosition [0, 0, 0.5, 0.1];\n    ctrl ctrlCommit 0;\n    ctrl ctrlSetText \"LOCK SERVER\";\n    ctrl ctrlAddEventHandler [\"ButtonDown\",\n    {    \n        if (serverCommandExecutable \"#lock\") then {\n            serverCommand \"#lock\";\n        } else {\n            hint \"You need to be logged in as admin to do this\";\n        };\n    }];\n};\n```","code":["with uiNamespace do {\n\tctrl = findDisplay 12 ctrlCreate [\"RscButton\", -1];\n\tctrl ctrlSetPosition [0, 0, 0.5, 0.1];\n\tctrl ctrlCommit 0;\n\tctrl ctrlSetText \"LOCK SERVER\";\n\tctrl ctrlAddEventHandler [\"ButtonDown\",\n\t{\t\n\t\tif (serverCommandExecutable \"#lock\") then {\n\t\t\tserverCommand \"#lock\";\n\t\t} else {\n\t\t\thint \"You need to be logged in as admin to do this\";\n\t\t};\n\t}];\n};"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["serverCommand","serverCommandAvailable","Multiplayer Server Commands"],"notes":[],"categories":["Arma 3: New Scripting Commands","Arma 3: Scripting Commands","Command Group: Multiplayer","Introduced with Arma 3 version 1.34","Scripting Commands"]}