Hosting and domain costs until October 2024 have been generously sponsored by dumptruck_ds. Thank you!

Difference between revisions of "localcmd"

From Quake Wiki

(New page: == Function: localcmd == void localcmd (string text) text = text of the command, ended by \ (newline). Execute a command on the server, as if it had been typed on the server's ...)
 
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
''void'' '''localcmd'''(''string'' cmd)
  
== Function: localcmd ==
+
== Usage ==
 +
Executes a command on the server. These should always end with a '''\n''' character in order to execute properly. This can be useful for controlling the flow of the game e.g. changing levels or restarting the game.
  
 +
=== Parameters ===
 +
*''cmd''
 +
:The command the server should run.
  
void localcmd (string text)
+
== Example ==
      text = text of the command, ended by \
+
  // This code restarts the game if everyone has died too many times
  (newline).
+
if (--lives <= 0)
 
+
    localcmd("restart\n");
Execute a command on the server, as if it had been typed on the server's console.
 
 
 
Examples:
 
 
 
  localcmd("restart\
 
");      // restart the level
 
  localcmd("teamplay 1\
 
");  // set deathmatch mode to teamplay
 
  localcmd("killserver\
 
");   // poor server...
 

Latest revision as of 14:52, 1 August 2023

void localcmd(string cmd)

Usage[edit]

Executes a command on the server. These should always end with a \n character in order to execute properly. This can be useful for controlling the flow of the game e.g. changing levels or restarting the game.

Parameters[edit]

  • cmd
The command the server should run.

Example[edit]

// This code restarts the game if everyone has died too many times
if (--lives <= 0)
    localcmd("restart\n");