mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-31 04:51:40 +09:00
Trying to fix commands again
This commit is contained in:
@@ -47,16 +47,16 @@ function define_command(name,help,inputs,event)
|
|||||||
Exp_commands[name]={name=name,help=help,inputs=inputs,event=event}
|
Exp_commands[name]={name=name,help=help,inputs=inputs,event=event}
|
||||||
end
|
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
|
--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
|
||||||
local function load_command(command)
|
local function load_command(command_data)
|
||||||
--is the command all ready loaded
|
--is the command all ready loaded
|
||||||
if commands.commands[command.name] then return end
|
if commands.commands[command_data.name] then return end
|
||||||
--start loading command
|
--start loading command
|
||||||
debug_write({'COMMAND','LOAD'},command.name)
|
debug_write({'COMMAND','LOAD'},command_data.name)
|
||||||
--add command to game
|
--add command to game
|
||||||
debug_write({'COMMAND','LOAD'},command)
|
debug_write({'COMMAND','LOAD'},command_data)
|
||||||
commands.add_command(command.name,{'commands.help-format',command_inputs_to_string(command),command.help},function(event)
|
commands.add_command(command_data.name,{'commands.help-format',command_inputs_to_string(command_data),command_data.help},function(event)
|
||||||
--gets the command data
|
--gets the command data
|
||||||
local command = Exp_commands[event.name]
|
local command = get_commands()[event.name]
|
||||||
debug_write({'COMMAND','RUN','START'},command.name)
|
debug_write({'COMMAND','RUN','START'},command.name)
|
||||||
debug_write({'COMMAND','RUN','PLAYER-INDEX'},event.player_index)
|
debug_write({'COMMAND','RUN','PLAYER-INDEX'},event.player_index)
|
||||||
if event.player_index then
|
if event.player_index then
|
||||||
@@ -100,6 +100,7 @@ end
|
|||||||
function get_commands(rank)
|
function get_commands(rank)
|
||||||
local rank = rank or 'Owner'
|
local rank = rank or 'Owner'
|
||||||
local to_return = {}
|
local to_return = {}
|
||||||
|
if not rank then return Exp_commands end
|
||||||
for command_name,command in pairs(Exp_commands) do
|
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
|
if ranking.rank_allowed(ranking.string_to_rank(rank),command_name) then table.insert(to_return,command) end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user