Skip to content
View in the app

A better way to browse. Learn more.

LCPDFR.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Random closest spawn-point from coordinate list?

Featured Replies

Currently I have a system for calling random spawn-points using a set of set coordinates using 'new random().next(x, x); Unfortunately this system gets buggy and can select points from any point on the map which often leads to either the suspect escaping instantly and/or lspdfr crashing.

I'm hoping somebody around here would be able to point me in the right directing as to setting up a list containing the preset coordinates that can be randomly selected from within a maximum distance restriction.

  • Management Team

You may want to try one of these approaches:

  • After randomly getting a point, check if the distance exceeds your maximum distance. If so, get a new random point. Do this until you have found a valid point (adding some kind of maximum number of attempts is a good idea btw).
  • From a maths point of view, you could apply the closest pair of points problem to this. Yours is slighty different in the regard that you allow multiple points within a range, but a little altered algorithm should work here. Note that bruting takes O(n²) here, so I'd go for a divide and conquer algorithm, which should take O(n log n).

Please do not PM me unless really necessary (knowing you helps). If you think you need my attention in a topic, tag me.

If you simply need a location that's on a valid street, I'd recommend using the following:

Vector3 SpawnPoint= World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.Around(radius));

If you have a list of specific spawn points you want to select from, LMS has explained it above. If you need to check the distance, I recommend using this:

if (Vector3.Distance(Game.LocalPlayer.Character.Position, SpawnPoint)< radius){}

Hope it helps!

My YouTube: Click here. 

My Discord Server - https://discord.gg/0taiZvBSiw5qGAXU

Useful post? Let me and others know by clicking the Like button.
Check out my many script modifications! 
Having issues? LSPDFR Troubleshooter by Albo1125.

  • Author

Somethings not working (Usually my code) as now its throwing a fit. It doesn't limit it by distance but now spawns the callout in only one place using old code that isn't even in the callout now.

Would it help if I paste the callout or part of it here?

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Similar Content

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.