Skip to content

Latest commit

 

History

History
71 lines (57 loc) · 1.64 KB

README.md

File metadata and controls

71 lines (57 loc) · 1.64 KB

au

Cod 4 (quake c) custom command system for mods

Add custom command plugin system to your mod

  • extract files to au/ directory inside root of mod
     mods/
      ├── mymod/
      │   ├── au/
      │   │  ├── _cmd_handler.gsc
      │   │  ├── _cmd_def.gsc 
      │   │  ├── _utils.gsc
      │   │ 
      │   ├── maps/
      │   ├── mp/
      │   ├── ui/
  • Add following line to init() function of maps/mp/gametypes/_globallogic.gsc
thread au\_cmd_handler::init();

Creating new cmd.

Edit au/_cmd_handler.gsc

  1. Add a function to handle the cmd (preferably at au_cmd_def.gsc ).

    signature: cmd_handler_function(player, cmd){...}

     args:
         player: player entity
         cmd: array
             cmd[0]: cmd_name
             cmd[1]: player entity
             cmd[2 ... n]: optional arguments
    
  2. registercmd in registerCMDS() using cmd_handler_function pointer.

level.registered_cmd[cmd_name] = au\_cmd_def::cmd_handler_function;

Usage

You can invoke the cmd by setting following two Dvars

  • cmdnum : should be used with player slot id argument.
  • cmdnick : should be used with player nickname argument.

General invocation format :

<cmd_name>:<player-id-or-name>:<optional-args-separated-by-colon>
  1. Via rcon
  • To kill player at slot id 0
/rcon set cmdnum kill:0
  • To kill player using name (substr will also work)
/rcon set cmdnick kill:noobmaster69
  1. Via B3
  • Set in customcommands.ini
kill = set cmdnick kill:<PLAYER:NAME>