Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.07 KB | None | 0 0
  1. AddCSLuaFile()
  2.  
  3. ENT.Base = "base_gmodentity"
  4. ENT.Type = "anim"
  5.  
  6. ENT.Category = "ted.lua"
  7. ENT.Spawnable = true
  8.  
  9. ENT.PrintName = "Phone Box"
  10. ENT.Author = "ted.lua"
  11. ENT.Purpose = "Call your local hitman."
  12. ENT.Instructions = ""
  13.  
  14. if CLIENT then
  15. surface.CreateFont( "rHit.Font.PhoneBox", { font = "BFHUD", size = 90, weight = 800, bold = true } )
  16. local v = Vector()
  17.  
  18. function ENT:DrawTranslucent()
  19. self:DrawModel()
  20.  
  21. local origin = self:GetPos()
  22. if (LocalPlayer():GetPos():Distance(origin) >= 768) then
  23. return end
  24.  
  25. local offset = Vector( 0, 0, 90 )
  26. local pos = origin + offset
  27. local ang = (LocalPlayer():EyePos() - pos):Angle()
  28. ang.p = 0
  29. ang:RotateAroundAxis(ang:Right(), 90)
  30. ang:RotateAroundAxis(ang:Up(), 90)
  31. ang:RotateAroundAxis(ang:Forward(), 180)
  32.  
  33. local text = "Order a Hit"
  34.  
  35. cam.Start3D2D(pos, ang, 0.04)
  36. surface.SetFont("SH_ACC_VENDOR")
  37. local wi, he = surface.GetTextSize(text)
  38. local pad = 16
  39. wi = wi + pad * 2
  40. he = he + pad * 2
  41.  
  42. draw.RoundedBox(8, -wi * 0.5, -pad, wi, he, SH_ACC.Style.header)
  43.  
  44. draw.SimpleText(text, "SH_ACC_VENDOR", 0, 0, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP)
  45. cam.End3D2D()
  46. end
  47.  
  48. else
  49. function ENT:Initialize()
  50. self:SetModel( "models/props_trainstation/payphone001a.mdl" )
  51. self:PhysicsInit( SOLID_VPHYSICS )
  52. self:SetMoveType( MOVETYPE_VPHYSICS )
  53. self:SetSolid( SOLID_VPHYSICS )
  54. --self:SetRenderFX( kRenderFxSolidFast )
  55. self:SetUseType( SIMPLE_USE )
  56. local phys = self:GetPhysicsObject()
  57. if phys:IsValid() then phys:Wake() end
  58. end
  59.  
  60. function ENT:Use( null, caller, type )
  61. if !IsValid( caller ) or !caller:IsPlayer() then return end
  62. if caller.My_Hitman then caller.My_Hitman = nil end
  63. if not caller:Alive() or caller:isArrested() then return end
  64. if Executioner.Config.No_Place_Teams[ team.GetName( caller:Team() ) ] then Executioner.SendMessage( caller, 'You can not place a hit as this job.' ) return end
  65. if Executioner.Config.BlackList_Teams[ team.GetName( caller:Team() ) ] then
  66. Executioner.SendMessage( caller, Executioner.Language.PhoneNotInService )
  67. return
  68. end
  69. if not Executioner.Config.PhoneEnabled then
  70. if caller:IsSuperAdmin() or caller:IsAdmin() then
  71. Executioner.SendMessage( caller, "As you are an Admin, only you can see this. If you are trying to use the phone, you must enable it in the config: Executioner.Config.PhoneEnabled = true" )
  72. else
  73. Executioner.SendMessage( caller, Executioner.Language.PhoneNotInService )
  74. end
  75. return
  76. end
  77. if Executioner.Config.Hitman_Teams[ team.GetName( caller:Team() ) ] then Executioner.SendMessage( caller, Executioner.Language.HitmanOnUsePhone ) return end
  78. if caller.rHit_PlaceCooldown and caller.rHit_PlaceCooldown > CurTime() then Executioner.SendMessage( caller, Executioner.Language.HitTooSoon ) return end
  79. if caller.rHit_PlacedHit or caller:GetNWBool( 'rHit_ActiveHit' ) then Executioner.SendMessage( caller, Executioner.Language.HitmanActiveHit ) return end
  80. net.Start( 'rHit.Open.Placement' )
  81. net.WriteTable( Executioner.PhoneTracker )
  82. net.Send( caller )
  83. end
  84.  
  85. hook.Add( 'CanTool', 'rHit.Prevent.Tool', function( self, trace, tool )
  86. if tool == 'remover' and IsValid( trace.Entity ) and trace.Entity:GetClass() == "phone_box" then
  87. if self:IsSuperAdmin() then return true else return false end
  88. end
  89. end )
  90.  
  91. hook.Add( 'PhysgunPickup', 'rHit.Prevent.Pickup', function( self, ent )
  92. if self:IsSuperAdmin() and ent:GetClass() == 'phone_box' then return true end
  93. end )
  94. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement