• *Help* Hud drawing images.
    1 replies, posted
Hi all I have an element on my hud. But I only want it to appear when you the player has killed another player. Here is my code atm I hope someone can provide me with a small solution to this issue. [code] draw.RoundedBox( 4, 1700, 500, 220, 170, Color( 144,200,149,255 ) ) surface.SetMaterial(hudimage) surface.SetDrawColor(225, 225, 225 ) surface.DrawTexturedRect(1710, 520, ScrW()/13, ScrH()/8 ) [/code] I thought I could perhaps hook it to make it appear using something like this, but I wasn't sure how to go about it. [code] hook.Add("PlayerDeath", "sex", function(victim, inf, attack) if ( inf and inf:GetClass() == "infnigun" and attack and attack:IsValid() and attack:IsPlayer() [/code] Any help is greatly appreciated. Thanks. -Duby
draw functions cannot be called outside HUDPaint and anything alike. PlayerDeath gets called once, while HUDPaint etc. get called each frame, in other words: you have to use HUDPaint.
Sorry, you need to Log In to post a reply to this thread.