• hud not displaying images
    4 replies, posted
can someone please look at this code and tell me if i made some easy mistake? [QUOTE]local client = LocalPlayer() function zerohud() if not IsValid(client) or not client:Alive() then return end --[[if (client:GetActiveWeapon() == NULL or client:GetActiveWeapon() == "Camera") then return end --instead of checking if GetActiveWeapon() == NULL, you can use the function IsValid(client:GetActiveWeapon()) if not IsValid(client:GetActiveWeapon()) then return end draw.RoundedBox(3, 5, 5, 200, 100, Color(0, 0, 51, 255)) if client:Health() > 0 and client:Health() <= 25 then surface.SetTexture('materials/health/Health_danger') --the path has to be a string elseif client:Health() > 25 and client:Health() <= 100 then surface.SetTexture('materials/health/Health_Fine') --the path has to be a string end surface.SetDrawColor(Color(255, 255, 255, 255)) surface.DrawTexturedRect(0, 0, 8, 8) local mag_left = client:GetActiveWeapon():Clip1() // How much ammunition you have inside the current magazine local mag_extra = client:GetAmmoCount(client:GetActiveWeapon():GetPrimaryAmmoType()) // How much ammunition you have outside the current magazine local secondary_ammo = client:GetAmmoCount(client:GetActiveWeapon():GetSecondaryAmmoType())// How much ammunition you have for your secondary fire, such as the MP7's grenade launcher end local tohide = { -- This is a table where the keys are the HUD items to hide ["CHudHealth"] = true, ["CHudBattery"] = true, ["CHudAmmo"] = true, ["CHudSecondaryAmmo"] = true } local function HUDShouldDraw(name) if (tohide[name]) then return false; -- Return false. end end hook.Add("HUDPaint", "zerohud", zerohud)[/QUOTE]
[quote]--[[ [/quote] well, you commented all of your code out (fourth line) alsoooo, use lua tags when you post lua here instead of code
[QUOTE=DylanWilson;32722065]well, you commented all of your code out (fourth line) alsoooo, use lua tags when you post lua here instead of code[/QUOTE] Your right dylan, It seems as if people dont read their code. Probably using notepad to code lol Plus line 22 and 23 you did [lua] local mag_extra = client:GetAmmoCount(client:GetActiveWeapon():GetPr imaryAmmoType()) local secondary_ammo = client:GetAmmoCount(client:GetActiveWeapon():GetSe condaryAmmoType())[/lua] It should be [lua] local mag_extra = client:GetAmmoCount(client:GetActiveWeapon():GetPrimaryAmmoType()) local secondary_ammo = client:GetAmmoCount(client:GetActiveWeapon():GetSecondaryAmmoType())[/lua] Like dylan said put it in lua tags, not code tags [lua]local client = LocalPlayer() function zerohud() if not IsValid(client) or not client:Alive() then return end --if (client:GetActiveWeapon() == NULL or client:GetActiveWeapon() == "Camera") then return end --instead of checking if GetActiveWeapon() == NULL, you can use the function IsValid(client:GetActiveWeapon()) if not IsValid(client:GetActiveWeapon()) then return end draw.RoundedBox(3, 5, 5, 200, 100, Color(0, 0, 51, 255)) if client:Health() > 0 and client:Health() <= 25 then surface.SetTexture('materials/health/Health_danger') --the path has to be a string elseif client:Health() > 25 and client:Health() <= 100 then surface.SetTexture('materials/health/Health_Fine') --the path has to be a string end surface.SetDrawColor(Color(255, 255, 255, 255)) surface.DrawTexturedRect(0, 0, 8, 8) local mag_left = client:GetActiveWeapon():Clip1() // How much ammunition you have inside the current magazine local mag_extra = client:GetAmmoCount(client:GetActiveWeapon():GetPrimaryAmmoType()) // How much ammunition you have outside the current magazine local secondary_ammo = client:GetAmmoCount(client:GetActiveWeapon():GetSecondaryAmmoType())// How much ammunition you have for your secondary fire, such as the MP7's grenade launcher end local tohide = { -- This is a table where the keys are the HUD items to hide ["CHudHealth"] = true, ["CHudBattery"] = true, ["CHudAmmo"] = true, ["CHudSecondaryAmmo"] = true } local function HUDShouldDraw(name) if (tohide[name]) then return false; -- Return false. end end hook.Add("HUDPaint", "zerohud", zerohud)[/lua]
[QUOTE=Netsurfers;32723073]Your right dylan, It seems as if people dont read their code. Probably using notepad to code lol[/QUOTE] thanks, and yeah. for some reason when i install n++ it seems to disapear, shortcuts, program files and all
Well check your code over before posting, It saves a few dumb ratings that somebodys probably gonna give ya Hope everything works out.
Sorry, you need to Log In to post a reply to this thread.