• Drawing Custom images?
    4 replies, posted
I have an idea of a modern warfare 2 server. Anyone who has played MW2 would know that when you kill an enemy it shows "50+" or "10+". [img] [url]http://img705.imageshack.us/i/mw2200.png/[/url] [/img] I would appreciate if someone could explain how i could show this animation or if i would have to make my own font and print it on the screen. Thanks! WAIT one more question :P how can i change the material of a weapon? thanks in advance
You don't need an image, just use [b][url=http://wiki.garrysmod.com/?title=Draw.DrawText]Draw.DrawText [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
how do i make it stay on the screen for like 2 seconds?
you can use a timer to stop the display of the drawtext, but you need to put your timer out of the drawhud function, otherwise the timer will run on every frames.
Use usermessages to hook it to when you kill someone. CLIENT-SIDE [lua] function DrawKillShit(um) local amount = um:ReadShort() hook.Add("HUDPaint","drawthekill",function() draw.DrawText("+"..amount,"ScoreboardText",ScrW() / 2,ScrH() / 2,Color(255,255,255,255),1) end) //change the color to yellow, i'm too lazy to do that :) timer.Simple(2,function() hook.Remove("HUDPaint","drawthekill") end) end usermessage.Hook("drawKillShit",DrawKillShit) [/lua] SERVER-SIDE [lua] function SendKillShit(victim,weapon,killer) umsg.Start("drawKillShit",killer) umsg.Short(100) umsg.End() end hook.Add("PlayerDeath","SendKillShit",SendKillShit) [/lua]
Sorry, you need to Log In to post a reply to this thread.