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.

[Tutorial] How to make a search area and refresh it when suspect leaves it.

Featured Replies

I'm assuming you already have created a search area, but if you haven't yet, click the spoiler.

Spoiler
SearchArea = new Blip(SpawnPoint.Position, 60f);
SearchArea.Alpha = 0.5f;
SearchArea.Color = Color.FromArgb(240, 200, 80);
SearchArea.EnableRoute(Color.FromArgb(240, 200, 80));

The first line instantiates a new blip, the first parameter requires a location(Vector3), the second parameter requires a radius, to set the size of the SearchArea.

Alpha means transparancy, default is 1f. So I've set it to half as that.

240, 200, 80 is RGB; And the color is yellow.

EnableRoute means that it sets a waypoint to the blip(the blip is SearchArea).

 

Please check out this for the proper coloring of things:

Standardization of API Plugin Colors.

 

Okay, so first you want to create a private bool to check if it needs any refreshing, I will explain why later. Don't forget to set it to true.

private bool needsRefreshing = true;

 

Second, we're making an if-statement, we don't need to add "== true" since we already set true by default, normally it's always false.

if (Suspect.Position.DistanceTo(SpawnPoint) > 60f && needsRefreshing)

It checks if the suspect's position is further then the search area size, and if it still needs to be refreshed(which it does).

 

Now for the rest of the if-statement: the red parts describe what that line executes.

if (Suspect.Position.DistanceTo(SpawnPoint) > 60f && needsRefreshing)
{
   if (SearchArea.Exists()) { SearchArea.Delete(); } // Checks if SearchArea is still there, then it deletes it.
   SceneLocation = Suspect.Position.Around(10f, 30f); //Sets the SpawnPoint to a random position between 10 and 30, since the SpawnPoint is of no more use.
   SearchArea = new Blip(SpawnPoint, 60f);
   SearchArea.Alpha = 0.5f; // Sets the transparancy to half of the standard size.
   SearchArea.Color = Color.FromArgb(240, 200, 80); // Sets the color to yellow.
}

 

We're not done yet, We still have to make a second if-statement to check where the player is.

if (Game.LocalPlayer.Character.Position.DistanceTo(Suspect.Position) < 10f && needsRefreshing) // Executes when the player is close to the suspect and if it needs refreshing.
{
    while (true) // keeps executing while true
    {
        needsRefreshing = false; // Since the player found the Suspect, we don't need to refresh the SearchArea anymore, because that would be weird.
        if (SearchArea.Exists()) { SearchArea.Delete(); } // This is the old SearchArea, since the suspect is not in it anymore, it needs to be deleted.
        Game.LogTrivial("TutorialPlugin: Search Area doesn't need to be refreshed anymore."); // This is optional, but i do recommend you log things alot.
        break; // This stops the while loop from executing anymore, otherwise it is going to do this 1000x per second.
    }
}

 

If you need any support with coding, head over to "VincentsGM Modifications" Discord server, he helped me alot and there is alot of things you can learn in his #coding-help channel.

Server:

https://discord.gg/A7pJNY3HM5

Make sure to get the Developer role for you to see #coding-help.

Edited by Faya
Typo

🇳🇱

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.