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.

[SOLVED] using Taskinvoker but can't use other commands at the same time

Featured Replies

Hello Community,

 

i got here a little problem.

Because i use a Progressbar (Called "timerBarPool"), i have to refresh it often.          (timer bar pool from RAGENativUI. scroll down to see why i used RAGEnativUI)

 

Now i want to use a Task from Taskinvoker:

Game.LocalPlayer.Character.Tasks.EnterVehicle(searchedCar, -1, EnterVehicleFlags.DoNotEnter);

But because this is not everything i wrote in this script the Game just Aborts the ongoing Task because of the next command.

 

So i need to use  "  .WaitForCompletion(); "   :

Game.LocalPlayer.Character.Tasks.EnterVehicle(searchedCar, -1, EnterVehicleFlags.DoNotEnter).WaitForCompletion();

now my script waits until the task is completed, wich is what it should do but...  not what i wanted. 

because of the ".WaitForCompletion();" Argument my ProgressBar disappears. Why? Well it can't refresh.

 

 

So i decided to use a while that will execute the commands i need until he is finished with the Task:

var taskProgress = Game.LocalPlayer.Character.Tasks.EnterVehicle(searchedCar, -1, EnterVehicleFlags.DoNotEnter).Status;
while (taskProgress == TaskStatus.Preparing)
{
	taskProgress = Game.LocalPlayer.Character.Tasks.CurrentTaskStatus;

	Game.DisplaySubtitle(Game.LocalPlayer.Character.Tasks.CurrentTaskStatus.ToString());
	timerBarPool.Draw();
	GameFiber.Yield();
}

But even tho that "CurrentTaskStatus" is always on "Preparing" wich i totally cant understand,

it loops in the while because the "CurrentTaskStatus" is not changing. 

 

 

So i tried this:

I added

var taskProgress = Game.LocalPlayer.Character.Tasks.EnterVehicle(searchedCar, -1, EnterVehicleFlags.DoNotEnter).Status;
while (taskProgress == TaskStatus.Preparing)
{
	Game.LocalPlayer.Character.Tasks.EnterVehicle(searchedCar, -1, EnterVehicleFlags.DoNotEnter); 				// HERE IS WHAT I CHANCED
	taskProgress = Game.LocalPlayer.Character.Tasks.CurrentTaskStatus;

	Game.DisplaySubtitle(Game.LocalPlayer.Character.Tasks.CurrentTaskStatus.ToString());
	timerBarPool.Draw();
	GameFiber.Yield();
}

so now my Player just stays in the first Taskframe because it executes the Task every time and that means it restarts.

 

 

So this is my summary:

- i cant do little things while the task is working -> WaitForCompletion.

- i cant execute some other command because that will abort the task.

And

- I cant tell him if my task is ongoing that it just keep going.

 

Conclusion: 

I cant do anything...?

 

 

PS: Yes. i could use the LSPDFR Progressbar and add a timout. But due to a lack of documentation i have no idea how to use the

 LSPD_First_Response.Engine.UI.TimerBarBase

If you know how to use BarTimerBar and TimerBarBase you would realy help me. 

Edited by ziipzaaapM16A4
Added information

Take a look at my Plugins:

AmbientAICallouts: Ai get calls too. Callouts can turn into a backup request for the player [YouTube Link]

Search Vehicle Plugin: Simple and more Immersive Vehicle Search Plugin [YouTube Link]

What Was You Name Again?: Get the name of a Suspect even when arrested and placed in your Vehicle [YouTube Link]
Corpse Inspection:  Investigate the corpse. Interact and search for details in a more Cinematic way  [YouTube Link]
[WIP] EnvoirementalCallouts: A couple of Callouts and WorldEvents that are likely to happen to you while you're on duty [Youtube Link]

[OnHold] EMS Support: Be the First Responder of Medical Emergency's and do CPR on Patients [YouTube Link]

 

spacer.png

Checkout my Patreon for Early Access to my mods                                       checkout my Discord Server

  • Management Team

I think that Status is currently broken and always returns Preparing (@PNWParksFan had a similar issue recently iirc). You can try to use WaitForCompletion in a new GameFiber since that way it won't block your current thread. Spawn a new fiber and run the task logic there. Alternatively, spawn a new fiber and do all the timer bar logic there. Note that it is perfectly safe to share variables between fibers since they are ticked one after another.

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

  • Author

@LMS

 

4 hours ago, LMS said:

I think that Status is currently broken and always returns Preparing 

yes it does. i just checked it.

 

I am currently doing the enter vehicle part in a new GameFiber.

but i get the same result. 

GameFiber.StartNew(delegate {
	Game.LocalPlayer.Character.Tasks.EnterVehicle(searchedCar, -1, EnterVehicleFlags.DoNotEnter).WaitForCompletion();
});

the game is not able to execute:

timerBarPool.Draw();

 

everytime i execute EnterVehicle with .WaitForCompletion();

the timerBarPool disapear until the task is done.

Edited by ziipzaaapM16A4

Take a look at my Plugins:

AmbientAICallouts: Ai get calls too. Callouts can turn into a backup request for the player [YouTube Link]

Search Vehicle Plugin: Simple and more Immersive Vehicle Search Plugin [YouTube Link]

What Was You Name Again?: Get the name of a Suspect even when arrested and placed in your Vehicle [YouTube Link]
Corpse Inspection:  Investigate the corpse. Interact and search for details in a more Cinematic way  [YouTube Link]
[WIP] EnvoirementalCallouts: A couple of Callouts and WorldEvents that are likely to happen to you while you're on duty [Youtube Link]

[OnHold] EMS Support: Be the First Responder of Medical Emergency's and do CPR on Patients [YouTube Link]

 

spacer.png

Checkout my Patreon for Early Access to my mods                                       checkout my Discord Server

  • Author

 

Solution

 

Thanks to @TheUniT who is helping me this whole week with my development problems, 

he just tried to put the Progressbar in a new GameFiber just as @LMS said:

4 hours ago, LMS said:

Alternatively, spawn a new fiber and do all the timer bar logic there. Note that it is perfectly safe to share variables between fibers since they are ticked one after another.

 

 

That Solution worked perfectly fine.

internal static void ProgressBarLoop()
{
  GameFiber.StartNew(delegate
  {
    while (CurrentlyRunning)
    {
      timerBarPool.Draw();
      GameFiber.Yield();
    }
  });
}

 

Thank you guy's

Edited by ziipzaaapM16A4

Take a look at my Plugins:

AmbientAICallouts: Ai get calls too. Callouts can turn into a backup request for the player [YouTube Link]

Search Vehicle Plugin: Simple and more Immersive Vehicle Search Plugin [YouTube Link]

What Was You Name Again?: Get the name of a Suspect even when arrested and placed in your Vehicle [YouTube Link]
Corpse Inspection:  Investigate the corpse. Interact and search for details in a more Cinematic way  [YouTube Link]
[WIP] EnvoirementalCallouts: A couple of Callouts and WorldEvents that are likely to happen to you while you're on duty [Youtube Link]

[OnHold] EMS Support: Be the First Responder of Medical Emergency's and do CPR on Patients [YouTube Link]

 

spacer.png

Checkout my Patreon for Early Access to my mods                                       checkout my Discord Server

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.