Zone limited

I would like to put a limit on the area not to go into jail.
if the person crosses this area and respwner at a certain place …

help me please :stuck_out_tongue:

RegisterNetEvent('jail:teleportPlayer')

 if (GetDistanceBetweenCoords(LastPosX, LastPosY, LastPosZ, 1680.06994628906,2512.80004882813,46.2684020996094, true) > 100.0001) then
            SetEntityCoords(GetPlayerPed(-1), tonumber("1680.07"), tonumber("2512.8"), tonumber("45.4649"))
          	TriggerEvent('chatMessage', '^4[JAILER]', {0,0,0}, "On ne s'échappe pas de la prison comme ça !")
               end
			end)

why are you using a string and setting it tonumber? seems really pointless.

Try using this, havent tested it but…

@SuisseGames

RegisterNetEvent('jail:teleportPlayer')

if (GetDistanceBetweenCoords(LastPosX, LastPosY, LastPosZ, 1680.06994628906,2512.80004882813,46.2684020996094, true) > 100.0001) then
   SetEntityCoords(GetPlayerPed(-1), 1680.07, 2512.8, 45.4649)
   TriggerEvent('chatMessage', '^4[JAILER]', {0,0,0}, "On ne s'échappe pas de la prison comme ça !")
end

Hi! When I put the code it makes me tp to the location but then it lets me leave the radius and it does not take me back, could you help me?