Advertisement
Exho

Untitled

Sep 1st, 2014
455
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. AddCSLuaFile()
  2. local bList = {} or bList
  3.  
  4. ---- Entity Remover ----
  5. -- Author: Exho
  6. -- V: 8/15/14
  7.  
  8.  
  9. ------ //BLACKLIST//------
  10. local Range = 60 -- The radius around the Vectors that Entity Remover searches
  11. -- Place the copied code from console in here
  12. bList[1] = {map = 'mapname', class = 'prop_physics', index = 000, pos = Vector(0, 0, 0)}
  13.  
  14.  
  15.  
  16. ------ //END BLACKLIST//------
  17.  
  18. local function BlacklistEntity(ply)
  19. local tr = ply:GetEyeTrace()
  20. local object = tr.Entity
  21. if not IsValid( object ) then return false end
  22.  
  23. if not tr.HitWorld and not object:IsPlayer() and not object:IsNPC() then
  24. local pos = object:GetPos()
  25. local class = object:GetClass()
  26. local map = game.GetMap()
  27. local index = object:EntIndex()
  28. local loc = (#bList + 1)
  29. local x = math.Round(pos.x)
  30. local y = math.Round(pos.y)
  31. local z = math.Round(pos.z)
  32. print("****")
  33. print("[ER]: Created new Blacklist entry")
  34. print("bList["..loc.."] = {map = '"..map.."', class = '"..class.."', index = "..index..", pos = Vector("..x..","..y..","..z..")}")
  35. print("[ER]: Paste this into the Entity Remove lua file under the other table entries")
  36. print("****")
  37. else
  38. ply:ChatPrint("You cannot blacklist that entity")
  39. end
  40. end
  41.  
  42. local Sayings = {"was nuked from orbit", "bombed like Hiroshima", "got rekt", "was deleted", "met its demise",
  43. "was kaboomed", "was transported to the 4th dimension", "was smitted", "got whooped",
  44. }
  45.  
  46. local function RemoveBListEntities()
  47. print("****")
  48. print("Removing blacklisted entities")
  49. local map = game.GetMap()
  50. for k,v in pairs(bList) do
  51. if v.map == map then
  52. local class = v.class
  53. local pos = v.pos
  54. local index = v.index
  55. --print(tostring(pos))
  56.  
  57. possibles = ents.FindInSphere(pos, Range)
  58. for o, p in pairs(possibles) do
  59. if p:GetClass() == class then
  60. if p:EntIndex() == index then
  61. local phrase = Sayings[math.random(#Sayings)]
  62. print(class.." "..phrase.." by Entity Remover at "..tostring(pos))
  63. p:Remove()
  64. end
  65. end
  66. end
  67. else
  68. print("This map does not have any blacklisted entities")
  69. end
  70. end
  71. print("Finished removing any blacklisted entities!")
  72. print("****")
  73. end
  74.  
  75. hook.Add("PlayerSay", "ChatEntitySelector", function(ply, text)
  76. local text = string.lower(text)
  77.  
  78. if ( string.sub( text, 1, 11 ) == "!entremove" ) then
  79. if ply:IsSuperAdmin() then -- Nobody else should be able to use this
  80. ply:ChatPrint("Check your console!")
  81. ply:ConCommand("er_blacklistent")
  82. else
  83. ply:ChatPrint("Sorry but your rank cannot remove entities :(")
  84. end
  85. return false
  86. end
  87. end)
  88. hook.Add("InitPostEntity", "RemovingTheBaddies", RemoveBListEntities)
  89.  
  90. concommand.Add( "er_nukemap",function(ply)
  91. if not ply:IsSuperAdmin() then return false end
  92. print( "Removed all the blacklisted entities from this map!" )
  93. RemoveBListEntities()
  94. end )
  95. concommand.Add( "er_blacklistent",function( ply )
  96. if not ply:IsSuperAdmin() then return false end
  97. print( "Blacklisting entity directly in front of player!" )
  98. BlacklistEntity(ply)
  99. end )
  100. concommand.Add( "er_blacklist_print",function(ply)
  101. print("Printing the blacklist table!")
  102. PrintTable(bList)
  103. end )
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement