sodak
28.01.2020, 14:08
Hey liebe Leser_innen
ich versuche zurzeit ein Addon nachzubauen, welches Suchtbunker auf ihrem DarkRP Server verwendet, und stehe vor dem Problem, dass ein DModelPanel im Swep:DrawHud() Hook ständig gecallt wird,
und das Model nicht verschwindet, wenn ich die Waffe nicht ausgewählt habe. Hier der Code
local VUMat = Material("idcard.png", "noclamp smooth")
local LP = LocalPlayer()
function SWEP:DrawHUD()
local GetPModel = LP:GetModel()
local LW, LH = 500, 250
local W,H = ScrW()-LW-5, ScrH()-LH-5
local LP = LocalPlayer()
PIcon = PIcon or vgui.Create( "DModelPanel")
PIcon:SetSize(76,65)
PIcon:SetModel(GetPModel)
function PIcon:LayoutEntity(ent) return end
PIcon:SetPos(W+64,H+135)
local eyepos = PIcon.Entity:GetBonePosition(PIcon.Entity:LookupBo ne("ValveBiped.Bip01_Head1"))
eyepos:Add(Vector(0, 0, -2)) -- Move up slightly
PIcon:SetLookAt(eyepos)
PIcon:SetCamPos(eyepos-Vector(-20, 0, 0)) -- Move cam in front of eyes
PIcon.Entity:SetEyeTarget(eyepos-Vector(-20, 0, 0))
surface.SetMaterial(VUMat)
surface.SetDrawColor(255, 255, 255, 255)
surface.DrawTexturedRect(W, H, LW, LH)
local TextW,TextH = W+160, H + 58
draw.SimpleText(LP:Nick(), "davinci_font", TextW, TextH, Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER )
draw.SimpleText(LP:SteamID64(), "davinci_font", TextW, TextH+30, Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER )
draw.SimpleText(LP:getDarkRPVar("job"), "davinci_font", TextW, TextH+60, Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER )
end
Ich möchte, dass wenn ich die Waffe nicht aktiv habe das ModelBild unten verschwindet.
Vielen Dank
ich versuche zurzeit ein Addon nachzubauen, welches Suchtbunker auf ihrem DarkRP Server verwendet, und stehe vor dem Problem, dass ein DModelPanel im Swep:DrawHud() Hook ständig gecallt wird,
und das Model nicht verschwindet, wenn ich die Waffe nicht ausgewählt habe. Hier der Code
local VUMat = Material("idcard.png", "noclamp smooth")
local LP = LocalPlayer()
function SWEP:DrawHUD()
local GetPModel = LP:GetModel()
local LW, LH = 500, 250
local W,H = ScrW()-LW-5, ScrH()-LH-5
local LP = LocalPlayer()
PIcon = PIcon or vgui.Create( "DModelPanel")
PIcon:SetSize(76,65)
PIcon:SetModel(GetPModel)
function PIcon:LayoutEntity(ent) return end
PIcon:SetPos(W+64,H+135)
local eyepos = PIcon.Entity:GetBonePosition(PIcon.Entity:LookupBo ne("ValveBiped.Bip01_Head1"))
eyepos:Add(Vector(0, 0, -2)) -- Move up slightly
PIcon:SetLookAt(eyepos)
PIcon:SetCamPos(eyepos-Vector(-20, 0, 0)) -- Move cam in front of eyes
PIcon.Entity:SetEyeTarget(eyepos-Vector(-20, 0, 0))
surface.SetMaterial(VUMat)
surface.SetDrawColor(255, 255, 255, 255)
surface.DrawTexturedRect(W, H, LW, LH)
local TextW,TextH = W+160, H + 58
draw.SimpleText(LP:Nick(), "davinci_font", TextW, TextH, Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER )
draw.SimpleText(LP:SteamID64(), "davinci_font", TextW, TextH+30, Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER )
draw.SimpleText(LP:getDarkRPVar("job"), "davinci_font", TextW, TextH+60, Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER )
end
Ich möchte, dass wenn ich die Waffe nicht aktiv habe das ModelBild unten verschwindet.
Vielen Dank