ConsoleCommand: Difference between revisions

no edit summary
mNo edit summary
Tag: Source edit
No edit summary
Tag: Source edit
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{MessageBox
{{WarningBox
|bgcolor=#F88
| content = '''Warning:''' ConsoleCommand is dangerous and is flagged for eventual removal over security reasons. It is not advised to use ConsoleCommand in new mods. Details [http://zandronum.com/tracker/view.php?id=1070 here].
|icon=[[File:MedalYouFailIt.png]]
| image = MedalYouFailIt.png
|text='''WARNING:''' ConsoleCommand is dangerous and is flagged for eventual removal over security reasons. It is not advised to use ConsoleCommand in new mods. Details [http://zandronum.com/tracker/view.php?id=1070 here].
| background = FF8888
}}
}}
{{Template:ACSWarning}}
{{Template:ACSWarning}}
void '''ConsoleCommand''' (str ''consolecommand'')
void '''ConsoleCommand''' (str ''consolecommand'')


==Usage==
== Usage ==
 
ConsoleCommand causes the game server to activate the given console command. This can be used to set mod-specific CVARs and other commands that cannot be executed by pure ACS. Only one command can be executed per function call. If the command is used from a CLIENTSIDE script, the local machine will execute the command.
ConsoleCommand causes the game server to activate the given console command. This can be used to set mod-specific CVARs and other commands that cannot be executed by pure ACS. Only one command can be executed per function call. If the command is used from a CLIENTSIDE script, the local machine will execute the command.


Line 30: Line 29:
* crashout
* crashout
* wait
* wait
Aliases and bindings can be managed in a {{Zdoomwiki|KEYCONF}} lump.
Aliases and bindings can be managed in a {{Zdoomwiki|KEYCONF}} lump.


==Notes==
=== Parameters ===
* ''consolecommand'': The string to be executed in the console.


== Notes ==
As of 3.1, if a user has [[Console_Variables|cl_protectcvars]] enabled then any changes made to a CVar's value using this function will not be saved permanently and the CVar's original value will be restored upon exiting the game. In addition, it is possible for [https://zdoom.org/wiki/CVARINFO CVARINFO] to redefine any CVars created using the "set" and "archivecvar" [https://zdoom.org/wiki/CCMDs:Customization CCMDs] with this function, so mods don't have to create new names for them anymore. This is also backwards compatible in case an old version of the mod is loaded afterwards.
As of 3.1, if a user has [[Console_Variables|cl_protectcvars]] enabled then any changes made to a CVar's value using this function will not be saved permanently and the CVar's original value will be restored upon exiting the game. In addition, it is possible for [https://zdoom.org/wiki/CVARINFO CVARINFO] to redefine any CVars created using the "set" and "archivecvar" [https://zdoom.org/wiki/CCMDs:Customization CCMDs] with this function, so mods don't have to create new names for them anymore. This is also backwards compatible in case an old version of the mod is loaded afterwards.


==Examples==
== Examples ==
 
{{noexamples}}
{{noexamples}}


[[category:ACS functions]]
[[Category: ACS functions]]