Zone script

Any possible way anyone know of making a section on the map or an area a safe zone, players do not have pvp enabled or no weapons able to be used in a certain section? Anyone?

2 Likes

if player is within range of a set of coords, disabled the friendly fire and set whatever else you want.

2 Likes

As Briglair said, simply messure the distance to the center point. You could also use AABB algorithm to detect a player inside a box.

1 Like

You guys are awesome now just to find out how I can do this now that I know it can be done

Some of these natives should help.

https://runtime.fivem.net/doc/reference.html#_0x3FEF770D40960D5A - for getting the player’s location.
https://runtime.fivem.net/doc/reference.html#_0xF808475FA571D823 - for disabling pvp
https://runtime.fivem.net/doc/reference.html#_0xF25DF915FA38C5F3 - for removing the player’s weapons

You could also toggle god mode on a player if they’re in your designated area, as players would still be able to shoot into the area from outside of it.

hi. is there already a script with this function? if yes would you share it ?

1 Like

Try this maybe.

Otherwise here’s the point in poly code.
https://wrf.ecse.rpi.edu//Research/Short_Notes/pnpoly.html

2 Likes

have you done it?
please help me
do you have tutorial?

My best guess would be to do something like this

https://runtime.fivem.net/doc/reference.html#_0xF1B760881820C952 - GetDistanceBetweenCoords

Do it in a Citizen.CreateThread() loop in client and then if the distance between the coords of the center of the safezone and your character then use the natives @WolfKnight179 suggested to disable pvp and remove weapons or whatever you want.

Hey, dont know if you need this or not but since I found this thread I started to make one :stuck_out_tongue:
[Release] Safe Zone(s) Updated 9/10/18

Case closed, I see no need to keep a one year old topic open. Except for read-only purposes ofc.

2 Likes