General > Off-Topic
RSO Discussion
jay209015:
If you could make a script to autorun:
--- Code: ---lua_run for _, v in pairs(ents.FindByClass("gmod_ghost")) do if v:IsValid() then v:Remove() end end
--- End code ---
everytime this:
--- Code: ---lua_run Msg(#ents.FindByClass("gmod_ghost"))
--- End code ---
is Greater than 20 I guess, or when there arn't any players on the server, or when either is true.
MrPresident:
Here you go.. put in a lua file in garrysmod/lua/autorun/server
--- Code: ---
function GhostRemover()
local ghosts = #ents.FindByClass("gmod_ghost")
local pnum = #player.GetAll()
if (ghosts >= 200) or (pnum <= 0) then
for _, v in pairs(ents.FindByClass("gmod_ghost")) do
if v:IsValid() then
v:Remove()
end
end
end
end
timer.Create("GhostRemover", 180, 0, GhostRemover)
--- End code ---
This will check every 3 minutes.. if there are no players connected, it'll remove all ghosts.. if there are players and there are more than 200 ghosts.. it'll remove them. The timer interval is set to 3 minutes in case someone is atually using the ghosts it wont remove them too fast for the person to finish.
saintmark:
Very nice!
Thanks for posting this!
Does the antiRSO maps help too?
MrPresident:
anti-RSO maps...
I'm assuming you just mean maps that have seperate defined sections where the vis sections are seperated. In that case, yes, they do seem to help from what I have observed.
saintmark:
ok good, I had a custom map made with the antiRSO feature.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version