CfgDisabledCommands – Arma 3
Lou Montana (talk | contribs) m (Lou Montana moved page Arma 3 CfgDisabledCommands to Arma 3: CfgDisabledCommands: Text replacement - "^Arma 3 " to "Arma 3: ") |
Lou Montana (talk | contribs) m (Text replacement - "[[Arma 3 " to "[[Arma 3: ") |
||
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{TOC|side}} | {{TOC|side}} | ||
__NOEDITSECTION__ | __NOEDITSECTION__ | ||
{{GVI| | {{GVI|arma3|1.66}} The '''CfgDisabledCommands''' is a [[Description.ext#CfgDisabledCommands|Description.ext]] class which allows to disable selected scripting commands in a mission. | ||
{{ | {{Feature|important| | ||
It is a powerful tool and can '''make or break''' your game, since some of the default in-game mechanics also uses scripting. | |||
The use of CfgDisabledCommands feature requires advanced knowledge of scripting and should not be attempted unless the mission maker is confident in his abilities and is aware of potential dangers. | |||
}} | |||
== Motivation == | == Motivation == | ||
This powerful feature was developed in an attempt to give mission maker a tool, which allows him to increase security of multiplayer missions against possible hacking and exploits. Many mission makers choose to move important code to server side, however some script commands left on client side may prove it difficult to achieve desired security goal. Disabling them altogether while mission is running could be the answer to some of the common issues. | This powerful feature was developed in an attempt to give mission maker a tool, which allows him to increase security of multiplayer missions against possible hacking and exploits. | ||
Many mission makers choose to move important code to server side, however some script commands left on client side may prove it difficult to achieve desired security goal. | |||
Disabling them altogether while mission is running could be the answer to some of the common issues. | |||
== Mechanics == | == Mechanics == | ||
Commands listed in | Commands listed in {{hl|CfgDisabledCommands}} are disabled on mission start. This means that they are fully available in pre-init phase, therefore allowing mission maker to initialise the mission properly. | ||
{{ | Commands could be disabled on server, clients and HCs separately, giving even more flexibility to mission maker. If command is disabled on client, for example, remote executing it on client from server will have no effect. | ||
Any attempt of using disabled command after mission start will result in error message in .[[rpt]] file, while command itself will be ignored as if it didn't exist. | |||
The disabling is final and cannot be overridden during mission. | |||
Some commands have alternative syntaxes, therefore in order to disable command, the desired syntax has to be indicated (about this [[#Selecting Correct Syntax|later]]). | |||
{{Feature|important|{{hl|CfgDisabledCommands}} impacts both Singleplayer '''and''' Multiplayer. In Singleplayer, the '''client''' setting is used.}} | |||
== Indication == | == Indication == | ||
If the [[missionConfigFile | mission config]] contains | If the [[missionConfigFile|mission config]] contains {{hl|CfgDisabledCommands}} class and it is not empty, the warning icon will be shown on the title bar of the debug console: | ||
[[ | [[File:cdc_icon.jpg|600px]] | ||
Line 34: | Line 43: | ||
class SYNTAX1 | class SYNTAX1 | ||
{ | { | ||
targets[] = {1,0,1}; | targets[] = { 1, 0, 1 }; | ||
args[] = {{"STRING"},{"ARRAY"}}; | args[] = { { "STRING" }, { "ARRAY" } }; | ||
}; | }; | ||
}; | }; | ||
class CREATEVEHICLELOCAL | class CREATEVEHICLELOCAL | ||
{ | { | ||
class SYNTAX1 | class SYNTAX1 | ||
{ | { | ||
targets[] = {1,0,1}; | targets[] = { 1, 0, 1 }; | ||
args[] = {{"STRING"},{"ARRAY"}}; | args[] = { { "STRING" }, { "ARRAY" } }; | ||
}; | }; | ||
}; | }; | ||
Line 50: | Line 60: | ||
As you can see, the structure consists of definition of commands (CREATEUNIT, CREATEVEHICLELOCAL), definition of syntax (args[]) and target locality (targets[]): | As you can see, the structure consists of definition of commands (CREATEUNIT, CREATEVEHICLELOCAL), definition of syntax (args[]) and target locality (targets[]): | ||
* '''targets[]''' - the format is | * '''targets[]''' - the format is <syntaxhighlight lang="cpp" inline>{ enableServer, enableClient ,enableHC }</syntaxhighlight>.<!-- | ||
--> 1 means enable, 0 means disable. From the above example <syntaxhighlight lang="cpp" inline>targets[] = { 1, 0, 1 };</syntaxhighlight> means: enable server, disable client, enable HC. | |||
* '''args[]''' - (Optional) the format is '''{{leftArgumentType},{rightArgumentType}}'''. The information about argument types could be retrieved with [[supportInfo]] command. | * '''args[]''' - (Optional) the format is '''{{leftArgumentType},{rightArgumentType}}'''. The information about argument types could be retrieved with [[supportInfo]] command. | ||
{{ArgTitle|3|CfgDisabledCommands Utility|{{GVI|arma3|1.68}}}} | |||
CfgDisabledCommand Utility can be used to generate [[Arma 3: Utilities#CfgDisabledCommands Template Generator|CfgDisabledCommands template]]. | |||
CfgDisabledCommand Utility can be used to generate [[Arma 3 Utilities#CfgDisabledCommands Template Generator|CfgDisabledCommands template]]. In order to do so, open debug console and type | In order to do so, open debug console and type {{hl|utils 1}} then click on LOCAL EXEC: | ||
[[ | [[File:CfgDisabledCommands.jpg|400px]] | ||
Line 65: | Line 76: | ||
While [[createVehicleLocal]] has only 1 syntax, [[createUnit]] has 2 syntaxes: | While [[createVehicleLocal]] has only 1 syntax, [[createUnit]] has 2 syntaxes: | ||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
// ... | |||
class CREATEUNIT | class CREATEUNIT | ||
{ | { | ||
class SYNTAX1 | class SYNTAX1 | ||
{ | { | ||
targets[] = {1,1,1}; | targets[] = { 1, 1, 1 }; | ||
args[] = {{"STRING"},{"ARRAY"}}; | args[] = { { "STRING" }, { "ARRAY" } }; | ||
}; | }; | ||
class SYNTAX2 | class SYNTAX2 | ||
{ | { | ||
targets[] = {1,1,1}; | targets[] = { 1, 1, 1 }; | ||
args[] = {{"GROUP"},{"ARRAY"}}; | args[] = { { "GROUP" }, { "ARRAY" } }; | ||
}; | }; | ||
}; | }; | ||
// ... | |||
</syntaxhighlight> | </syntaxhighlight> | ||
From | From the [[createUnit]] command page it is obvious that <syntaxhighlight lang="cpp" inline>args[] = { { "STRING" }, { "ARRAY" } };</syntaxhighlight> is the syntax we want to keep as it is the syntax we want to disable since it allows for passed code to be remote executed everywhere, and thus presenting a security issue, so we leave it and delete the other syntax which is harmless in comparison. | ||
For other commands also refer to the respectful command pages. For example, [[setViewDistance]]: | |||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
class CfgDisabledCommands | class CfgDisabledCommands | ||
Line 90: | Line 102: | ||
class SYNTAX1 | class SYNTAX1 | ||
{ | { | ||
targets[] = {1,1,1}; | targets[] = { 1, 1, 1 }; | ||
args[] = {{},{"SCALAR"}}; | args[] = { {}, { "SCALAR" } }; | ||
}; | }; | ||
}; | }; | ||
Line 97: | Line 109: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Note that the command doesn't have left argument, so it is simply replaced with {}. After the correct syntax is selected and other syntaxes are removed, the targets could be configured according to mission design (by default enabled everywhere) | Note that the command doesn't have left argument, so it is simply replaced with <syntaxhighlight lang="cpp" inline>{}</syntaxhighlight>. | ||
After the correct syntax is selected and other syntaxes are removed, the targets could be configured according to mission design (by default enabled everywhere). | |||
If a command doesn't have left arguments, or right arguments the correct syntax is: | If a command doesn't have left arguments, or right arguments the correct syntax is: | ||
Line 105: | Line 118: | ||
class ALLPLAYERS | class ALLPLAYERS | ||
{ | { | ||
targets[] = {1,1,1}; | targets[] = { 1, 1, 1 }; | ||
}; | }; | ||
}; | }; | ||
Line 113: | Line 126: | ||
== Reminder == | == Reminder == | ||
Once again, consider carefully what commands you want to disable and verify that disabling is not interfering with default functionality of the game. Don't forget to check | Once again, consider carefully what commands you want to disable and verify that disabling is not interfering with default functionality of the game. | ||
Don't forget to check [[rpt|.rpt]] file to avoid any confusion in the future. | |||
[[Category:Arma 3 | [[Category:Introduced with Arma 3 version 1.66]] | ||
{{GameCategory|arma3|Remote Execution}} |
Latest revision as of 10:38, 6 May 2024
1.66 The CfgDisabledCommands is a Description.ext class which allows to disable selected scripting commands in a mission.
Motivation
This powerful feature was developed in an attempt to give mission maker a tool, which allows him to increase security of multiplayer missions against possible hacking and exploits. Many mission makers choose to move important code to server side, however some script commands left on client side may prove it difficult to achieve desired security goal. Disabling them altogether while mission is running could be the answer to some of the common issues.
Mechanics
Commands listed in CfgDisabledCommands are disabled on mission start. This means that they are fully available in pre-init phase, therefore allowing mission maker to initialise the mission properly. Commands could be disabled on server, clients and HCs separately, giving even more flexibility to mission maker. If command is disabled on client, for example, remote executing it on client from server will have no effect. Any attempt of using disabled command after mission start will result in error message in .rpt file, while command itself will be ignored as if it didn't exist. The disabling is final and cannot be overridden during mission. Some commands have alternative syntaxes, therefore in order to disable command, the desired syntax has to be indicated (about this later).
Indication
If the mission config contains CfgDisabledCommands class and it is not empty, the warning icon will be shown on the title bar of the debug console:
Structure
Here is an example config, which disables createUnit, the one with remote exec ability, and createVehicleLocal on clients:
class CfgDisabledCommands
{
class CREATEUNIT
{
class SYNTAX1
{
targets[] = { 1, 0, 1 };
args[] = { { "STRING" }, { "ARRAY" } };
};
};
class CREATEVEHICLELOCAL
{
class SYNTAX1
{
targets[] = { 1, 0, 1 };
args[] = { { "STRING" }, { "ARRAY" } };
};
};
};
As you can see, the structure consists of definition of commands (CREATEUNIT, CREATEVEHICLELOCAL), definition of syntax (args[]) and target locality (targets[]):
- targets[] - the format is
{ enableServer, enableClient ,enableHC }
. 1 means enable, 0 means disable. From the above exampletargets[] = { 1, 0, 1 };
means: enable server, disable client, enable HC. - args[] - (Optional) the format is {{leftArgumentType},{rightArgumentType}}. The information about argument types could be retrieved with supportInfo command.
CfgDisabledCommands Utility
CfgDisabledCommand Utility can be used to generate CfgDisabledCommands template. In order to do so, open debug console and type utils 1 then click on LOCAL EXEC:
Selecting Correct Syntax
While createVehicleLocal has only 1 syntax, createUnit has 2 syntaxes:
// ...
class CREATEUNIT
{
class SYNTAX1
{
targets[] = { 1, 1, 1 };
args[] = { { "STRING" }, { "ARRAY" } };
};
class SYNTAX2
{
targets[] = { 1, 1, 1 };
args[] = { { "GROUP" }, { "ARRAY" } };
};
};
// ...
From the createUnit command page it is obvious that args[] = { { "STRING" }, { "ARRAY" } };
is the syntax we want to keep as it is the syntax we want to disable since it allows for passed code to be remote executed everywhere, and thus presenting a security issue, so we leave it and delete the other syntax which is harmless in comparison.
For other commands also refer to the respectful command pages. For example, setViewDistance:
class CfgDisabledCommands
{
class SETVIEWDISTANCE
{
class SYNTAX1
{
targets[] = { 1, 1, 1 };
args[] = { {}, { "SCALAR" } };
};
};
};
Note that the command doesn't have left argument, so it is simply replaced with {}
.
After the correct syntax is selected and other syntaxes are removed, the targets could be configured according to mission design (by default enabled everywhere).
If a command doesn't have left arguments, or right arguments the correct syntax is:
class CfgDisabledCommands
{
class ALLPLAYERS
{
targets[] = { 1, 1, 1 };
};
};
Reminder
Once again, consider carefully what commands you want to disable and verify that disabling is not interfering with default functionality of the game. Don't forget to check .rpt file to avoid any confusion in the future.