Garry's Mod

Garry's Mod

Not enough ratings
Nub's Safe Zones
   
Award
Favorite
Favorited
Unfavorite
Content Type: Addon
Addon Type: Tool
Addon Tags: Build, Fun
File Size
Posted
63.616 KB
20 Jul, 2021 @ 9:06pm
1 Change Note ( view )

Subscribe to download
Nub's Safe Zones

In 1 collection by NubTheFatMan
Posted Addons
4 items
Description
To use this tool, go into Weapons > Other, and you'll find it. When I come around to updating this, I want to move it to the tool menu on the right, and maybe even add buttons to manage zones.

Rewrite of the Safe Zone mod originally published on the gmod store[www.gmodstore.com]
However, this is a rewrite from the ground up and fixes a few issues:
  • The original didn't have any saving. You would have open a specific file and paste Lua code. It was nice enough to generate this lua code, but was an unnecessary step. This also required a server restart. With this mod, you just have to select the tool (found under Weapons > Other), right click to select a zone, click two points, and you were done.
  • This is mostly programmer friendly. You can register your own type, change the behavior of what happens in a zone, or just disallow people as being in the zone (such as a permission system). When an entity (prop or player) enters a zone, it calls certain hooks. This could use some improvements though.
  • This mod factors in the hitbox. The original only factored a props position, which would lead to bugs where a prop was still inside the zone but it's position was not. This means that a large prop could still be used to push players outside of a zone.
  • This mod ghosts any props brought into a zone. The original would delete them without warning.
  • This mod is optimized in which large prop counts won't cause lag. The original scanned every prop in the world every tick, while this limits how many it will scan per tick.

Want to view the source code? You can find it on GitHub[github.com]

Client Console Commands
  • nsz_show_zones (0|1) - Shows a debug of all the current zones and how long it took to scan props during every tick.
  • nsz_show_display (0|1) - Shows or hides the "you are in a zone" indicator located at the top-center of your screen.
  • nsz_delete (zone ID) - Deletes a zone by ID. You can also type "all" to delete every single zone, or a zone's type to delete all zones of that type. SuperAdmin by default, however has ULX support. You can get a zone's ID from the nsz_show_zones command.

Server Console Commands
  • nsz_prop_checks_per_tick (# of props) - How many props should the server calculate per tick. Higher number = more lag, but faster detection.
  • nsz_aabb_v_sat_sensitivity (# sensitivity) - Range of 0 to 90. This is the angle which determines whether to use AABB (Axis Aligned Bounding Box) detection or SAT (Separating Axis Theorem) detection. 0 = always use SAT (slow but accurate), 90 = always use AABB (fast but with false positives).

This mod comes with 3 safe zones by default: Spawn (no building or killing), Safe (no killing), and No Building (obvious what this one does ( ͡° ͜ʖ ͡°)).

It's worth nothing that this addon is not in active development. There are a couple known bugs which are in a linked discussion. I do plan to revisit this and change a few things, but I'm currently working on another mod.

It is also worth noting that this doesn't need to be installed on the client to work. You can use the GitHub link above to download the source files, and just upload them to the server's addon folder. It'll still work just the same!
Popular Discussions View All (2)
0
20 Jul, 2021 @ 9:57pm
PINNED: Developer Support
NubTheFatMan
0
20 Jul, 2021 @ 9:32pm
PINNED: Bugs
NubTheFatMan
14 Comments
low quality toyota logo 19 May @ 4:10pm 
Seems to work pretty much fine still, except the update checker thinks that the newest version of the addon is... the content of a 404 page.
Jay 3 Nov, 2023 @ 10:45pm 
Edged
NubTheFatMan  [author] 30 Apr, 2023 @ 8:20pm 
No there isn't. That's an edge case I never thought of. The best I can say is delete all zones and replace the ones you want to keep
#FF69B4 Depression 30 Apr, 2023 @ 7:24pm 
if they are out of the world
#FF69B4 Depression 30 Apr, 2023 @ 7:13pm 
how do i see the id of a zone
gobleen 24 Mar, 2023 @ 8:19am 
noice
oliverhappleton 9 Sep, 2022 @ 10:21am 
my big question dose it work on nextbots
NubTheFatMan  [author] 9 Apr, 2022 @ 8:35am 
Like, once they leave, they can't re-enter the zone (they don't appear in it) until they die? It's something I could do, but I'd have to change up a few things to make it work any good. However, if you do know how to code, there are some hooks you can use in the "Developer Support" discussion to make it work however you like. I'm not actively working on anything for Garry's Mod, and I don't quite have time to make any changes right now.
ohiosigma 9 Apr, 2022 @ 6:03am 
i have 1 single suggestion and that is make an option to not make people invincible if theyve already been in the zone
NubTheFatMan  [author] 7 Apr, 2022 @ 5:17pm 
AgingBurrito, it might have to do with the fact that I never really shared it around. I just uploaded it to the workshop and called it good :)