Setting for flag alerts

master
rubenwardy 2016-03-31 16:59:22 +01:00
parent f7890cdf66
commit 92d813b090
2 changed files with 21 additions and 14 deletions

View File

@ -28,21 +28,26 @@ end)
ctf.hud.register_part(function(player, name, tplayer)
-- Check all flags
local alert = "Punch the enemy flag! Protect your flag!"
local alert = nil
local color = "0xFFFFFF"
local claimed = ctf_flag.collect_claimed()
for _, flag in pairs(claimed) do
if flag.claimed.player == name then
alert = "You've got the flag! Run back and punch your flag!"
color = "0xFF0000"
break
elseif flag.team == tplayer.team then
alert = "Kill " .. flag.claimed.player .. ", they have your flag!"
color = "0xFF0000"
break
else
alert = "Protect " .. flag.claimed.player .. ", he's got the enemy flag!"
color = "0xFF0000"
if ctf.setting("flag.alerts") then
if ctf.setting("flag.alerts.neutral_alert") then
alert = "Punch the enemy flag! Protect your flag!"
end
local claimed = ctf_flag.collect_claimed()
for _, flag in pairs(claimed) do
if flag.claimed.player == name then
alert = "You've got the flag! Run back and punch your flag!"
color = "0xFF0000"
break
elseif flag.team == tplayer.team then
alert = "Kill " .. flag.claimed.player .. ", they have your flag!"
color = "0xFF0000"
break
else
alert = "Protect " .. flag.claimed.player .. ", he's got the enemy flag!"
color = "0xFF0000"
end
end
end

View File

@ -10,6 +10,8 @@ ctf.register_on_init(function()
ctf._set("flag.capture_mode", "take")
ctf._set("flag.drop_time", 7*60)
ctf._set("flag.drop_warn_time", 60)
ctf._set("flag.alerts", true)
ctf._set("flag.alerts.neutral_alert", true)
ctf._set("gui.team.teleport_to_flag", true)
ctf._set("gui.team.teleport_to_spawn", false)
end)