CfgDisabledCommands – Arma 3
Killzone Kid (talk | contribs) (→Structure: fixed in 1.84) |
Killzone Kid (talk | contribs) (→Mechanics: warning icon) |
||
Line 8: | Line 8: | ||
==Mechanics== | ==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 [[CfgDisabledCommands#Selecting_Correct_Syntax|later]]). | 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 [[CfgDisabledCommands#Selecting_Correct_Syntax|later]]). | ||
==Indication== | |||
If the [[missionConfigFile | mission config]] contains <tt>CfgDisabledCommands</tt> class and it is not empty, the warning icon will be shown on the title bar of the debug console: | |||
[[Image:cdc_icon.jpg|left|600px]] | |||
==Structure== | ==Structure== |
Revision as of 20:43, 27 October 2018
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 feature has been enabled in the game since Arma 3 v1.66.
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 example targets[] = {1,0,1}; means: enable server, disable client, enable HC.
- args[] - the format is {{leftArgumentType},{rightArgumentType}}. The information about argument types could be retrieved with supportInfo command, but you do not have to do this as you can use CfgDisabledCommand Utility to generate CfgDisabledCommands template. Simply open debug console and type utils 1 then click on LOCAL EXEC (available since Arma 3 v1.67)
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 command page createUnit 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.