mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-29 20:16:38 +09:00
Spell check
This commit is contained in:
@@ -19,7 +19,7 @@ local credits = {{
|
||||
local function credit_loop(reg) for _,cred in pairs(reg) do table.insert(credits,cred) end end
|
||||
--Please Only Edit Below This Line-----------------------------------------------------------
|
||||
local Exp_commands = {}
|
||||
--used mainly by the code to convert the inputs into a string
|
||||
--Used mainly by the code to convert the inputs into a string
|
||||
function command_inputs_to_string(command)
|
||||
local str_inputs = ''
|
||||
for _,input in pairs(command[3]) do
|
||||
@@ -28,22 +28,22 @@ function command_inputs_to_string(command)
|
||||
end
|
||||
return str_inputs
|
||||
end
|
||||
--can be used to ensure the right number of inputs are given
|
||||
--Can be used to ensure the right number of inputs are given
|
||||
function get_command_args(event,command)
|
||||
local player = game.players[event.player_index]
|
||||
if not event.parameter then player.print('Invaild Input, /'..command[1]..' '..command_inputs_to_string(command)) if #command[3] > 0 then return 'Invaild' else return end end
|
||||
if not event.parameter then player.print('Invalid Input, /'..command[1]..' '..command_inputs_to_string(command)) if #command[3] > 0 then return 'Invalid' else return end end
|
||||
local args = {}
|
||||
for word in event.parameter:gmatch('%S+') do table.insert(args,word) end
|
||||
if command[3][#command[3]] == true then
|
||||
if #args < #command[3]-1 then player.print('Invaild Input, /'..command[1]..' '..command_inputs_to_string(command)) return 'Invaild' end
|
||||
if #args < #command[3]-1 then player.print('Invalid Input, /'..command[1]..' '..command_inputs_to_string(command)) return 'Invalid' end
|
||||
else
|
||||
if #args ~= #command[3] then player.print('Invaild Input, /'..command[1]..' '..command_inputs_to_string(command)) return 'Invaild' end
|
||||
if #args ~= #command[3] then player.print('Invalid Input, /'..command[1]..' '..command_inputs_to_string(command)) return 'Invalid' end
|
||||
end return args
|
||||
end
|
||||
--name is what is used in /command
|
||||
--help is the help infor given
|
||||
--inputs is a list ie {'name','message',true} the last value being true apossed to a string allows a varible number of words for the last input ie message can be mutilple words long
|
||||
--restriction is the minium rank that can use the caommand
|
||||
--name is what is used in /command
|
||||
--help is the help info given
|
||||
--inputs is a list i.e. {'name','message',true} the last value being true opposed to a string allows a variable number of words for the last input i.e. message can be multiple words long
|
||||
--restriction is the lowest rank that can use the command
|
||||
--event(player,event,args) if the function that will be ran on the command use
|
||||
function define_command(name,help,inputs,restriction,event)
|
||||
if not name then error('Command requires a name') end
|
||||
@@ -53,7 +53,7 @@ function define_command(name,help,inputs,restriction,event)
|
||||
if not event or type(event) ~= 'function' then error('Command requires a function') end
|
||||
table.insert(Exp_commands,{name,help,inputs,restriction,event})
|
||||
end
|
||||
--the magic for the commnads it is a hard bit of code so GL; but it will call the command event have some satatisaion 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
|
||||
function load_command(command)
|
||||
if commands.commands[command[1]] then return end
|
||||
commands.add_command(command[1],command_inputs_to_string(command)..command[2],function(event)
|
||||
@@ -66,11 +66,11 @@ function load_command(command)
|
||||
local restriction = temp_restriction or string_to_rank(command[4]).power or 0
|
||||
if get_rank(player).power > restriction then player.print('401 - Unauthorized: Access is denied due to invalid credentials') return end
|
||||
local args = get_command_args(event,command)
|
||||
if args == 'Invaild' then return end
|
||||
if args == 'Invalid' then return end
|
||||
command[5](player,event,args)
|
||||
else
|
||||
local args = get_command_args(event,command)
|
||||
if args == 'Invaild' then return end
|
||||
if args == 'Invalid' then return end
|
||||
command[5]('<server>',event)
|
||||
end
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user