Improve command discovery and welcome messages
This commit is contained in:
@@ -153,11 +153,46 @@ help_chat_listener()
|
||||
continue;
|
||||
|
||||
command = toLower(message);
|
||||
if (command == ".help" || command == ".commands")
|
||||
if (command == ".help" || command == ".commands" || command == ".info" || command == ".command")
|
||||
player show_help();
|
||||
else if (help_unknown_command(command))
|
||||
player iPrintLn("Unknown command. Type .help for the list");
|
||||
}
|
||||
}
|
||||
|
||||
// Compare command tokens, not help labels containing argument syntax.
|
||||
help_first_word(message)
|
||||
{
|
||||
words = strTok(toLower(message), " \t\r\n");
|
||||
if (words.size == 0)
|
||||
return "";
|
||||
return words[0];
|
||||
}
|
||||
|
||||
help_unknown_command(message)
|
||||
{
|
||||
if (message.size == 0)
|
||||
return false;
|
||||
prefix = getSubStr(message, 0, 1);
|
||||
if (prefix != "." && prefix != "!")
|
||||
return false;
|
||||
|
||||
command = help_first_word(message);
|
||||
if (command == ".help" || command == ".commands" || command == ".info" || command == ".command")
|
||||
return false;
|
||||
if (isDefined(level.tws_help_commands))
|
||||
{
|
||||
for (i = 0; i < level.tws_help_commands.size; i++)
|
||||
{
|
||||
registered = help_first_word(level.tws_help_commands[i].command);
|
||||
// The record alias is available when the leaderboard registers itself.
|
||||
if (command == registered || (command == ".record" && registered == ".leaders"))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// A single per-player controller owns service priority, pages and expiry.
|
||||
show_help()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user