Better help hints
This commit is contained in:
parent
cd43aedca5
commit
f8d56da0f0
@ -41,13 +41,13 @@ ctf.hud.register_part(function(player, name, tplayer)
|
||||
hud_elem_type = "text",
|
||||
position = {x = 1, y = 0},
|
||||
scale = {x = 100, y = 100},
|
||||
text = tplayer.team,
|
||||
text = "Team " .. tplayer.team,
|
||||
number = color,
|
||||
offset = {x = -20, y = 20},
|
||||
alignment = {x = -1, y = 0}
|
||||
})
|
||||
else
|
||||
ctf.hud:change(player, "ctf:hud_team", "text", tplayer.team)
|
||||
ctf.hud:change(player, "ctf:hud_team", "text", "Team " .. tplayer.team)
|
||||
ctf.hud:change(player, "ctf:hud_team", "number", color)
|
||||
end
|
||||
end)
|
||||
|
@ -80,25 +80,35 @@ ctf.hud.register_part(function(player, name, tplayer)
|
||||
end)
|
||||
|
||||
ctf.hud.register_part(function(player, name, tplayer)
|
||||
local alert = nil
|
||||
local team = ctf.team(tplayer.team)
|
||||
for _, flag in pairs(team.flags) do
|
||||
if flag.claimed then
|
||||
-- Check all flags
|
||||
local alert = "Punch the enemy flag! Protect your flag!"
|
||||
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"
|
||||
elseif flag.team == tplayer.team then
|
||||
alert = "Kill " .. flag.claimed.player .. ", they have your flag!"
|
||||
break
|
||||
color = "0xFF0000"
|
||||
else
|
||||
alert = "Protect " .. flag.claimed.player .. ", he's got the enemy flag!"
|
||||
color = "0xFF0000"
|
||||
end
|
||||
end
|
||||
|
||||
-- Display alert
|
||||
if alert then
|
||||
if ctf.hud:exists(player, "ctf:hud_team_alert") then
|
||||
ctf.hud:change(player, "ctf:hud_team_alert", "text", alert)
|
||||
ctf.hud:change(player, "ctf:hud_team_alert", "number", color)
|
||||
else
|
||||
ctf.hud:add(player, "ctf:hud_team_alert", {
|
||||
hud_elem_type = "text",
|
||||
position = {x = 1, y = 0},
|
||||
scale = {x = 100, y = 100},
|
||||
text = alert,
|
||||
number = "0xFF0000",
|
||||
number = color,
|
||||
offset = {x = -10, y = 50},
|
||||
alignment = {x = -1, y = 0}
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user