Jump to content

GameFiber.Hibernate


Recommended Posts

Okay so I'm looking to use GameFiber.Hibernate in my coding but my only issue is that I cannot get it to waken. Maybe it's not possible but that's why I'm here. So I need the GameFiber hibernation to waken when LocalPlayer.DistanceTo PedHome is <1 & Vehicle Speed is also <1. Also if it makes a difference this code will not be within a loop. Thanks. Any help getting this working would be great, thanks so much. 

ScottyTooHotty

Link to comment
Share on other sites

Once you hibernate a fiber it can only wake if the Wake method gets called from other fiber.
E.g:
GameFiber myFiber = GameFiber.StartNew(delegate
{
     //your code
     GameFiber.Hibernate(); //it will wait until the Wake method gets called
});

// in other fiber you will have to do this when you need the code above to continue
myFiber.Wake();

 

That might be too complex and unnecessary for what you want, just create a loop and when your condition is reached break it.
E.g:
while(true)
{
     GameFiber.Yield();
     if(yourCondition)     // once your condition is reached it will exit the loop
         break;

// your code after the condition

Link to comment
Share on other sites

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

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.


×
×
  • Create New...