Advertisement
Guest User

Untitled

a guest
Aug 27th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.41 KB | None | 0 0
  1. --[[-------------------------------------------------------------------------
  2. Actual code to freeze props.
  3. ---------------------------------------------------------------------------]]
  4. local function fucktheprops(ply,ent)
  5. if ent:GetClass() == "prop_physics" then
  6. local phys = ent:GetPhysicsObject()
  7. if (IsValid(phys)) then
  8. phys:EnableMotion(false)
  9. end
  10. end
  11. end
  12. hook.Add("PhysgunDrop", "phys", fucktheprops)
  13. --[[-------------------------------------------------------------------------
  14. Timer otherwise it wont freeze on spawn properly.
  15. ---------------------------------------------------------------------------]]
  16. local function timerprops()
  17. timer.Simple(0.1, fucktheprops)
  18. end
  19. --[[-------------------------------------------------------------------------
  20. Collide the meth system recipes.
  21. ---------------------------------------------------------------------------]]
  22. local function ShouldNotCollide_hr_cm( ent1, ent2 )
  23.  
  24. if string.match(ent1:GetClass(),"hr_cm_") != nil or string.match(ent2:GetClass(),"hr_cm_") != nil then
  25.  
  26. if ent1:GetClass() == "player" or ent2:GetClass() == "player" then return true end
  27. if ent1:GetClass() == "worldspawn" or ent2:GetClass() == "worldspawn" then return true end
  28. if ent1:GetClass() == "hr_cm_stove" or ent2:GetClass() == "hr_cm_stove" then return true end
  29. return false
  30. end
  31.  
  32. return true
  33.  
  34. end
  35. hook.Add( "ShouldCollide", "ShouldNotCollide_hr_cm", ShouldNotCollide_hr_cm )
  36.  
  37.  
  38. local function MarkNew_hr_cm()
  39.  
  40. for k,v in pairs(ents.FindByClass( "hr_cm_*")) do
  41. v:SetCustomCollisionCheck( true )
  42. end
  43.  
  44. end
  45. hook.Add( "Tick", "CheckForNew_hr_cm",MarkNew_hr_cm)
  46. --[[-------------------------------------------------------------------------
  47. Hooks.
  48. ---------------------------------------------------------------------------]]
  49. hook.Add("PlayerSpawnProp","FUCKTHEPROPSMAN", timerprops)
  50. hook.Add("PhysgunDrop", "phys", fucktheprops)
  51. --[[-------------------------------------------------------------------------
  52. Adv dupe exploit.
  53. ---------------------------------------------------------------------------]]
  54. hook.Add("PlayerSpawnedProp", "removeBlackListedModel", function(ply, model, ent)
  55. if (tostring(ent:GetPhysicsObject()) == "[NULL PhysObject]") then
  56. ent:Remove()
  57. end
  58. end)
  59.  
  60. hook.Add("OnEntityCreated", "deleteThePieceOfShitAdvDupeEntity", function(ent)
  61. if(ent:GetClass() == "gmod_contr_spawner")then ent:Remove()
  62. elseif(ent:GetClass() == "keypad" or ent:GetClass() == "gmod_button" or string.find(ent:GetClass(), "wire_") != nil or ent:GetClass() == "gmod_cameraprop*")then
  63. timer.Simple(0.01, function()
  64. local tempstring = tostring(ent:CPPIGetOwner())
  65. if(tempstring == "nil")then
  66. ent:Remove()
  67. elseif(tostring(ent:GetPhysicsObject()) == "[NULL PhysObject]")then
  68. ent:Remove()
  69. end
  70. end)
  71. end
  72.  
  73. if(ent:GetClass() == "gmod_wire_keyboard")then
  74. for k, v in pairs(player.GetAll())do
  75. if(v:IsSuperAdmin())then
  76. timer.Simple(0, function()
  77. v:PrintMessage(HUD_PRINTTALK, "Ent physobj: "..tostring(ent:GetPhysicsObject()))
  78. end)
  79. end
  80. end
  81. end
  82. end)
  83. --[[-------------------------------------------------------------------------
  84. materials on car restrict.
  85. ---------------------------------------------------------------------------]]
  86. hook.Add("CanTool","RestrictCarMaterialer",function( ply, tr, tool )
  87. if tool == "material" and IsValid( tr.Entity ) and tr.Entity:GetClass() == "prop_vehicle_jeep" then
  88. return false
  89. end
  90. end)
  91. --[[-------------------------------------------------------------------------
  92. Button exploit fix.
  93. ---------------------------------------------------------------------------]]
  94. local buttonList = {
  95. "models/maxofs2d/button_01.mdl",
  96. "models/maxofs2d/button_02.mdl",
  97. "models/maxofs2d/button_03.mdl",
  98. "models/maxofs2d/button_04.mdl",
  99. "models/maxofs2d/button_05.mdl",
  100. "models/maxofs2d/button_06.mdl",
  101. "models/maxofs2d/button_slider.mdl"
  102. }
  103.  
  104. hook.Add("CanTool", "ToolExploitFix", function(ply, tr, tool)
  105. if tool == "button" then
  106. local model = ply:GetInfo( "button_model" )
  107. if not table.HasValue( buttonList, model ) then
  108. ply:ConCommand( "button_model models/maxofs2d/button_05.mdl" )
  109. ply:ConCommand( "button_model" )
  110. return false
  111. end
  112. end
  113. end)
  114. --[[-------------------------------------------------------------------------
  115. Ip write warner.
  116. ---------------------------------------------------------------------------]]
  117. local ipwarns = {}
  118.  
  119. hook.Add("PlayerSay", "preventIpsInChat", function( ply, text )
  120. if(!ply:IsSuperAdmin())then
  121. if(string.match( text, "%d+%.%d+%.%d+%.%d+") != nil)then
  122. local foundIP = string.match( text, "%d+%.%d+%.%d+%.%d+")
  123. --add to warnings
  124. if(ipwarns[ply:SteamID()] == nil)then
  125. ipwarns[ply:SteamID()] = 1
  126. else
  127. ipwarns[ply:SteamID()] = ipwarns[ply:SteamID()] + 1
  128. end
  129. --Warn player
  130. ply:PrintMessage(HUD_PRINTTALK, "Do not type IP addresses in chat, you now have "..ipwarns[ply:SteamID()].." warnings, if you reach 3, you will be kicked.")
  131. --Tell admins
  132. for k, v in pairs(player.GetAll())do
  133. if(v:GetUserGroup() == "superadmin" or v:GetUserGroup() == "Head Admin" or v:GetUserGroup() == "Community Leader" or v:GetUserGroup() == "admin")then
  134. v:PrintMessage(HUD_PRINTTALK, ply:Nick().." tried typing IP: "..foundIP)
  135. v:PrintMessage(HUD_PRINTTALK, "Original message: "..text)
  136. v:PrintMessage(HUD_PRINTTALK, "Warnings given: "..ipwarns[ply:SteamID()])
  137. end
  138. end
  139. --kick if too many ips
  140. if(ipwarns[ply:SteamID()] >= 3)then
  141. if(!ply:IsSuperAdmin())then
  142. ipwarns[ply:SteamID()] = nil
  143. for k, v in pairs(player.GetAll())do
  144. v:PrintMessage(HUD_PRINTTALK, ply:Nick().." was kicked. Reason: typing IP addresses in chat after 3 warnings.")
  145. end
  146. ply:Kick("Posting IP addresses in chat after 3 warnings.")
  147. end
  148. end
  149. return ""
  150. end
  151. end
  152. end)
  153. --[[-------------------------------------------------------------------------
  154. physgun r disable.
  155. ---------------------------------------------------------------------------]]
  156. hook.Add("OnPhysgunReload","physgunrcancrashservers",function(wep,ply)
  157. if not ply:IsSuperAdmin() then return false
  158. end
  159. end)
  160. --[[-------------------------------------------------------------------------
  161. player blackscreen prop exploit fix.
  162. ---------------------------------------------------------------------------]]
  163. function SpawnedProp(ply, model, ent)
  164. if string.lower(ent:GetMaterial()) == "pp/copy" then
  165. ent:Remove()
  166. end
  167. end
  168. hook.Add("PlayerSpawnedProp", "playerSpawnedProp", SpawnedProp)
  169.  
  170. function MatCheck(pl, trace, toolmode)
  171. if toolmode:lower() == "material" then
  172. local tool = pl:GetActiveWeapon():GetToolObject()
  173. if string.lower(tool:GetClientInfo("override")) == "pp/copy" then
  174. return false
  175. end
  176. end
  177. end
  178. hook.Add("CanTool", "MatCheck", MatCheck)
  179. --[[-------------------------------------------------------------------------
  180. staff prop spam warn.
  181. ---------------------------------------------------------------------------]]
  182. hook.Add("PlayerSpawnedProp","printif10sameprop",function(ply,mdl)
  183. if not ply.TenIdenticalPropLog then ply.TenIdenticalPropLog = {lastprop = "", count = 0} end
  184. if ply.TenIdenticalPropLog.lastprop ~= mdl then
  185. ply.TenIdenticalPropLog.lastprop = mdl
  186. ply.TenIdenticalPropLog.count = 1
  187. else
  188. ply.TenIdenticalPropLog.count = ply.TenIdenticalPropLog.count + 1
  189. end
  190. if ply.TenIdenticalPropLog.count == 10 then
  191. for k,v in pairs(player.GetAll()) do
  192. if v:IsAdmin() then
  193. v:ChatPrint(ply:GetName().." has spawned the same prop ("..mdl..") 10 times, he might be crashing the server.")
  194. end
  195. end
  196. ply.TenIdenticalPropLog.count = 1
  197. end
  198. end)
  199. --[[-------------------------------------------------------------------------
  200. remove car and prop damage to players.
  201. ---------------------------------------------------------------------------]]
  202. local function NoCDMOrCrush( ply, dmginfo )
  203. if dmginfo:GetAttacker():IsVehicle() or (dmginfo:GetAttacker():IsPlayer() and dmginfo:GetAttacker():InVehicle()) then dmginfo:SetDamage(0) end
  204. if dmginfo:IsDamageType(DMG_CRUSH) then dmginfo:SetDamage(0) end
  205. return dmginfo
  206. end
  207. hook.Add( "EntityTakeDamage", "StoppingCDM", NoCDMOrCrush )
  208. --[[-------------------------------------------------------------------------
  209. Delete props that fall out of map.
  210. ---------------------------------------------------------------------------]]
  211. local Ent = FindMetaTable("Entity")
  212. local Phys = FindMetaTable("PhysObj")
  213.  
  214. if(Ent.SetRealPos == nil)then
  215. Ent.SetRealPos = Ent.SetPos
  216. end
  217. if(Phys.SetRealPos == nil)then
  218. Phys.SetRealPos = Phys.SetPos
  219. end
  220.  
  221. local clamp = math.Clamp
  222. function Ent.SetPos(ent, pos)
  223. pos.x = clamp(pos.x, -500000, 500000)
  224. pos.y = clamp(pos.y, -500000, 500000)
  225. pos.z = clamp(pos.z, -500000, 500000)
  226. Ent.SetRealPos(ent, pos)
  227. end
  228. function Phys.SetPos(phys, pos)
  229. pos.x = clamp(pos.x, -500000, 500000)
  230. pos.y = clamp(pos.y, -500000, 500000)
  231. pos.z = clamp(pos.z, -500000, 500000)
  232. Phys.SetRealPos(phys, pos)
  233. end
  234. --[[-------------------------------------------------------------------------
  235. No collides props with eachother.
  236. ---------------------------------------------------------------------------]]
  237. if SERVER then AddCSLuaFile() end
  238.  
  239. hook.Add( "OnEntityCreated", "prop_customcollisions", function( ent ) if ent:GetClass() == "prop_physics" then ent:SetCustomCollisionCheck( true ) end end )
  240. hook.Add( "ShouldCollide", "prop_nocollide", function( ent1, ent2 ) if ent1:GetClass() == "prop_physics" and ent2:GetClass() == "prop_physics" then return false end end )
  241. --[[-------------------------------------------------------------------------
  242. Decal remover timer.
  243. ---------------------------------------------------------------------------]]
  244. timer.Create("cleardecals", 300,0, function() RunConsoleCommand("r_cleardecals") end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement