Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- How to add this? either create an addon folder in /addons/custom_name/lua/autorun/server/..
- Or in lua/autorun/server/
- Also, Edit maxFires for whatever number u feel :P
- This should not do any lag as it runs on creation of entities and aborts immediatly if not fire entities.
- Script made by Zaktak ;)
- Please note I made this very fast and it's very "early stage".
- --]]
- ZKFireAntiLag = ZKFireAntiLag or {}
- ZKFireAntiLag.config = ZKFireAntiLag.config or {}
- ZKFireAntiLag.config.maxFires = 40 -- Max fires, would extinguish when reached.
- function checkFire()
- local f = 0
- for k, v in pairs(ents.FindByClass("vfire")) do -- Find vFire entities.
- f = f + 1 -- Count them up
- end
- return f -- Return amount of fires
- end
- hook.Add("OnEntityCreated", "ZK_CheckEntforFire", function(ent) -- Hook is called on creation of Entity, so pretty much we want on fire creation and fire spread.
- if (!vFireInstalled) then return end -- If vFire isn't installed, abort.
- if (ent:GetClass() == "vfire") then -- If it's a vFire entity continue. If not, nothing will happen.
- if (checkFire() > ZKFireAntiLag.config.maxFires) then -- If amount of fires is bigger then set max
- local fires = 0
- for k, v in pairs(ents.FindByClass("vfire")) do
- v:Remove() -- Remove fires
- fires = fires + 1 -- Count them
- end
- ServerLog("[ZAL]: Automatically extinguished ".. fires .. " Fires \n") -- Log it to the server.
- fires = 0
- end
- end
- end)
- if (vFireInstalled) then -- Please don't remove these lines? author's credit?
- local version = "v1.01"
- print("")
- print("<<<===================================================>>>")
- print(" Zaktak's Anti Fire Lag Running: ".. version)
- print("<<<===================================================>>>")
- print("")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement