Skip to content
This repository has been archived by the owner on Aug 29, 2019. It is now read-only.

Commit

Permalink
Improve prompt HUD messages
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenwardy committed Oct 12, 2017
1 parent 6dd85f8 commit 730f090
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions ctf_flag/hud.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,35 @@ ctf.hud.register_part(function(player, name, tplayer)
alert = "Punch the enemy flag! Protect your flag!"
end
local claimed = ctf_flag.collect_claimed()
local enemyHolder = nil
local teamHolder = nil
for _, flag in pairs(claimed) do
if flag.claimed.player == name then
if flag.team == tplayer.team then
enemyHolder = flag.claimed.player
else
teamHolder = flag.claimed.player
end
end

if teamHolder == name then
if enemyHolder then
alert = "You can't capture the flag until " .. enemyHolder .. " is killed!"
color = "0xFF0000"
else
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!"
end
elseif teamHolder then
if enemyHolder then
alert = "Kill " .. enemyHolder .. " to allow " .. teamHolder .. " to capture the flag!"
color = "0xFF0000"
break
else
alert = "Protect " .. flag.claimed.player .. ", he's got the enemy flag!"
alert = "Protect " .. teamHolder .. ", they've got the enemy flag!"
color = "0xFF0000"
end
elseif enemyHolder then
alert = "Kill " .. enemyHolder .. ", they've got your flag!"
color = "0xFF0000"
end
end

Expand Down

0 comments on commit 730f090

Please sign in to comment.