Added an opption to not print command complete

This commit is contained in:
Cooldude2606
2018-01-05 13:10:34 +00:00
parent 2a4d4ac0bf
commit 20d47d6885
2 changed files with 9 additions and 3 deletions

View File

@@ -106,7 +106,7 @@ local function run_custom_command(command)
-- runs the command
local success, err = pcall(command_calls[command.name],command,args)
if not success then error(err) end
player_return({'commands.command-ran'},defines.text_color.info)
if err ~= commands.error then player_return({'commands.command-ran'},defines.text_color.info) end
game.write_file('commands.log','\n'..game.tick
..' Player: '..player_name
..' Used command: '..command.name
@@ -114,8 +114,10 @@ local function run_custom_command(command)
, true, 0)
end
commands._add_command = commands.add_command
commands._expgaming = true
-- this is a set of constants you can use
commands._add_command = commands.add_command --if you dont want to use the custom commands interface
commands._expgaming = true --if you want to test if the custom commands are present
commands.error = 'COMMAND_ERROR' --if returned during a custom command, Command Complete message not printed
--- Used to define commands
-- @usage inputs = {'player','reason',true}
-- commands.add_command('ban','bans a player',inputs,function() return end)

View File

@@ -1,7 +1,11 @@
[commands]
unauthorized=401 - Unauthorized: Access is denied due to invalid credentials
invalid-inputs=Invalid Input, /__1__ __2__
invalid-range=Invalid Range, Min: __1__, Max: __2__
invalid-length=Invalid Length, Max: __1__
invalid-player=Invaild Player Name, __1__ ,try using tab key to auto-complete the name
offline-player=Player is offline, Command Failed To Run
dead-player=Player is dead, Command Failed To Run
command-ran=Command Complete
[ranking]