Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if game.GetIPAddress () == '54.36.226.201:27022' then return end
- local e_lookup = { -- our lookup table, its defined as `class = {cvar, clr, text}`
- ix_vendingmachine = {
- CreateClientConVar ('hv_show_vendingmachine', 0, true, true, 'Should HelixVision show vending machines?'),
- Color (161, 0, 255),
- 'Vending Machine'
- },
- ix_forcefield = {
- CreateClientConVar ('hv_show_forcefield' , 0, true, true, 'Should HelixVision show forcefields?' ),
- Color ( 0, 199, 255),
- 'Forcefield'
- },
- ix_vendor = {
- CreateClientConVar ('hv_show_vendor' , 0, true, true, 'Should HelixVision show vendors?' ),
- Color ( 0, 255, 0),
- function (ent) return ('Vendor: %s'):format (ent:GetDisplayName ()) end
- },
- ix_money = {
- CreateClientConVar ('hv_show_money' , 0, true, true, 'Should HelixVision show money?' ),
- Color (187, 255, 0),
- 'Cash'
- },
- ix_item = {
- CreateClientConVar ('hv_show_item' , 1, true, true, 'Should HelixVision show items?' ),
- Color (255, 0, 8),
- function (ent) return ent:GetItemTable ().name end
- },
- }
- hook.Add ('HUDPaint', 'Time2DrawSumCheats', function ()
- local ents = ents.GetAll ()
- for a = 1, ents.GetCount () do -- sequential for loop is faster than pairs, getcount is faster than #
- local ent = ents [a]
- local lookup = e_lookup [ent:GetClass ()] -- our lookup table
- if not lookup then continue end -- if no lookup then we abort
- if lookup [1]:GetInt () ~= 1 then continue end -- if not activated then we abort
- -- draw.DrawText is just a wrapper for surface, we know everything so we can cut to the chase
- local pos = ent:GetPos ():ToScreen ()
- surface.SetFont 'ChatFont'
- local t = lookup [3]
- t = isstring (t) and t or t (ent) -- extra 2 calls but this is for modularity
- local w, h = surface.GetTextSize (t)
- local x, y = pos.x - w * 0.5, pos.y - h * 0.5
- surface.SetTextPos (x, y)
- surface.SetTextColour (lookup [2])
- surface.DrawText (t)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment