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.

Looking for a way to find a random safe place for a ped to spawn

Featured Replies

I'm trying to find a way to make ped spawn at a random position within a certain radius from a given point. 

I've tried using the native GET_SAFE_COORDS_FOR_PED but i have not been able to successfully implement it.

is there a simpler function in rage to do this or am I stuck using this native or a similar one?

Hi DMes71,

I have previously created myself a common function to call for this reason - spawning peds.  I use the below:

public static unsafe Vector3 GetSafeCoordsForPed(Vector3 CheckPoition)
        {
            Vector3 ReturnPosition;
            NativeFunction.CallByName<bool>("GET_SAFE_COORD_FOR_PED", CheckPoition.X, CheckPoition.Y, CheckPoition.Z, true, &ReturnPosition.X, &ReturnPosition.Y, &ReturnPosition.Z, 0);

            if (ReturnPosition == Vector3.Zero)
            {
                return CheckPoition;
            }
            else
            {
                return ReturnPosition;
            }
        }

If this function returns a Vector3.Zero value then the function was unable to find a safe location to spawn a ped.

Please also be aware that a 'Safe Position' only seems to be not on a road.

I am new at RPH and LSPDR plugins so there maybe a better way but this is how I have implemented this.

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...

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.