Console Command Auto-completion
Auto-complete Overview
Auto-complete is a feature that predicts words & phrases, it helps the user understand a console command & increase their efficiency whilst using it.
Auto-completion with functions
To create auto-complete for your console command, a function named AutoComplete
must be created. The function will determine what values are displayed based on what is passed to the function.
@param cmd
— Will always be the command, not useful for us right now. (Gives "rp_steamid").
@param stringargs
— Gives us the rest of the input. Typing in "rp_steamid Don" will make stringargs = " Don".
In this function we are also meant to return something, a table. This table should contain the set of values we want to display to the user in the autocomplete box.
The function below gives the result as seen below the function.
The function below gives the result as seen below the function.
Console command replication
Console commands are not replicated. If you'd like to replicate a console command, you'll have to use AddCSLuaFile, or create custom behavior on both the server & the client.
Special thanks to old-time contributors for the images. The code was written by shawnjbragdon.