mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
Error Message improvement for commands
This commit is contained in:
@@ -212,13 +212,13 @@ local function run_custom_command(command)
|
||||
local success, err = pcall(callback,player,command.name,command)
|
||||
if not success then error(err)
|
||||
elseif not err then
|
||||
player_return({'ExpGamingCore_Command.unauthorized'},defines.textcolor.crit)
|
||||
player_return({'ExpGamingCore_Command.command-fail',{'ExpGamingCore_Command.unauthorized'}},defines.textcolor.crit)
|
||||
logMessage(player.name,command,'Failed to use command (Unauthorized)',commands.validate_args(command))
|
||||
game.player.play_sound{path='utility/cannot_build'}
|
||||
return
|
||||
end
|
||||
end elseif data.default_admin_only == true and player and not player.admin then
|
||||
player_return({'ExpGamingCore_Command.unauthorized'},defines.textcolor.crit)
|
||||
player_return({'ExpGamingCore_Command.command-fail',{'ExpGamingCore_Command.unauthorized'}},defines.textcolor.crit)
|
||||
logMessage(player.name,command,'Failed to use command (Unauthorized)',commands.validate_args(command))
|
||||
game.player.play_sound{path='utility/cannot_build'}
|
||||
return
|
||||
@@ -227,7 +227,7 @@ local function run_custom_command(command)
|
||||
local args, err = commands.validate_args(command)
|
||||
if args == commands.error then
|
||||
if is_type(err,'table') then table.insert(err,command.name) table.insert(err,commands.format_inputs(data))
|
||||
player_return(err,defines.textcolor.high) else player_return({'ExpGamingCore_Command.invalid-inputs',command.name,commands.format_inputs(data)},defines.textcolor.high) end
|
||||
player_return({'ExpGamingCore_Command.command-fail',err},defines.textcolor.high) else player_return({'ExpGamingCore_Command.command-fail',{'ExpGamingCore_Command.invalid-inputs',command.name,commands.format_inputs(data)}},defines.textcolor.high) end
|
||||
logMessage(player.name,command,'Failed to use command (Invalid Args)',args)
|
||||
player.play_sound{path='utility/deconstruct_big'}
|
||||
return
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
[ExpGamingCore_Command]
|
||||
unauthorized=401 - Unauthorized: Access is denied due to invalid credentials
|
||||
unauthorized=Unauthorized, Access is denied due to invalid credentials
|
||||
error-string-list=Invalid Option, Must be one of: __1__
|
||||
error-string-len=Invalid Length, Max: __1__
|
||||
error-number=Invalid Number: Command failed to run
|
||||
error-number=Invalid Number
|
||||
error-number-range=Invalid Range, Min (exclusive): __1__, Max (inclusive): __2__
|
||||
error-player=Invaild Player Name, __1__ ,try using tab key to auto-complete the name
|
||||
error-player-online=Player is offline: Command failed to run
|
||||
error-player-alive=Player is dead: Command failed to run
|
||||
error-player-rank=Player is of Higher Rank: Command failed to run
|
||||
error-player-online=Player is offline.
|
||||
error-player-alive=Player is dead.
|
||||
error-player-rank=Player is of Higher Rank.
|
||||
invalid-inputs=Invalid Input, /__1__ __2__
|
||||
invalid-parse=Invalid Input, There was a problem prasing the paramaters
|
||||
command-ran=Command Complete
|
||||
command-ran=Command Complete
|
||||
command-fail=Command failed to run: __1__
|
||||
Reference in New Issue
Block a user