Commands

Summary
Commands
Variables
cmds.optionalThis is used when specifying an argument to flag the argument as optional.
cmds.restrictToCompletesThis is used when specifying a string argument to flag that only what was specified for autocomplete is allowed to be passed as a valid argument.
cmds.takeRestOfLineThis is used when specifying a string argument to flag that this argument should use up any remaining args, whether quoted as one arg or not.
cmds.roundThis is used when specifying a number argument to flag the argument to round the number to the nearest integer.
cmds.ignoreCanTargetThis is used when specifying a command that should ignore the can_target property in the groups config.
cmds.allowTimeStringThis is used when specyfing a number argument that should allow time string representations to be parsed (eg, ‘1w1d’ for 1 week 1 day).
cmds.BaseArgJust defines the basics for us, used in autocomplete and command callbacks.
Functions
cmds.BaseArg:parseAndValidateUsed to, you guessed it, parse and validate an argument specified by a user.
cmds.BaseArg:completeUsed to autocomplete a command.
cmds.BaseArg:usagePrints a basic usage message for this parameter.
cmds.NumArgA number arg, inherits from cmds.BaseArg.
Functions
cmds.NumArg:processRestrictionsA helper function to help us figure out restrictions on this command.
cmds.NumArg:parseAndValidateSee <cmds.BaseArg:parseAndValidate>
cmds.NumArg:completeSee <cmds.BaseArg:complete>
cmds.NumArg:usageSee <cmds.BaseArg:usage>
cmds.BoolArgA boolean arg, inherits from cmds.BaseArg.
Functions
cmds.BoolArg:processRestrictionsA helper function to help us figure out restrictions on this command.
cmds.BoolArg:parseAndValidateSee <cmds.BaseArg:parseAndValidate>
cmds.BoolArg:completeSee <cmds.BaseArg:complete>
cmds.BoolArg:usageSee <cmds.BaseArg:usage>
cmds.PlayerArgA player arg, inherits from cmds.BaseArg.
Functions
cmds.PlayerArg:processRestrictionsA helper function to help us figure out restrictions on this command.
cmds.PlayerArg:parseAndValidateSee <cmds.BaseArg:parseAndValidate>
cmds.PlayerArg:completeSee <cmds.BaseArg:complete>
cmds.PlayerArg:usageSee <cmds.BaseArg:usage>
cmds.PlayersArgA table of players arg, inherits from cmds.PlayerArg.
Functions
cmds.PlayersArg:parseAndValidateSee <cmds.PlayerArg:parseAndValidate>
cmds.PlayersArg:usageSee <cmds.PlayerArg:usage>
cmds.CallingPlayerArgSimply used to retrieve the player using the command.
Functions
cmds.CallingPlayerArg:parseAndValidateSee <cmds.BaseArg:parseAndValidate>
cmds.StringArgA player arg, inherits from cmds.BaseArg.
Functions
cmds.StringArg:processRestrictionsA helper function to help us figure out restrictions on this command.
cmds.StringArg:parseAndValidateSee <cmds.BaseArg:parseAndValidate>
cmds.StringArg:completeSee <cmds.BaseArg:complete>
cmds.StringArg:usageSee <cmds.BaseArg:usage>
Tables
cmds.translatedCmdsHolds all the commands that are set up through the translator.
cmds.TranslateCommandOffers an abstraction on the “console command” concept.
Functions
cmds.TranslateCommand:instantiate
cmds.TranslateCommand:addParamAdd an argument to this command.
cmds.TranslateCommand:setOppositeSet the command opposite for this command.
cmds.TranslateCommand:getUsage
cmds.TranslateCommand:callThis is just a pass-through function for calling the function callback.
cmds.TranslateCommand:defaultAccess
cmds.getCommandTableAndArgvTransforms a command and argument list as passed by the source engine into a ULib command table.
cmds.executeGiven a ULib command table and the information to pass to the command callback, execute the command.
cmds.addCommandYou must run this function on BOTH client AND server.  This function is very similar to garry’s concommand.Add() function with a few key differences.
cmds.addCommandClientExactly like cmds.addCommand, except it will expect the callback to be run on the local client instead of the server.

Variables

cmds.optional

cmds.optional

This is used when specifying an argument to flag the argument as optional.

cmds.restrictToCompletes

cmds.restrictToCompletes

This is used when specifying a string argument to flag that only what was specified for autocomplete is allowed to be passed as a valid argument.

cmds.takeRestOfLine

cmds.takeRestOfLine

This is used when specifying a string argument to flag that this argument should use up any remaining args, whether quoted as one arg or not.  This is useful for things like specifying a ban reason where you don’t want to force users to write an entire sentence within quotes.

cmds.round

cmds.round

This is used when specifying a number argument to flag the argument to round the number to the nearest integer.

cmds.ignoreCanTarget

cmds.ignoreCanTarget

This is used when specifying a command that should ignore the can_target property in the groups config.  IE, private say in ULX uses this so that users can target admins to chat with them.

cmds.allowTimeString

cmds.allowTimeString

This is used when specyfing a number argument that should allow time string representations to be parsed (eg, ‘1w1d’ for 1 week 1 day).

cmds.BaseArg

Just defines the basics for us, used in autocomplete and command callbacks.  These default implementations just throw an error if called.  You shouldn’t need any great knowledge about the functions in these types, just that they exist and how to pass in restrictions.

Revisions

2.40Initial
Summary
Functions
cmds.BaseArg:parseAndValidateUsed to, you guessed it, parse and validate an argument specified by a user.
cmds.BaseArg:completeUsed to autocomplete a command.
cmds.BaseArg:usagePrints a basic usage message for this parameter.

Functions

cmds.BaseArg:parseAndValidate

function cmds.BaseArg:parseAndValidate(ply,
arg,
cmdInfo,
plyRestrictions)

Used to, you guessed it, parse and validate an argument specified by a user.  Takes user command line input and converts it to a regular lua variable of the correct type.

Parameters

plyThe player using the command.  Useful for querying.
argThe arg to parse.  It’s already properly trimmed.
cmdInfoA table containing data about this command.
plyRestrictionsThe restrictions from the access tag for this player.

Returns

The parsed arg correctly typed if it validated, false and an explanation otherwise.

cmds.BaseArg:complete

function cmds.BaseArg:complete(arg,
cmdInfo,
plyRestrictions)

Used to autocomplete a command.  Passes back the options the player has in using this command.

Parameters

argThe arg to parse.  It’s already properly trimmed.
cmdInfoA table containing data about this command.
plyRestrictionsThe restrictions from the access tag for this player.

Returns

A table of strings containing the options that are available.

cmds.BaseArg:usage

function cmds.BaseArg:usage(cmdInfo,
plyRestrictions)

Prints a basic usage message for this parameter.

Parameters

cmdInfoA table containing data about this command.
plyRestrictionsThe restrictions from the access tag for this player.

Returns

A string describing what this parameter is and how to use it.

cmds.NumArg

A number arg, inherits from cmds.BaseArg.  Restrictions can include a numeric value for keys ‘min’, ‘max’, and ‘default’.  All do what you think they do.  If the argument is optional and no default is specified, 0 is used for default.  You can specify the allowTimeString key to allow time string representations.  Lastly, you can specify a value for the key ‘hint’ for a hint on what this argument is for, IE “damage”.

Example

The following code creates a command that accepts an optional numeric second argument that defaults to 0 and has to be at least 0.

cmd = ULib.cmds.TranslateCommand( "ugm slap", ULib.slap )
cmd:addParam{ type=ULib.cmds.PlayerArg, target="*", default="^", ULib.cmds.optional }
cmd:addParam{ type=ULib.cmds.NumArg, min=0, default=0, ULib.cmds.optional }

Revisions

2.40Initial
Summary
Functions
cmds.NumArg:processRestrictionsA helper function to help us figure out restrictions on this command.
cmds.NumArg:parseAndValidateSee <cmds.BaseArg:parseAndValidate>
cmds.NumArg:completeSee <cmds.BaseArg:complete>
cmds.NumArg:usageSee <cmds.BaseArg:usage>

Functions

cmds.NumArg:processRestrictions

function cmds.NumArg:processRestrictions(cmdRestrictions,
plyRestrictions)

A helper function to help us figure out restrictions on this command.

cmds.NumArg:parseAndValidate

function cmds.NumArg:parseAndValidate(ply,
arg,
cmdInfo,
plyRestrictions)

See <cmds.BaseArg:parseAndValidate>

cmds.NumArg:complete

function cmds.NumArg:complete(ply,
arg,
cmdInfo,
plyRestrictions)

See <cmds.BaseArg:complete>

cmds.NumArg:usage

function cmds.NumArg:usage(cmdInfo,
plyRestrictions)

See <cmds.BaseArg:usage>

cmds.BoolArg

A boolean arg, inherits from cmds.BaseArg.  You can specify a value for the key ‘hint’ for a hint on what this argument is for, IE “revoke access”.

Example

The following code creates a command that accepts an option boolean third argument that defaults to false.

local groupallow = ULib.cmds.TranslateCommand( "ulx groupallow", ulx.groupallow )
groupallow:addParam{ type=ULib.cmds.StringArg }
groupallow:addParam{ type=ULib.cmds.StringArg }
groupallow:addParam{ type=ULib.cmds.BoolArg, hint="revoke access", ULib.cmds.optional }

Revisions

2.40Initial
Summary
Functions
cmds.BoolArg:processRestrictionsA helper function to help us figure out restrictions on this command.
cmds.BoolArg:parseAndValidateSee <cmds.BaseArg:parseAndValidate>
cmds.BoolArg:completeSee <cmds.BaseArg:complete>
cmds.BoolArg:usageSee <cmds.BaseArg:usage>

Functions

cmds.BoolArg:processRestrictions

function cmds.BoolArg:processRestrictions(cmdRestrictions,
plyRestrictions)

A helper function to help us figure out restrictions on this command.

cmds.BoolArg:parseAndValidate

function cmds.BoolArg:parseAndValidate(ply,
arg,
cmdInfo,
plyRestrictions)

See <cmds.BaseArg:parseAndValidate>

cmds.BoolArg:complete

function cmds.BoolArg:complete(ply,
arg,
cmdInfo,
plyRestrictions)

See <cmds.BaseArg:complete>

cmds.BoolArg:usage

function cmds.BoolArg:usage(cmdInfo,
plyRestrictions)

See <cmds.BaseArg:usage>

cmds.PlayerArg

A player arg, inherits from cmds.BaseArg.  Can be restricted by specifying a string in the key ‘target’.  This string is passed to getUser() with keywords enabled to get a list of players this user is allowed to target.

Example

The following code creates a command that accepts an optional player argument that defaults to self and cannot be any superadmins.

cmd = ULib.cmds.TranslateCommand( "ugm slap", ULib.slap )
cmd:addParam{ type=ULib.cmds.PlayerArg, target="!%superadmin", default="^", ULib.cmds.optional }
cmd:addParam{ type=ULib.cmds.NumArg, min=0, default=0, ULib.cmds.optional }

Revisions

2.40Initial
Summary
Functions
cmds.PlayerArg:processRestrictionsA helper function to help us figure out restrictions on this command.
cmds.PlayerArg:parseAndValidateSee <cmds.BaseArg:parseAndValidate>
cmds.PlayerArg:completeSee <cmds.BaseArg:complete>
cmds.PlayerArg:usageSee <cmds.BaseArg:usage>

Functions

cmds.PlayerArg:processRestrictions

function cmds.PlayerArg:processRestrictions(ply,
cmdRestrictions,
plyRestrictions)

A helper function to help us figure out restrictions on this command.

cmds.PlayerArg:parseAndValidate

function cmds.PlayerArg:parseAndValidate(ply,
arg,
cmdInfo,
plyRestrictions)

See <cmds.BaseArg:parseAndValidate>

cmds.PlayerArg:complete

function cmds.PlayerArg:complete(ply,
arg,
cmdInfo,
plyRestrictions)

See <cmds.BaseArg:complete>

cmds.PlayerArg:usage

function cmds.PlayerArg:usage(cmdInfo,
plyRestrictions)

See <cmds.BaseArg:usage>

cmds.PlayersArg

A table of players arg, inherits from cmds.PlayerArg.  Can be restricted by specifying a string in the key ‘target’.  This string is passed to getUsers() with keywords enabled to get a list of players this user is allowed to target.

Revisions

2.40Initial
Summary
Functions
cmds.PlayersArg:parseAndValidateSee <cmds.PlayerArg:parseAndValidate>
cmds.PlayersArg:usageSee <cmds.PlayerArg:usage>

Functions

cmds.PlayersArg:parseAndValidate

function cmds.PlayersArg:parseAndValidate(ply,
arg,
cmdInfo,
plyRestrictions)

See <cmds.PlayerArg:parseAndValidate>

cmds.PlayersArg:usage

function cmds.PlayersArg:usage(cmdInfo,
plyRestrictions)

See <cmds.PlayerArg:usage>

cmds.CallingPlayerArg

Simply used to retrieve the player using the command.  No validation needed.

Revisions

2.40Initial
Summary
Functions
cmds.CallingPlayerArg:parseAndValidateSee <cmds.BaseArg:parseAndValidate>

Functions

cmds.CallingPlayerArg:parseAndValidate

function cmds.CallingPlayerArg:parseAndValidate(ply,
arg,
cmdInfo,
plyRestrictions)

See <cmds.BaseArg:parseAndValidate>

cmds.StringArg

A player arg, inherits from cmds.BaseArg.  You can specify completes with a table of strings for the key ‘completes’.  Can be restricted to these by specifying ULib.cmds.restrictToCompletes.  Can also specify ULib.cmds.takeRestOfLine to make it take up the rest of the command line arguments.  ‘autocomplete_fn’ can be specified with the value of a function to call for autocompletes (this is an override).  Can specify a value for the key ‘repeat_min’ when the argument repeats at least n times (this implies ULib.cmds.takeRestOfLine).  Though it’s not (currently) used by ULib, you can also specify ‘repeat_max’ to mean that the argument repeats at most n times.  Lastly, you can specify a value for the key ‘hint’ for a hint on what this argument is for, IE “groupname”.

Example

The following code creates a command that accepts a first argument that is restricted to a list of strings, this same list is also used for autocompletes.  A descriptive error is provided if they specify an invalid group.

local groupallow = ULib.cmds.TranslateCommand( "ulx groupallow", ulx.groupallow )
groupallow:addParam{ type=ULib.cmds.StringArg, completes=ulx.group_names, hint="group", error="invalid group \"%s\" specified", ULib.cmds.restrictToCompletes }

Revisions

2.40Initial
Summary
Functions
cmds.StringArg:processRestrictionsA helper function to help us figure out restrictions on this command.
cmds.StringArg:parseAndValidateSee <cmds.BaseArg:parseAndValidate>
cmds.StringArg:completeSee <cmds.BaseArg:complete>
cmds.StringArg:usageSee <cmds.BaseArg:usage>
Tables
cmds.translatedCmdsHolds all the commands that are set up through the translator.

Functions

cmds.StringArg:processRestrictions

function cmds.StringArg:processRestrictions(cmdRestrictions,
plyRestrictions)

A helper function to help us figure out restrictions on this command.

cmds.StringArg:parseAndValidate

function cmds.StringArg:parseAndValidate(ply,
arg,
cmdInfo,
plyRestrictions)

See <cmds.BaseArg:parseAndValidate>

cmds.StringArg:complete

function cmds.StringArg:complete(ply,
arg,
cmdInfo,
plyRestrictions)

See <cmds.BaseArg:complete>

cmds.StringArg:usage

function cmds.StringArg:usage(cmdInfo,
plyRestrictions)

See <cmds.BaseArg:usage>

Tables

cmds.translatedCmds

Holds all the commands that are set up through the translator.  I won’t bother explaining the contents here, just inspect them with PrintTable.

cmds.TranslateCommand

Offers an abstraction on the “console command” concept.  Think of this class as a translator sitting between the user and your program.  You tell this translator what arguments and types you’re expecting from the user and the translator handles the rest.

If the user tries to use a command with the incorrect number or wrong type of args, the translator informs the user of the problem and suggests how to fix it.  If the user has everything correct, the translator calls the callback with the correctly typed and validated arguments.

Revisions

v2.40Initial
Summary
Functions
cmds.TranslateCommand:instantiate
cmds.TranslateCommand:addParamAdd an argument to this command.
cmds.TranslateCommand:setOppositeSet the command opposite for this command.
cmds.TranslateCommand:getUsage
cmds.TranslateCommand:callThis is just a pass-through function for calling the function callback.
cmds.TranslateCommand:defaultAccess
cmds.getCommandTableAndArgvTransforms a command and argument list as passed by the source engine into a ULib command table.
cmds.executeGiven a ULib command table and the information to pass to the command callback, execute the command.
cmds.addCommandYou must run this function on BOTH client AND server.  This function is very similar to garry’s concommand.Add() function with a few key differences.
cmds.addCommandClientExactly like cmds.addCommand, except it will expect the callback to be run on the local client instead of the server.

Functions

cmds.TranslateCommand:instantiate

function cmds.TranslateCommand:instantiate(cmd,
fn,
say_cmd,
hide_say,
no_space_in_say,
unsafe)

Parameters

cmdThe command you’re creating.  IE, “ulx slap”.
fn(Optional on client since it’s ignored) The function callback for this command.  The callback receives the arguments you specify.
say_cmd(Optional) Specify a say command or commands (as a table) to be tied in.
hide_say(Optional, defaults to false) Hide the chat when the say command is used?
no_space_in_say(Optional, defaults to false) Is a space between the chat command and arguments required?
unsafe(Optional, defaults to false) Flag for ULib.execString, which disallows execution from untrusted config.

cmds.TranslateCommand:addParam

function cmds.TranslateCommand:addParam(t)

Add an argument to this command.  See the types above for more usage info.

Parameters

tA table containing the information on this argument.

cmds.TranslateCommand:setOpposite

function cmds.TranslateCommand:setOpposite(cmd,
args,
say_cmd,
hide_say,
no_space_in_say)

Set the command opposite for this command.  IE, if the main command is “jail”, the opposite might be “unjail”.  The same callback is called for both “jail” and “unjail”.  The parameters passed to this function specify required values for arguments passed to the callback.  Any nil values still allow any valid values from the user.  Automatically sets default access to be the same as the “non-opposite” command.

Parameters

cmdThe name of the command for this opposite.  IE, “unjail”.
argsThe args to restrict or allow, in order.
say_cmd(Optional) Specify a say command to be tied in.
hide_say(Optional, defaults to false) Hide the chat when the say command is used?
no_space_in_say(Optional, defaults to false) Is a space between the chat command and arguments required?

Example

This sets the opposite to “unjail”, where the first parameter can still be any valid value, but the second value must be 0.

myCmd:setOpposite( "unjail", { _, 0 }, "!unjail" )

cmds.TranslateCommand:getUsage

function cmds.TranslateCommand:getUsage(ply)

Parameters

plyThe player wanting the usage information.  Used for player adding restriction info in the usage statement.

Returns

A string of the usage information for this command.

cmds.TranslateCommand:call

function cmds.TranslateCommand:call(isOpposite,
...)

This is just a pass-through function for calling the function callback.  If you want to modify the behavior of TranslateCommand on the callback, this is the place to do it.  For example, ULX overrides this to add logging info.

Parameters

isOppositeIs this the opposite command that’s being called?
...The args that will be passed to the function callback.

cmds.TranslateCommand:defaultAccess

function cmds.TranslateCommand:defaultAccess(access)

Parameters

accessThe group or groups that should have access to this command by default.

cmds.getCommandTableAndArgv

function cmds.getCommandTableAndArgv(commandName,
argv,
valveErrorCorrection)

Transforms a command and argument list as passed by the source engine into a ULib command table.

Parameters

commandNameThe string top-level command.  IE, “ulx”.
argvThe argument list, as a list of strings.
valveErrorCorrectionAn optional boolean of whether to correct for source engine command line mangling.

Returns

1The command table, as contained in ULib.cmds.routedCmds.  If none found, returns nil.
2The final computed command name
3The argv table, stripped of ULX command portions.

Revisions

v2.62Initial

cmds.execute

function cmds.execute(cmdTable,
ply,
commandName,
argv)

Given a ULib command table and the information to pass to the command callback, execute the command.  Also routes server commands appropriately and executes ULib command hooks.

Parameters

cmdTableThe command table, internal to ULib.
plyThe player calling the command.
commandNameThe string of the command name.
argvThe argument list, as a list of strings.

Revisions

v2.62Initial

cmds.addCommand

function cmds.addCommand(cmd,
fn,
autocomplete,
access_string,
say_cmd,
hide_say,
no_space_in_say,
unsafe)

You must run this function on BOTH client AND server.  This function is very similar to garry’s concommand.Add() function with a few key differences.

First, this function supports commands with spaces in the name.  IE, “ulx slap” is handled just like you’d think it ought to be.

Second, autocompletes for spaced commands work similar to how the default autocomplete in console works.  IE, if you type “ulx sl” into the console, you’ll see all commands starting with that (“ulx slap”, “ulx slay”).

Third, it will automatically tie in chat commands.

Parameters

cmdThe command you’re creating.  IE, “ulx slap”.
fn(Optional on clients since it’s ignored) The function callback for this command.  The callback receives the same parameters as a callback from concommand.Add() does.  This parameter is ignored on clients.
autocomplete(Optional) The callback for autocompletes.  If left nil, ULib tries to intelligently figure out what commands there are to complete.  This parameter is ignored on servers if it’s not singleplayer or a listen server.
access_string(Optional) Access required for use this command.  It’s only used for autocomplete purposes and is NOT validated at the server.
say_cmd(Optional) Specify a say command or say commands as a table to be tied in.
hide_say(Optional, defaults to false) Hide the chat when the say command is used?
no_space_in_say(Optional, defaults to false) Is a space between the chat command and arguments required?
unsafeFlag the command as unsafe to execute for execStringULib.

Example

The code below creates a bunch of different commands under the first “myTest” command.  If you type in “myTest “ at console, you see all the available commands for the next step in autocompletes.  Note that it’s case-insensitive, but otherwise works exactly like you would expect.

cmds.addCommand( "myTest", print )
cmds.addCommand( "myTest hi", print )
cmds.addCommand( "myTest hi2", print )
cmds.addCommand( "myTest hi2 doOty", print, print )
cmds.addCommand( "myTest hi2 doot", print, print )
cmds.addCommand( "myTest hi2 color", print, function() return { "red", "green", "blue" } end )
cmds.addCommand( "myTest rEd", print, print )
cmds.addCommand( "myTest blue", print, print )
cmds.addCommand( "myTest bluegreen", print, print )
cmds.addCommand( "myTest green", print, print )

Revisions

v2.63Added unsafe flag
v2.40Initial

cmds.addCommandClient

function cmds.addCommandClient(cmd,
fn,
autocomplete,
unsafe)

Exactly like cmds.addCommand, except it will expect the callback to be run on the local client instead of the server.

Revisions

v2.63Added unsafe flag
v2.40Initial
cmds.optional
This is used when specifying an argument to flag the argument as optional.
cmds.restrictToCompletes
This is used when specifying a string argument to flag that only what was specified for autocomplete is allowed to be passed as a valid argument.
cmds.takeRestOfLine
This is used when specifying a string argument to flag that this argument should use up any remaining args, whether quoted as one arg or not.
cmds.round
This is used when specifying a number argument to flag the argument to round the number to the nearest integer.
cmds.ignoreCanTarget
This is used when specifying a command that should ignore the can_target property in the groups config.
cmds.allowTimeString
This is used when specyfing a number argument that should allow time string representations to be parsed (eg, ‘1w1d’ for 1 week 1 day).
function cmds.BaseArg:parseAndValidate(ply,
arg,
cmdInfo,
plyRestrictions)
Used to, you guessed it, parse and validate an argument specified by a user.
function cmds.BaseArg:complete(arg,
cmdInfo,
plyRestrictions)
Used to autocomplete a command.
function cmds.BaseArg:usage(cmdInfo,
plyRestrictions)
Prints a basic usage message for this parameter.
Just defines the basics for us, used in autocomplete and command callbacks.
function cmds.NumArg:processRestrictions(cmdRestrictions,
plyRestrictions)
A helper function to help us figure out restrictions on this command.
function cmds.NumArg:parseAndValidate(ply,
arg,
cmdInfo,
plyRestrictions)
See cmds.BaseArg:parseAndValidate
function cmds.NumArg:complete(ply,
arg,
cmdInfo,
plyRestrictions)
See cmds.BaseArg:complete
function cmds.NumArg:usage(cmdInfo,
plyRestrictions)
See cmds.BaseArg:usage
function cmds.BoolArg:processRestrictions(cmdRestrictions,
plyRestrictions)
A helper function to help us figure out restrictions on this command.
function cmds.BoolArg:parseAndValidate(ply,
arg,
cmdInfo,
plyRestrictions)
See cmds.BaseArg:parseAndValidate
function cmds.BoolArg:complete(ply,
arg,
cmdInfo,
plyRestrictions)
See cmds.BaseArg:complete
function cmds.BoolArg:usage(cmdInfo,
plyRestrictions)
See cmds.BaseArg:usage
function cmds.PlayerArg:processRestrictions(ply,
cmdRestrictions,
plyRestrictions)
A helper function to help us figure out restrictions on this command.
function cmds.PlayerArg:parseAndValidate(ply,
arg,
cmdInfo,
plyRestrictions)
See cmds.BaseArg:parseAndValidate
function cmds.PlayerArg:complete(ply,
arg,
cmdInfo,
plyRestrictions)
See cmds.BaseArg:complete
function cmds.PlayerArg:usage(cmdInfo,
plyRestrictions)
See cmds.BaseArg:usage
A player arg, inherits from cmds.BaseArg.
function cmds.PlayersArg:parseAndValidate(ply,
arg,
cmdInfo,
plyRestrictions)
See cmds.PlayerArg:parseAndValidate
function cmds.PlayersArg:usage(cmdInfo,
plyRestrictions)
See cmds.PlayerArg:usage
function cmds.CallingPlayerArg:parseAndValidate(ply,
arg,
cmdInfo,
plyRestrictions)
See cmds.BaseArg:parseAndValidate
function cmds.StringArg:processRestrictions(cmdRestrictions,
plyRestrictions)
A helper function to help us figure out restrictions on this command.
function cmds.StringArg:parseAndValidate(ply,
arg,
cmdInfo,
plyRestrictions)
See cmds.BaseArg:parseAndValidate
function cmds.StringArg:complete(ply,
arg,
cmdInfo,
plyRestrictions)
See cmds.BaseArg:complete
function cmds.StringArg:usage(cmdInfo,
plyRestrictions)
See cmds.BaseArg:usage
function cmds.TranslateCommand:instantiate(cmd,
fn,
say_cmd,
hide_say,
no_space_in_say,
unsafe)
function cmds.TranslateCommand:addParam(t)
Add an argument to this command.
function cmds.TranslateCommand:setOpposite(cmd,
args,
say_cmd,
hide_say,
no_space_in_say)
Set the command opposite for this command.
function cmds.TranslateCommand:getUsage(ply)
function cmds.TranslateCommand:call(isOpposite,
...)
This is just a pass-through function for calling the function callback.
function cmds.TranslateCommand:defaultAccess(access)
function cmds.getCommandTableAndArgv(commandName,
argv,
valveErrorCorrection)
Transforms a command and argument list as passed by the source engine into a ULib command table.
function cmds.execute(cmdTable,
ply,
commandName,
argv)
Given a ULib command table and the information to pass to the command callback, execute the command.
function cmds.addCommand(cmd,
fn,
autocomplete,
access_string,
say_cmd,
hide_say,
no_space_in_say,
unsafe)
You must run this function on BOTH client AND server.  This function is very similar to garry’s concommand.Add() function with a few key differences.
function cmds.addCommandClient(cmd,
fn,
autocomplete,
unsafe)
Exactly like cmds.addCommand, except it will expect the callback to be run on the local client instead of the server.
function ULib.getUser(target,
enable_keywords,
ply)
Finds a user matching an identifier.
function ULib.getUsers(target,
enable_keywords,
ply)
Finds users matching an identifier.
function ULib.execStringULib(f,
safeMode)
Just like execString, except only for ULib-defined commands.
Close