Added custom command check

This commit is contained in:
Cooldude2606
2017-12-09 16:22:20 +00:00
parent 8701696464
commit 788cbfa248
2 changed files with 9 additions and 6 deletions

View File

@@ -113,6 +113,7 @@ local function run_custom_command(command)
end
commands._add_command = commands.add_command
commands._expgaming = true
--- Used to define commands
-- @usage inputs = {'player','reason',true}
-- commands.add_command('ban','bans a player',inputs,function() return end)

View File

@@ -175,12 +175,14 @@ function Server.interface(callback,use_thread,...)
end
end
commands.add_command('server-interface', 'Runs the given input from the script', {'code',true}, function(event,args)
local callback = args.code
if not string.find(callback,'%s') and not string.find(callback,'return') then callback = 'return '..callback end
local success, err = Server.interface(callback)
player_return(err)
end)
if commands._expgaming then
commands.add_command('server-interface', 'Runs the given input from the script', {'code',true}, function(event,args)
local callback = args.code
if not string.find(callback,'%s') and not string.find(callback,'return') then callback = 'return '..callback end
local success, err = Server.interface(callback)
player_return(err)
end)
end
-- thread allows you to run fuinction async to the main game
--- Returns a new thread object