1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-06-02 22:57:40 +02:00

More updates to jail

This commit is contained in:
Gerkiz 2019-12-19 20:58:35 +01:00 committed by GitHub
parent dd372e7a8a
commit cffa69a758
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,5 @@
local Session = require 'utils.session_data' local Session = require 'utils.session_data'
local Server = require 'utils.server'
local function admin_only_message(str) local function admin_only_message(str)
for _, player in pairs(game.connected_players) do for _, player in pairs(game.connected_players) do
@ -47,23 +48,28 @@ commands.add_command(
'Sends the player to gulag!', 'Sends the player to gulag!',
function(cmd) function(cmd)
local trusted = Session.get_trusted_table() local trusted = Session.get_trusted_table()
local total_time = Session.get_session_table()
local player = game.player local player = game.player
local p local p
if player then if player then
if player ~= nil then if player ~= nil then
p = player.print p = player.print
if total_time[player.name] < 51900000 then
if not player.admin then if not player.admin then
p("You're not admin!", {r = 1, g = 0.5, b = 0.1}) p("You're not admin nor are you trusted enough to run this command!", {r = 1, g = 0.5, b = 0.1})
return return
end end
end end
end
if cmd.parameter == nil then return end if cmd.parameter == nil then return end
local target_player = game.players[cmd.parameter] local target_player = game.players[cmd.parameter]
if target_player then if target_player then
if target_player.name == player.name then player.print("You can't jail yourself!", {r = 1, g = 0.5, b = 0.1}) return end
trusted[target_player.name] = false trusted[target_player.name] = false
jail(target_player, player) jail(target_player, player)
Server.to_discord_bold(table.concat{'[Jailed] ' .. target_player.name .. ' has been jailed by ' .. player.name .. '!'})
end end
else else
if cmd.parameter == nil then return end if cmd.parameter == nil then return end
@ -71,6 +77,7 @@ commands.add_command(
if target_player then if target_player then
trusted[target_player.name] = false trusted[target_player.name] = false
jail(target_player, 'Server') jail(target_player, 'Server')
Server.to_discord_bold(table.concat{'[Jailed] ' .. target_player.name .. ' has been jailed by Server!'})
end end
end end
end end
@ -81,27 +88,33 @@ commands.add_command(
'Brings back the player from gulag.', 'Brings back the player from gulag.',
function(cmd) function(cmd)
local player = game.player local player = game.player
local total_time = Session.get_session_table()
local p local p
if player then if player then
if player ~= nil then if player ~= nil then
p = player.print p = player.print
if total_time[player.name] < 51900000 then
if not player.admin then if not player.admin then
p("You're not admin!", {r = 1, g = 0.5, b = 0.1}) p("You're not admin nor are you trusted enough to run this command!", {r = 1, g = 0.5, b = 0.1})
return return
end end
end end
end
if cmd.parameter == nil then return end if cmd.parameter == nil then return end
local target_player = game.players[cmd.parameter] local target_player = game.players[cmd.parameter]
if target_player then if target_player then
if target_player.name == player.name then player.print("You can't unjail yourself!", {r = 1, g = 0.5, b = 0.1}) return end
free(target_player, player) free(target_player, player)
Server.to_discord_bold(table.concat{'[Unjailed] ' .. target_player.name .. ' has been unjailed by ' .. player.name .. '!'})
end end
else else
if cmd.parameter == nil then return end if cmd.parameter == nil then return end
local target_player = game.players[cmd.parameter] local target_player = game.players[cmd.parameter]
if target_player then if target_player then
free(target_player, 'Server') free(target_player, 'Server')
Server.to_discord_bold(table.concat{'[Unjailed] ' .. target_player.name .. ' has been unjailed by Server!'})
end end
end end
end end