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.

New GameFiber crashes LSPDFR

Featured Replies

Hello! Can you help me with my problem? I try to create new callout. In this script the suspect will approach to the undercover cop, then they will talk for 3 sec, and then the chase wil start. But, when I invoke GameFiber.Sleep(), the Plugin crashes. What is wrong? Thanks.

public override void Process()
        {
            base.Process();

            GameFiber.StartNew(delegate
            {
                if (!PursuitCreated && Cop.DistanceTo(Suspect.Position) < 2f)
                {
                    GameFiber.Sleep(3000);
                    PursuitCreated = true;

                    Pursuit = Functions.CreatePursuit();
                    Functions.AddPedToPursuit(Pursuit, Suspect);
                    Functions.AddCopToPursuit(Pursuit, Cop);
                    Functions.SetPursuitIsActiveForPlayer(Pursuit, true);

                }
                if (PursuitCreated && !Functions.IsPursuitStillRunning(Pursuit))
                {
                    Game.LogTrivial("End executed!");
                    End();
                }
            }, "newFiber");
        }

 

Edited by AlexKardone

  • Author

I've understood what happened. After creating a new Fiber the script is executing the Process() method and check the second if statement. There is a function 

!Functions.IsPursuitStillRunning(Pursuit)

and because new GameFiber is still sleeping and blocking to assign 

Functions.CreatePursuit();

to varible Pursuit, we have Pursuit equals null. And we can't execute the function IsPursuitStillRunning(). That is why I had an error.

Case closed!

  • Management Team

You should also make sure to only spawn your new GameFiber once. Not sure if you omitted code, but in your snippet above it looks like a new fiber (and hence a new thread) will be spun up every tick.

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

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.