mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-01-06 00:23:49 +02:00
Fixed the trusted command
It would crash if you didn't have a player name.
This commit is contained in:
parent
b662d097b5
commit
b7ae14081d
14
chatbot.lua
14
chatbot.lua
@ -28,10 +28,9 @@ end
|
||||
|
||||
commands.add_command(
|
||||
'trust',
|
||||
'Promotes a player to the global.trusted_players',
|
||||
'Promotes a player to trusted!',
|
||||
function(cmd)
|
||||
local player = game.player
|
||||
local target_player = game.players[cmd.parameter]
|
||||
local p
|
||||
|
||||
if player then
|
||||
@ -44,7 +43,9 @@ commands.add_command(
|
||||
p = log
|
||||
end
|
||||
|
||||
if target_player ~= nil then
|
||||
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})
|
||||
@ -59,10 +60,9 @@ commands.add_command(
|
||||
|
||||
commands.add_command(
|
||||
'untrust',
|
||||
'Demotes a player to the global.trusted_players',
|
||||
'Demotes a player from trusted!',
|
||||
function(cmd)
|
||||
local player = game.player
|
||||
local target_player = game.players[cmd.parameter]
|
||||
local p
|
||||
|
||||
if player then
|
||||
@ -75,7 +75,9 @@ commands.add_command(
|
||||
p = log
|
||||
end
|
||||
|
||||
if target_player ~= nil then
|
||||
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})
|
||||
|
Loading…
Reference in New Issue
Block a user