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.

Game freeze and crash with this code

Featured Replies

1 minute ago, techgamer15 said:

All fixed now, turns out the issue was with me not adding GameFiber.Yield()

 

Heres the code for anyone who comes across this topic in the future:

 

  Reveal hidden contents


 public override void Process()
        {
            base.Process();
            GameFiber.StartNew(delegate
            { 
            if (Game.IsKeyDown(System.Windows.Forms.Keys.End))
            {
                Game.DisplayNotification("~g~Code 4~w~, return to patrol.");
                Functions.PlayScannerAudio("ATTENTION_ALL_UNITS WE_ARE_CODE_4");
                End();
            }
            if (onScene == false && Game.LocalPlayer.Character.Position.DistanceTo(spawnPosition) <= 10)
            {
                Game.LogTrivial("If statement executed");
                onScene = true;
                Game.LogTrivial("Boolean changed.");
                Game.DisplayHelp("Approach the ~p~objects~w~, and press ~b~Delete~w~ to move the objects off the road.");
                if (calloutArea.Exists()) { calloutArea.Delete(); }
                Game.LogTrivial("If statement 2 done.");
                prop0Blip = prop0.AttachBlip();
                Game.LogTrivial("blip 0 done");
                prop0Blip.Color = System.Drawing.Color.Purple;
                prop1Blip = prop1.AttachBlip();
                Game.LogTrivial("blip 1 done");
                prop1Blip.Color = System.Drawing.Color.Purple;
                prop2Blip = prop2.AttachBlip();
                Game.LogTrivial("blip 2 done");
                prop2Blip.Color = System.Drawing.Color.Purple;
                Game.DisplayHelp("Press ~b~Delete~w~ to move the objects out of the road.");
                while (true)
                {
                   GameFiber.Yield();
                    if (Game.IsKeyDown(System.Windows.Forms.Keys.Delete))
                    {
                        break;
                    }

                }
                Game.DisplayNotification("Please wait ~g~10 seconds~w~ for the objects to be moved from the road.");
                GameFiber.Sleep(10000);
                Game.DisplayNotification("~g~Code 4~w~, return to patrol.");
                Functions.PlayScannerAudio("ATTENTION_ALL_UNITS WE_ARE_CODE_4");
                End();

            }


        });
        }

 

 

Oh okay, nice

  • Replies 21
  • Views 674
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • I really don't see anything, sorry! are you sure it's the if statement? try using Game.LogTrival("Text here"); With this you can log things, put this before the if statement and a couple of

  • Just replace the while with if, that should work

  • Oh okay, nice

sleeping the main fiber I see? thank you...

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.