Skip to content

Commit

Permalink
Added usage help to certain commands
Browse files Browse the repository at this point in the history
Commands that require at least one argument to work will now display their usage if the user fails to provide all the required arguments.
  • Loading branch information
TwistedTail committed May 26, 2020
1 parent 918d828 commit 6720599
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions lua/afsu/server/concmd/add/sv_loadingscreen.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ local Screens = AFSU.LoadingScreens
AFSU.NewAddCommand("loading_screen", function(Player, URL)
if not URL then
SendMessage(Player, "Error", "No loading screen URL was entered!")
SendMessage(Player, "Info", "Usage: afsu add loading_screen <URL>")
return
end

Expand Down
1 change: 1 addition & 0 deletions lua/afsu/server/concmd/add/sv_message.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ local Messages = AFSU.ServerMessages
AFSU.NewAddCommand("server_message", function(Player, Name)
if not Name then
SendMessage(Player, "Error", "No server message was entered!")
SendMessage(Player, "Info", "Usage: afsu add server_message <Message>")
return
end

Expand Down
1 change: 1 addition & 0 deletions lua/afsu/server/concmd/add/sv_name.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ local Names = AFSU.ServerNames
AFSU.NewAddCommand("server_name", function(Player, Name)
if not Name then
SendMessage(Player, "Error", "No server name was entered!")
SendMessage(Player, "Info", "Usage: afsu add server_name <Name>")
return
end

Expand Down
2 changes: 2 additions & 0 deletions lua/afsu/server/concmd/add/sv_redirects.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ local Hosts = AFSU.Hostnames
AFSU.NewAddCommand("server_redirect", function(Player, Name, IP)
if not Name then
SendMessage(Player, "Error", "No server name was entered!")
SendMessage(Player, "Info", "Usage: afsu add server_redirect <Name> <IP>")
return
end

if not IP then
SendMessage(Player, "Error", "No server IP was entered!")
SendMessage(Player, "Info", "Usage: afsu add server_redirect <Name> <IP>")
return
end

Expand Down
2 changes: 1 addition & 1 deletion lua/afsu/server/concmd/list/sv_redirects.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ AFSU.NewListCommand("server_redirect", function(Player)
Message = "Listing " .. #Hosts .. " redirect servers:"

for _, V in ipairs(Hosts) do
Message = Message .. "\n » " .. V.Name .. " = " .. V.Address
Message = Message .. "\n » [" .. V.Name:upper() .. "]\t = " .. V.Address
end
end

Expand Down
2 changes: 1 addition & 1 deletion lua/afsu/server/concmd/other/sv_connect.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ AFSU.RegisterSingleCommand("connect", function(Player, Name)

if not Name then
SendMessage(Player, "Error", "No server name was entered!")
Response(Player, "ConCommand", { "afsu", "list", "server_redirect" })
SendMessage(Player, "Info", "Usage: afsu connect <Name>")
return
end

Expand Down

0 comments on commit 6720599

Please sign in to comment.