serverCommandExecutable: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(Created page with "{{Command|= Comments ____________________________________________________________________________________________ | arma3 |= Game name |DEV|= Game version __________________...")
 
m (Replaced <code> with <sqf>)
 
(57 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| arma3 |= Game name
|game1= arma3
|version1= 1.34


|DEV|= Game version
|gr1= Multiplayer
____________________________________________________________________________________________


| Returns [[true]] if the [[serverCommand]] can be performed on the machine and in this exact environment, [[false]]. serverCommand can be executed only from [[User Interface Event Handlers]], and this command also checks if that's the case.
|descr= 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.
|= Description
____________________________________________________________________________________________


| '''serverCommandAvailable''' command |= Syntax
|s1= [[serverCommandExecutable]] command


|p1= command: [[String]] |= Parameter 1
|p1= command: [[String]] - see [[Multiplayer_Server_Commands#Commands|Multiplayer Server Commands]] for all available commands


| [[Boolean]] |= Return value
|r1= [[Boolean]]
____________________________________________________________________________________________
 
|x1 = <code>_can = [[serverCommandAvailable]] "#kick";</code>
|x1= <sqf>_canKick = serverCommandAvailable "#kick";</sqf>
|x2 = Add button to the main map to lock server, which could only be activated by admin:
 
<code>[[with]] [[uiNamespace]] [[do]] {
|x2= Add button to the main map to lock server, which could only be activated by admin:
ctrl = [[findDisplay]] 12 [[ctrlCreate]] ["RscButton", -1];
<sqf>with uiNamespace do {
ctrl [[ctrlSetPosition]] [0,0,0.5,0.1];
ctrl = findDisplay 12 ctrlCreate ["RscButton", -1];
ctrl [[ctrlCommit]] 0;
ctrl ctrlSetPosition [0, 0, 0.5, 0.1];
ctrl [[ctrlSetText]] "LOCK SERVER";
ctrl ctrlCommit 0;
ctrl [[ctrlAddEventHandler]] ["ButtonDown",
ctrl ctrlSetText "LOCK SERVER";
ctrl ctrlAddEventHandler ["ButtonDown",
{
{
[[if]] ([[serverCommandAvailable]] "#lock") [[then]] {
if (serverCommandExecutable "#lock") then {
[[serverCommand]] "#lock";
serverCommand "#lock";
} [[else]] {
} else {
[[hint]] "You need to be logged in as admin to do this";
hint "You need to be logged in as admin to do this";
};
};
}];
}];
};</code>
};</sqf>
| [[serverCommand]], [[serverCommandAvailable]], [[Multiplayer Server Commands]] |= See also


|seealso= [[serverCommand]] [[serverCommandAvailable]] [[Multiplayer Server Commands]]
}}
}}
<h3 style="display:none">Notes</h3>
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section END -->
</dl>
<h3 style="display:none">Bottom Section</h3>
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]
[[Category:ArmA 2: New Scripting Commands List|{{uc:{{PAGENAME}}}}]]

Latest revision as of 16:42, 14 May 2022

Hover & click on the images for description

Description

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.
Groups:
Multiplayer

Syntax

Syntax:
serverCommandExecutable command
Parameters:
command: String - see Multiplayer Server Commands for all available commands
Return Value:
Boolean

Examples

Example 1:
_canKick = serverCommandAvailable "#kick";
Example 2:
Add button to the main map to lock server, which could only be activated by admin:
with uiNamespace do { ctrl = findDisplay 12 ctrlCreate ["RscButton", -1]; ctrl ctrlSetPosition [0, 0, 0.5, 0.1]; ctrl ctrlCommit 0; ctrl ctrlSetText "LOCK SERVER"; ctrl ctrlAddEventHandler ["ButtonDown", { if (serverCommandExecutable "#lock") then { serverCommand "#lock"; } else { hint "You need to be logged in as admin to do this"; }; }]; };

Additional Information

See also:
serverCommand serverCommandAvailable Multiplayer Server Commands

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note