Problème avec mon hud

  • Initiateur de la discussion
DinamoPerixx

DinamoPerixx

Geek suprême
Messages
100
Score réaction
6
Points
115
bonjour,
Quand je lance gmod avec cet hud, il me dis qu'il y a un problème avec une ligne qui est la ligne 78, mais j'ai vérifier sur d'autre forum et ils m ont dis que le code est bon.

[ quote ]
----------------------------------------------------------------
-- HUD RedWood
-----------------------------------------------------------------

-----------------------------------------------------------------
-- HUD COFIG
-----------------------------------------------------------------



-----------------------------------------------------------------
-- SUPP HUD
-----------------------------------------------------------------
local hideHUDElements = {
["DarkRP_HUD"] = true,
["DarkRP_HUD"] = true,

}

hook.Add("HUDShouldDraw", "flatHUD_HideDefaultDarkRPHud", function(name)
if hideHUDElements[name] then return false end
end)

-----------------------------------------------------------------
-- HUD POLICE
-----------------------------------------------------------------
surface.CreateFont("police",{
font = "Arial",
size = 18,
weight = 400,
antialias = true
})

-----------------------------------------------------------------
-- HUD PAINT
-----------------------------------------------------------------

hook.Add( "HUDPaint", "HUDPaint_DrawABox", function()
-- base de l'hud
draw.RoundedBox( 0, 10, 1000, 330, 70, Color( 61, 61, 61, 255 ) )
draw.RoundedBox( 0, 10, 930, 230, 70, Color( 61, 61, 61, 255 ) )
draw.RoundedBox( 0, 240, 930, 100, 70, Color( 61, 61, 61, 225 ) )
draw.RoundedBox( 0, 10, 910, 100, 20, Color( 61, 61, 61, 255 ) )
draw.RoundedBox( 0, 10, 1000, 330, 2, Color( 0, 0, 0, 255 ) )
draw.RoundedBox( 0, 240, 930, 2, 70, Color( 0, 0, 0, 255 ) )
-- Nom du serveur
draw.DrawText( "RedWood", "police", 23, 910, Color( 40, 40, 40, 255 ), 0, 0)
-- effet (vie, armure & faim)
draw.RoundedBox( 5, 60, 960, 175, 15, Color( 0, 0, 0, 200 ) )
draw.RoundedBox( 5, 60, 980, 175, 15, Color( 0, 0, 0, 200 ) )
draw.RoundedBox( 5, 60, 940, 175, 15, Color( 0, 0, 0, 200 ) )
-- gestion de vie
local health = (LocalPlayer():Health() or 0)
if health > 100 then health = 100 end
if health < 0 then health = 0 end

draw.RoundedBox( 0, 60, 960, health * 1.7, 10, Color( 255, 0, 0, 255 ))
draw.SimpleText( health.."%", "police", 15, 955, Color( 255, 255, 255, 255 ))
-- gestion d'armure
local armor = (LocalPlayer():Armor() or 0)
if armor > 100 then armor = 100 end
if armor < 0 then armor = 0 end

draw.RoundedBox( 0, 60, 980, armor * 1.7, 10, Color( 0, 0, 255, 255 ))
draw.SimpleText( armor.."%", "police", 15, 975, Color( 255, 255, 255, 255 ))
-- gestion de faim
local hunger = math.ceil(LocalPlayer():getDarkRPVar("Energy") or 0)
if hunger > 100 then hunger = 100 end
if hunger < 0 then hunger = 0 end
draw.RoundedBox( 0, 60, 940, hunger * 1.7, 10, Color( 0, 255, 0, 255 ))
draw.SimpleText( hunger.."%", "police", 15, 935, Color( 255, 255, 255, 255 ))

-- salaire
local salaire = LocalPlayer():getDarkRPVar("salary")
draw.SimpleText( salaire.."$", "police", 260, 1040, Color( 255, 255, 255, 255 ))

-- job
local job = team.GetName(LocalPlayer():Team())
draw.SimpleText( job.."", "police", 25, 1040, Color( 255, 255, 255, 255 ))

-- nom
local name = LocalPlayer():Name()
draw.SimpleText( name, "police", 25, 1010, Color( 255, 255, 255, 255 ))
-- money
local money = LocalPlayer():getDarkRPVar("money")
draw.SimpleText( money.."$", "police", 260, 1010, Color( 255, 255, 255, 255 ))
-- license
local Page = Material("icon16/page_white_text.png")
local NoPage = Material("icon16/page_white_delete.png")

if LocalPlayer().DarkRPVars.HasGunlicense then
surface.SetMaterial(Page)
surface.SetDrawColor(255, 255, 255, 255)
surface.DrawTexturedRect(320, 1012, 13, 13)
else
surface.SetMaterial(NoPage)
surface.SetDrawColor(255, 255, 255, 255)
surface.DrawTexturedRect(320, 1012, 13, 13)
end
-----------------------------------------------------------------
-- HUD AGENDA
-----------------------------------------------------------------

local agenda = LocalPlayer():getAgendaTable()
if not agenda then return end
agendaText = agendaText or DarkRP.textWrap((LocalPlayer():getDarkRPVar("agenda") or ""):gsub("//", "\n"):gsub("\\n", "\n"), "DarkRPHUD1", 440)

draw.RoundedBox( 10, 10, 10, 460, 110, Color(61, 61, 61, 155) )
draw.RoundedBox( 10, 12, 12, 456, 106, Color(61, 61, 61,100) )
draw.RoundedBox( 10, 12, 12, 456, 20, Color(255, 255, 255, 255) )

draw.DrawNonParsedText( agenda.Title, "police", 30, 12, Color(0, 0, 0, 255), 0 )
draw.DrawNonParsedText( agendaText, "DarkRPHUD1", 30, 35, Color(0, 0, 0, 255), 0 )

if ply != LocalPlayer() then return end

if var == "agenda" and new then
agendaText = DarkRP.textWrap(new:gsub("//", "\n"):gsub("\\n", "\n"), "DarkRPHUD1", 440)
else
agendaText = nil
end


end )

-----------------------------------------------------------------
-- HUD AMMO
-----------------------------------------------------------------



-----------------------------------------------------------------
-- HUD PLAYER MODEL
-----------------------------------------------------------------

if(CLIENT)then

local function PlayerModel()
local ply=LocalPlayer()


PlayerModel = vgui.Create("DModelPanel")
function PlayerModel:LayoutEntity( Entity ) return end
PlayerModel:SetModel( LocalPlayer():GetModel() )
PlayerModel:SetPos(250,800)
PlayerModel:SetSize(75, 200)
PlayerModel:SetCamPos(Vector( 28, 0, 65))
PlayerModel:SetLookAt(Vector( - 20, 0, 105))

timer.Create( "UpdatePlayerModel", 0.5, 0, function()
if LocalPlayer():GetModel() != PlayerModel.Entity:GetModel() then
PlayerModel:Remove()
PlayerModel = vgui.Create("DModelPanel")
function PlayerModel:LayoutEntity( Entity ) return end
PlayerModel:SetModel( LocalPlayer():GetModel())
PlayerModel:SetPos(250,800)
PlayerModel:SetSize(75, 200)
PlayerModel:SetCamPos(Vector( 28, 0, 65))
PlayerModel:SetLookAt(Vector( - 20, 0, 105))
end
end)

end

hook.Add("InitPostEntity", "PlayerModel", PlayerModel)

end
[ /quote ]
 
Discord d'entraide
Rejoignz-nous sur Discord