Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.04 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 pos = origin + offset
  26. local ang = (LocalPlayer():EyePos() - pos):Angle()
  27. ang.p = 0
  28. ang:RotateAroundAxis(ang:Right(), 90)
  29. ang:RotateAroundAxis(ang:Up(), 90)
  30. ang:RotateAroundAxis(ang:Forward(), 180)
  31.  
  32. local text = "Order a Hit"
  33.  
  34. cam.Start3D2D(pos, ang, 0.04)
  35. surface.SetFont("SH_ACC_VENDOR")
  36. local wi, he = surface.GetTextSize(text)
  37. local pad = 16
  38. wi = wi + pad * 2
  39. he = he + pad * 2
  40.  
  41. draw.RoundedBox(8, -wi * 0.5, -pad, wi, he, SH_ACC.Style.header)
  42.  
  43. draw.SimpleText(text, "SH_ACC_VENDOR", 0, 0, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP)
  44. cam.End3D2D()
  45. end
  46.  
  47. else
  48. function ENT:Initialize()
  49. self:SetModel( "models/props_trainstation/payphone001a.mdl" )
  50. self:PhysicsInit( SOLID_VPHYSICS )
  51. self:SetMoveType( MOVETYPE_VPHYSICS )
  52. self:SetSolid( SOLID_VPHYSICS )
  53. --self:SetRenderFX( kRenderFxSolidFast )
  54. self:SetUseType( SIMPLE_USE )
  55. local phys = self:GetPhysicsObject()
  56. if phys:IsValid() then phys:Wake() end
  57. end
  58.  
  59. function ENT:Use( null, caller, type )
  60. if !IsValid( caller ) or !caller:IsPlayer() then return end
  61. if caller.My_Hitman then caller.My_Hitman = nil end
  62. if not caller:Alive() or caller:isArrested() then return end
  63. 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
  64. if Executioner.Config.BlackList_Teams[ team.GetName( caller:Team() ) ] then
  65. Executioner.SendMessage( caller, Executioner.Language.PhoneNotInService )
  66. return
  67. end
  68. if not Executioner.Config.PhoneEnabled then
  69. if caller:IsSuperAdmin() or caller:IsAdmin() then
  70. 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" )
  71. else
  72. Executioner.SendMessage( caller, Executioner.Language.PhoneNotInService )
  73. end
  74. return
  75. end
  76. if Executioner.Config.Hitman_Teams[ team.GetName( caller:Team() ) ] then Executioner.SendMessage( caller, Executioner.Language.HitmanOnUsePhone ) return end
  77. if caller.rHit_PlaceCooldown and caller.rHit_PlaceCooldown > CurTime() then Executioner.SendMessage( caller, Executioner.Language.HitTooSoon ) return end
  78. if caller.rHit_PlacedHit or caller:GetNWBool( 'rHit_ActiveHit' ) then Executioner.SendMessage( caller, Executioner.Language.HitmanActiveHit ) return end
  79. net.Start( 'rHit.Open.Placement' )
  80. net.WriteTable( Executioner.PhoneTracker )
  81. net.Send( caller )
  82. end
  83.  
  84. hook.Add( 'CanTool', 'rHit.Prevent.Tool', function( self, trace, tool )
  85. if tool == 'remover' and IsValid( trace.Entity ) and trace.Entity:GetClass() == "phone_box" then
  86. if self:IsSuperAdmin() then return true else return false end
  87. end
  88. end )
  89.  
  90. hook.Add( 'PhysgunPickup', 'rHit.Prevent.Pickup', function( self, ent )
  91. if self:IsSuperAdmin() and ent:GetClass() == 'phone_box' then return true end
  92. end )
  93. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement