LocalClientCommand
Allow you to add local client with callback. These commands only run in local.
By Team036
Last updated | 2 years ago |
Total downloads | 1057 |
Total rating | 2 |
Categories | Mods Client-side |
Dependency string | Team036-LocalClientCommand-1.0.0 |
Dependants | 1 other package depends on this package |
README
What this mod brings
I tried to use AddClientCommandCallback
, but met a CLIENT SCRIPT COMPILE ERROR
.
// CLIENT SCRIPT COMPILE ERROR Undefined variable "AddClientCommandCallback"
So I made this to allow you to custom commands in local easier.
You can type some commands like /ping
in the chat. These commands you sent will not show to other players, so feel free to use them.
Type /help
or/?
to get the commands list. Use up-arrow/down-arrow to scroll.
New callbacks
void function AddLocalClientCommand(string command, void functionref(entity, array<string>) func)
You can add command with this function.
entity
is the local player.
array<string>
is an array of args
. args[0]
is the command string.
void function PingCommand(entity player, array<string> args)
{
int ping = MyPing()
Logger.Info("ping: " + ping)
}
// args[0] is the command string. Here is ping.
AddLocalClientCommand("ping", PingCommand)
global struct Logger
It offer 5 functions you can use to log in the chat window(only shown to you). I don’t know how to colorize the text, so they are not color-modified.
-
Logger.Trace(string str)
Trace is not completed. Do not use.
-
Logger.Debug(string str)
-
Logger.Info(string str)
Default log level.
-
Logger.Warn(string str)
-
Logger.Error(string str)
Once if the log function you use is lower than the log level, the log message will not show.
Configure this int Logger.logLevel
. You can find the levels with Logger.LogType["INFO"]
.
If you want to change the log level, just like this:
Logger.logLevel = Logger.LogType["DEBUG"]
Logger.Debug(command)
Some default commands
-
ping
Show ping.
-
list_all_player
List all players.
-
list_all_command
-
help
-
?
List all commands.
-
convar
ConVarnameShow the value of the ConVarname.
Mod.json
Convars
"ConVars": [
// use to identify the commands, these chats will be blocked.
{
"Name": "l1nexus_local_client_command_prefix",
"DefaultValue": "/"
}
]
Files
│ mod.json
│
└─mod
└─scripts
└─vscripts
l1nexus_local_client_command.nut
l1nexus_local_client_command_default_commands.nut
l1nexus_logger.nut
Further updates
- Colorize the log.
Update log
v1.0.0
- Upload.