1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-03-29 21:47:08 +02:00

Fixed /trust /untrust

The server couldn't run these commands, crashed when used. Now works.
This commit is contained in:
Gerkiz 2019-07-04 18:56:45 +02:00 committed by GitHub
parent b86879df91
commit f788e768ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,10 +30,12 @@ commands.add_command(
'trust',
'Promotes a player to trusted!',
function(cmd)
local server = 'server'
local player = game.player
local p
if player then
if player ~= nil then
p = player.print
if not player.admin then
p("You're not admin!", {r = 1, g = 0.5, b = 0.1})
@ -55,6 +57,15 @@ commands.add_command(
end
end
end
else
if cmd.parameter == nil then return end
local target_player = game.players[cmd.parameter]
if target_player then
if global.trusted_players[target_player.name] == true then game.print(target_player.name .. " is already trusted!") return end
global.trusted_players[target_player.name] = true
game.print(target_player.name .. " is now a trusted player.", {r=0.22, g=0.99, b=0.99})
end
end
end
)
@ -62,10 +73,12 @@ commands.add_command(
'untrust',
'Demotes a player from trusted!',
function(cmd)
local server = 'server'
local player = game.player
local p
if player then
if player ~= nil then
p = player.print
if not player.admin then
p("You're not admin!", {r = 1, g = 0.5, b = 0.1})
@ -87,6 +100,15 @@ commands.add_command(
end
end
end
else
if cmd.parameter == nil then return end
local target_player = game.players[cmd.parameter]
if target_player then
if global.trusted_players[target_player.name] == false then game.print(target_player.name .. " is already untrusted!") return end
global.trusted_players[target_player.name] = false
game.print(target_player.name .. " is now untrusted.", {r=0.22, g=0.99, b=0.99})
end
end
end
)