diff --git a/control.lua b/control.lua index 790de134..d9142525 100644 --- a/control.lua +++ b/control.lua @@ -36,4 +36,6 @@ end) ranking,ExpGui,server = unpack(require("locale/ExpGaming-Core/file-header")) --loads all the other scripts require("locale/Stand-Alone/file-header") -require("locale/ExpGaming-Addons/file-header") \ No newline at end of file +require("locale/ExpGaming-Addons/file-header") +--call from command maker +load_commands() \ No newline at end of file diff --git a/locale/ExpGaming-Core/ExpGaming - Command Maker.lua b/locale/ExpGaming-Core/ExpGaming - Command Maker.lua index 527691ff..8dac51c7 100644 --- a/locale/ExpGaming-Core/ExpGaming - Command Maker.lua +++ b/locale/ExpGaming-Core/ExpGaming - Command Maker.lua @@ -56,7 +56,7 @@ local function load_command(command_data) debug_write({'COMMAND','LOAD'},command_data) commands.add_command(command_data.name,{'commands.help-format',command_inputs_to_string(command_data),command_data.help},function(event) --gets the command data - local command = get_commands()[event.name] + local command = Exp_commands[event.name] debug_write({'COMMAND','RUN','START'},command.name) debug_write({'COMMAND','RUN','PLAYER-INDEX'},event.player_index) if event.player_index then @@ -100,11 +100,12 @@ end function get_commands(rank) local rank = rank or 'Owner' local to_return = {} - if not rank then return Exp_commands end for command_name,command in pairs(Exp_commands) do if ranking.rank_allowed(ranking.string_to_rank(rank),command_name) then table.insert(to_return,command) end end return to_return end --- loads all the commands -for command_name,command in pairs(Exp_commands) do load_command(command) end \ No newline at end of file +-- loads all the commands, call once all script have been loaded +function load_commands() + for command_name,command in pairs(Exp_commands) do load_command(command) end +end \ No newline at end of file diff --git a/locale/ExpGaming-Core/ExpGaming - Lib.lua b/locale/ExpGaming-Core/ExpGaming - Lib.lua index 05e32198..b6944041 100644 --- a/locale/ExpGaming-Core/ExpGaming - Lib.lua +++ b/locale/ExpGaming-Core/ExpGaming - Lib.lua @@ -98,7 +98,7 @@ function json_log(lua_table,no_log) end -- allows a simple way to debug code; idenitys = {'string1','string2'}; string will be writen to file; no_trigger dissables the trigger useful for on_tick events function debug_write(idenitys,string,no_trigger) - if global.exp_core.debug.state then + if global.exp_core and global.exp_core.debug.state then if type(string) == 'table' then string = table.tostring(string) elseif type(string) ~= 'string' then string = tostring(string) end if not no_trigger or global.exp_core.debug.triggered then game.write_file('debug.log', '\n['..table.concat(idenitys, " " )..'] '..string, true, 0) end