mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
All The Logs
This commit is contained in:
@@ -55,6 +55,7 @@ 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
|
||||
function load_command(command)
|
||||
if commands.commands[command.name] then return end
|
||||
game.write_file('commands.log','\n'..game.tick..' Loaded Command: '..command.name, true, 0)
|
||||
commands.add_command(command.name,command_inputs_to_string(command)..command.help,function(event)
|
||||
local command_data = nil
|
||||
for _,command_d in pairs(Exp_commands) do if event.name == command_d[1] then command_data = command_d break end end
|
||||
@@ -63,16 +64,22 @@ function load_command(command)
|
||||
local temp_restriction = nil
|
||||
if type(command.restriction) == 'number' then temp_restriction = command.restriction end
|
||||
local restriction = temp_restriction or string_to_rank(command.restriction).power or 0
|
||||
if get_rank(player).power > restriction then player.print('401 - Unauthorized: Access is denied due to invalid credentials') return end
|
||||
if get_rank(player).power > restriction then
|
||||
player.print('401 - Unauthorized: Access is denied due to invalid credentials')
|
||||
game.write_file('commands.log','\n'..game.tick..' Player: '..player.name..' Failed to use command: '..command.name..' With args of: '..table.to_string(args), true, 0)
|
||||
return
|
||||
end
|
||||
local args = get_command_args(event,command)
|
||||
if args == 'Invalid' then player.print('Invalid Input, /'..command.name..' '..command_inputs_to_string(command)) return end
|
||||
command.event(player,event,args)
|
||||
player.print('Command Complete')
|
||||
game.write_file('commands.log','\n'..game.tick..' Player: '..player.name..' Used command: '..command.name..' With args of: '..table.to_string(args), true, 0)
|
||||
else
|
||||
local args = get_command_args(event,command)
|
||||
if args == 'Invalid' then print('Invalid Input, /'..command.name..' '..command_inputs_to_string(command)) return end
|
||||
command.event('<server>',event,args)
|
||||
print('Command Complete')
|
||||
game.write_file('commands.log','\n'..game.tick..' Player: <server> Used command: '..command.name..' With args of: '..table.to_string(args), true, 0)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -130,8 +130,15 @@ function get_ranked_players(rank)
|
||||
end
|
||||
return to_return
|
||||
end
|
||||
--Event handlers
|
||||
--Event handlers
|
||||
Event.rank_change = script.generate_event_name()
|
||||
Event.register(Event.rank_change,function(event)
|
||||
if event.by_player == 'server' then
|
||||
game.write_file('rank-change.log','\n'..game.tick..' Player: '..event.player.name..' Was given rank: '..event.new_rank.name..' By: <server> Their were rank: '..event.old_rank, true, 0)
|
||||
else
|
||||
game.write_file('rank-change.log','\n'..game.tick..' Player: '..event.player.name..' Was given rank: '..event.new_rank.name..' By: '..event.by_player.name..' Their were rank: '..event.old_rank, true, 0)
|
||||
end
|
||||
end)
|
||||
Event.register(-1,function()
|
||||
global.old_ranks = {}
|
||||
for _,rank in pairs(global.ranks) do
|
||||
|
||||
@@ -22,12 +22,12 @@ local function credit_loop(reg) for _,cred in pairs(reg) do table.insert(credits
|
||||
define_command('server-interface','For use of the highest staff only',{'command',true},'admin',function(player,event,args)
|
||||
if player == '<server>' then
|
||||
local returned,value = pcall(loadstring(event.parameter))
|
||||
if type(value) == 'table' then game.write_file('log.txt', '\n Ran by: <server> \n Code: '..event.parameter..'\n $£$ '..table.to_string(value), true, 0) print(table.to_string(value))
|
||||
else game.write_file('log.txt', '\n Ran by: <server> \n Code: '..event.parameter..'\n $£$ '..tostring(value), true, 0) print(value) end
|
||||
if type(value) == 'table' then game.write_file('server-interface.log', '\n'..game.tick..' Ran by: <server> Code: '..event.parameter..'\n Returned: '..table.to_string(value), true, 0) print(table.to_string(value))
|
||||
else game.write_file('server-interface.log', '\n'..game.tick..' Ran by: <server> Code: '..event.parameter..'\n Returned: '..tostring(value), true, 0) print(value) end
|
||||
else
|
||||
local returned,value = pcall(loadstring(event.parameter))
|
||||
if type(value) == 'table' then game.write_file('log.txt', '\n Ran by: '..player.name..'\n Code: '..event.parameter..'\n $£$ '..table.to_string(value), true, 0) player.print(table.to_string(value))
|
||||
else game.write_file('log.txt', '\n Ran by: '..player.name..'\n Code: '..event.parameter..'\n $£$ '..tostring(value), true, 0) player.print(value) end
|
||||
if type(value) == 'table' then game.write_file('server-interface-players.log', '\n'..game.tick..' Ran by: '..player.name..' Code: '..event.parameter..'\n Returned: '..table.to_string(value), true, 0) player.print(table.to_string(value))
|
||||
else game.write_file('server-interface-players.log', '\n'..game.tick..' Ran by: '..player.name..' Code: '..event.parameter..'\n Returned: '..tostring(value), true, 0) player.print(value) end
|
||||
end
|
||||
end)
|
||||
--this is used when changing permission groups when the person does not have permsion to, can also be used to split a large event accross multiple ticks
|
||||
|
||||
@@ -64,6 +64,7 @@ function draw_frame.popup(style,args)
|
||||
local args = args or {}
|
||||
local frame_data = nil
|
||||
for _,frame in pairs(frames.popup) do if style == frame.style then frame_data = frame break end end
|
||||
game.write_file('popups.log','\n'..game.tick..' Popup Style: '..style..' Was made with args of: '..table.to_string(args), true, 0)
|
||||
for _,player in pairs(game.connected_players) do
|
||||
local popups = mod_gui.get_frame_flow(player).popups
|
||||
local frame = get_next_popup(popups)
|
||||
|
||||
Reference in New Issue
Block a user