Please, tell me, how i can remove for DarkRP, this part of HUD:
[IMG]http://img267.imageshack.us/img267/3160/15320992.png[/IMG]
[QUOTE=SmallNibbler;39677187]Please, tell me, how i can remove for DarkRP, this part of HUD:
[IMG]http://img267.imageshack.us/img267/3160/15320992.png[/IMG][/QUOTE]
So, if you know how to remove the health and armor you will know were to put this.
[LUA]
"CHudAmmo"
"CHudSecondaryAmmo"
[/LUA]
This is the current code I use to remove those two elements from my HUD.
[lua]
local tohide = {
["CHudAmmo"] = true,
["CHudSecondaryAmmo"] = true
}
local function HUDShouldDraw(name)
if (tohide[name]) then
return false;
end
end
hook.Add("HUDShouldDraw", "HUD Hide", HUDShouldDraw)
[/lua]
Thanks, it works.
No problem, Nibbler. If you need any more help related in Lua please, don't hesitate to PM me on the forums. ;)
[QUOTE=mib999;39677737]This is the current code I use to remove those two elements from my HUD.
[lua]
local tohide = {
["CHudAmmo"] = true,
["CHudSecondaryAmmo"] = true
}
local function HUDShouldDraw(name)
if (tohide[name]) then
return false;
end
end
hook.Add("HUDShouldDraw", "HUD Hide", HUDShouldDraw)
[/lua][/QUOTE]
[lua]
local tohide = {
["CHudAmmo"] = false,
["CHudSecondaryAmmo"] = false
}
local function HUDShouldDraw(name)
return tohide[name] or true
end
hook.Add("HUDShouldDraw", "HUD Hide", HUDShouldDraw)
[/lua]
[QUOTE=CrashLemon;39682351][lua]
local tohide = {
["CHudAmmo"] = false,
["CHudSecondaryAmmo"] = false
}
local function HUDShouldDraw(name)
return tohide[name] or true
end
hook.Add("HUDShouldDraw", "HUD Hide", HUDShouldDraw)
[/lua][/QUOTE]
This is wrong for 2 reasons.
First, this will always return true, it prevents other hooks from being called.
Just do this and it will work.
[LUA]
function hidehud(name)
for k, v in pairs({"CHudHealth", "CHudBattery", "CHudAmmo", "CHudSecondaryAmmo"})do
if name == v then return false end
end
end
hook.Add("HUDShouldDraw", "HideHUD", hidehud)
[/LUA]
[QUOTE=Wizard of Ass;39683096]This is wrong for 2 reasons.
First, this will always return true, it prevents other hooks from being called.[/QUOTE]
Although I agree with the second, why would it always return true?
because no matter what tohide[name] will be either false or nil - and Lua will then take the next part ie true
Sorry, you need to Log In to post a reply to this thread.