• Point System
    2 replies, posted
Wondering if anyone has a code or is willing to write me a code for "points". The way I imagine it working is players start with "x" points and they get points for every hit on an npc. the points will be displayed in simple text in the bottum of their screen. I would learn off that code and implimant a system to "spend" points on weapons and other things in our map afterwards. This is vital to our gamemode but am still fairly newb at coding. This would be greatly appreciated post, or PM me for steam info if you want to help. Thanks in advance I hope someone is willing to help, Thanks Facepunch :)
Something like this? [b]init.lua[/b] [lua]function GM:EntityTakeDamage(ent, infl, att, amount, gmdinfo) if ent:IsNPC() then att.Points = (att.Points or 0) + 1; umsg.Start("PointGain", att); umsg.End(); end end[/lua] [b]cl_init.lua[/b] [lua]local points = 0; local col = Color(255, 165, 0, 255); function GM:HUDPaint() draw.SimpleText("Points: "..points, "ScoreboardText", ScrW()/2, ScrH()-20, col, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER); end usermessage.Hook("PointGain", function(um) points = points + 1; end);[/lua]
Hey thanks a bunch that is a great starter for me :) have a useful
Sorry, you need to Log In to post a reply to this thread.