Is there any map function or library in GMOD?

I’m making pubg like safe zone system
that’s why i should know world/map’s sizes
So is there any map function or library in Garry’s Mod?

and Sorry, English is not my first language.

You’ll have to hardcode them as there is no function to access the size. There might be a way to retrieve a chunk size from the bsp file, though.

You mean safe zone where people wont take damage?

If you’re referring to the play area of pubg, one method you could use is:
Create a variable for the radius of the circle
Set a position for the center of the circle
Render a sphere based on the radius/position
Reduce the radius on the server and client simultaneously
Create a timer that runs every 1-2 seconds, check if players distance from the center pos is greater than the radius, if so deal damage.
There’s no need to really find the exact map size if you use a sphere ( which you would since that’s how pubg technically does it ) just adjust the starting radius accordingly.

I think there’s some confusion on what he’s asking for because the method i listed surely does provide a safe and non safe play area?

[editline]2nd October 2017[/editline]

disregard what I said, I’m now assuming you’re referring to the area that you spawn at.

ents.find* is expensive.
And it goes through the world.
It works, but it’s crude.

navmesh is better imo. ;o

both methods have their pros and cons.

or you can check it on the client and send a net message asking the server to check your position, that gets around the cost problem too since the expensive part is shifted to the client :stuck_out_tongue:

He’s never mentioned using ents.find
For safe zones / damage zones; that’s definitely the plan I would use either with a circle or a square.

Can you elaborate on how the navmesh library is supposed to accomplish this? Linking to a whole category of functions is very broad.

Either way, the question is very vague.


Circle or square whatever it is, random positioning(of ‘white circle area’ or like i said, safe zone) is needs map’s size because it can goes through the world

and I really don’t like hard code so I don’t want using it

I’m not sure if this works, but to get the bounds of the map you could try using

game.GetWorld and

Entity:GetCollisionBounds or


It’s my theory :
Set safezone’s center point randomly according to map’s max size
Draw circle in minimap
Outside user of safezone will get damage, inside won’t
again, set safezone’s center point randomly

[editline]2nd October 2017[/editline]

Oh does game.GetWorld() returns entity? word itself?

[editline]2nd October 2017[/editline]


It’s returns only zero
0.00000 0.00000 0.00000
But i’ll try more with game.GetWorld

If you want the gameplay to be any fun I’d recommend just selecting a few positions by hand in the map where the zone should spawn, otherwise it can end up in the middle of the water or up on an unreachable mountain or what not.

okay so yeah the method i listed works perfectly. it’s obviously just a base and can be tinkered with to improve.

IMO using the navmesh is the best way to find safe spawn positions