From 1725f79e3c0cc3096915d05e1d0b0f8b5834b992 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Tue, 2 Jan 2018 23:09:21 +0000 Subject: [PATCH] Better /interface hopfuly no desync --- ExpCore/server.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ExpCore/server.lua b/ExpCore/server.lua index 7fb7298e..772a051e 100644 --- a/ExpCore/server.lua +++ b/ExpCore/server.lua @@ -197,10 +197,11 @@ if commands._expgaming then commands.add_command('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 - if game.player then callback = 'local player, surface, force = game.player, game.player.surface, game.player.force '..callback end - if Ranking and Ranking.get_rank and game.player then callback = 'local rank = Ranking.get_rank(game.player) '..callback end + if game.player then callback = 'local player, surface, force, entity = game.player, game.player.surface, game.player.force, game.player.selected;'..callback end + if Ranking and Ranking.get_rank and game.player then callback = 'local rank = Ranking.get_rank(game.player);'..callback end local success, err = Server.interface(callback) - player_return(err) + if not success and is_type(err,'string') then local _end = string.find(err,'stack traceback') if _end then err = string.sub(err,0,_end-2) end end + if err then player_return(err) end end) end