Aek177

TTT perk machine cl_init.lua

Jun 13th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. include("shared.lua")
  2.  
  3.  
  4. function ENT:Draw()
  5. self:DrawModel()
  6. local ply = LocalPlayer()
  7. if ply:GetEyeTrace().Entity == self and (self:GetPos():Distance(ply:GetPos())) < 120 then
  8. local perk = tostring(self:GetNWString("MachineID"))
  9. local data = ZARP.PerkData[perk] or {}
  10. local points = data.cost or "Unknown"
  11. local str = string.format("Press E to buy %s (%s Points)",perk,tostring(points))
  12.  
  13. ply.ViewingPerk = true
  14. ply.ViewingText = str
  15. else
  16. ply.ViewingPerk = false
  17. end
  18. end
  19.  
  20. hook.Add("HUDPaint", "DrawPlayerHUDPerk", function()
  21. local ply = LocalPlayer()
  22. if ply.ViewingPerk then
  23. surface.SetFont("OpenSans24Font")
  24. local width, height = surface.GetTextSize(ply.ViewingText)
  25. draw.SimpleTextOutlined(ply.ViewingText, "OpenSans24Font", ScrW()/2-width/2, ScrH()/2-height/2, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP,1.5,Color(0,0,0))
  26. end
  27. end)
Advertisement
Add Comment
Please, Sign In to add comment