Registering commands

Registering commands is quick and easy, heres an image of registering console and chat command that both use the same function:

First we call RegisterCommand and define the command in first parameter, if you include "say " in front it will become a chat command


second parameter defines your arguments

you can use any combination you want, "ss" for two strings, "vf" for vector and float..

heres what you can use in the second array:

s -> string

b -> bool (reads 0 and 1 or false and true)

i -> int

f -> float

v -> vector (basically same as 3 floats)

! -> optional marker

Optional marker allows you to define arguments without making them required

use "" for no arguments, "!s" for optional string, "s!s" for one string and one optional string

remember to sanity check the arguments (with GetCount()) if you do use optional marker!


third parameter is the description, you can write whatever you want to write here but its good to use a standard format

AF2/AFB uses format: (argument) for required, for optional

Also you have to manually include the "- " infront in description

for example: "- Test command!", "(string) - Test command!" or " - Test command!"


fourth parameter is the access level required, see ACCESS ENUM for more

you can also "chain" accessflags by using "|", for example ACCESS_E|ACCESS_F requires both flags E and F


fifth parameter is the callback function, remember to include namespace in front of it


sixth parameter is optional, it holds flags for the command (see CMD enum) - you can chain these by using "|"