From 20d47d6885aec39441dfb6e215335cc37d74324f Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 5 Jan 2018 13:10:34 +0000 Subject: [PATCH] Added an opption to not print command complete --- ExpCore/commands.lua | 8 +++++--- locale/en/exp-core.cfg | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ExpCore/commands.lua b/ExpCore/commands.lua index 64d29a70..45e9f8ce 100644 --- a/ExpCore/commands.lua +++ b/ExpCore/commands.lua @@ -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) diff --git a/locale/en/exp-core.cfg b/locale/en/exp-core.cfg index 6d099655..731d758e 100644 --- a/locale/en/exp-core.cfg +++ b/locale/en/exp-core.cfg @@ -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]