From 9eabc1b9256ca74c5bf278e02a9dc7bbcf00e284 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Fri, 22 Sep 2017 16:20:54 +0100 Subject: [PATCH] Command maker debug added --- locale/ExpGaming-Core/ExpGaming - Command Maker.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/locale/ExpGaming-Core/ExpGaming - Command Maker.lua b/locale/ExpGaming-Core/ExpGaming - Command Maker.lua index 02faf6cb..1e274a19 100644 --- a/locale/ExpGaming-Core/ExpGaming - Command Maker.lua +++ b/locale/ExpGaming-Core/ExpGaming - Command Maker.lua @@ -60,32 +60,42 @@ end --The magic for the commands. It is a hard bit of code so GL; but it will call the command event have some sanitisaion of the input function load_command(command) if commands.commands[command.name] then return end + debug_write({'COMMAND','LOAD'},command.name) game.write_file('commands.log','\n'..game.tick..' Loaded Command: '..command.name, true, 0) commands.add_command(command.name,command_inputs_to_string(command)..command.help,function(event) local command_data = nil for _,command_d in pairs(Exp_commands) do if event.name == command_d[1] then command_data = command_d break end end + debug_write({'COMMAND','RUN','START'},command.name) + debug_write({'COMMAND','RUN','PLAYER-INDEX'},event.player_index) if event.player_index then local player = game.players[event.player_index] if not rank_allowed(get_rank(player),command.name) then + debug_write({'COMMAND','RUN','ALLOWED'},false) player.print('401 - Unauthorized: Access is denied due to invalid credentials') game.write_file('commands.log','\n'..game.tick..' Player: '..player.name..' Failed to use command (Unauthorized): '..command.name..' With args of: '..table.tostring(get_command_args(event,command,true)), true, 0) return end + debug_write({'COMMAND','RUN','ALLOWED'},true) local args = get_command_args(event,command) + debug_write({'COMMAND','RUN','ARGS'},args) if args == 'Invalid' then player.print('Invalid Input, /'..command.name..' '..command_inputs_to_string(command)) return game.write_file('commands.log','\n'..game.tick..' Player: '..player.name..' Failed to use command (Invalid Args): '..command.name..' With args of: '..table.tostring(get_command_args(event,command,true)), true, 0) end + debug_write({'COMMAND','RUN','FUNCTION'},command.name) command.event(player,event,args) player.print('Command Complete') - game.write_file('commands.log','\n'..game.tick..' Player: '..player.name..' Used command: '..command.name..' With args of: '..table.tostring(args), true, 0) + game.write_file('commands.log','\n'..game.tick..' Player: '..player.name..' Used command: '..command.name..' With args of: '..table.tostring(args), true, 0) else local args = get_command_args(event,command) if args == 'Invalid' then print('Invalid Input, /'..command.name..' '..command_inputs_to_string(command)) return end + debug_write({'COMMAND','RUN','ARGS'},args) + debug_write({'COMMAND','RUN','FUNCTION'},command.name) command.event('',event,args) print('Command Complete') game.write_file('commands.log','\n'..game.tick..' Player: Used command: '..command.name..' With args of: '..table.tostring(args), true, 0) end + debug_write({'COMMAND','RUN','END'},command.name) end) end -- returns all the commands in a certain rank restriction