Hud update.

This commit is contained in:
Coder12a 2018-10-27 20:06:48 -05:00
parent ae678e83ef
commit ee23ba96f8
2 changed files with 24 additions and 9 deletions

View File

@ -1005,7 +1005,19 @@ minetest.register_on_leaveplayer(
function(player)
local name = player:get_player_name()
local faction = factions.get_player_faction(name)
local id_name1 = name .. "factionLand"
if hud_ids[id_name1] then
hud_ids[id_name1] = nil
end
if faction then
local id_name2 = name .. "factionName"
local id_name3 = name .. "powerWatch"
if hud_ids[id_name2] then
hud_ids[id_name2] = nil
end
if hud_ids[id_name3] then
hud_ids[id_name3] = nil
end
faction.offlineplayers[name] = 1
faction.onlineplayers[name] = nil
end

21
hud.lua
View File

@ -2,15 +2,18 @@ hud_ids = {}
function createHudfactionLand(player)
local name = player:get_player_name()
hud_ids[name .. "factionLand"] = player:hud_add({
hud_elem_type = "text",
name = "factionLand",
number = 0xFFFFFF,
position = {x=0.1, y = .98},
text = "Wilderness",
scale = {x=1, y=1},
alignment = {x=0, y=0},
})
local id_name = name .. "factionLand"
if not hud_ids[id_name] then
hud_ids[id_name] = player:hud_add({
hud_elem_type = "text",
name = "factionLand",
number = 0xFFFFFF,
position = {x=0.1, y = .98},
text = "Wilderness",
scale = {x=1, y=1},
alignment = {x=0, y=0},
})
end
end
function createHudFactionName(player,factionname)