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] References or what?

Featured Replies

Hey guys, I hate to bug you again but I’m on the edge here. I have no idea whether I got super stupid in last several years or is there something seriously wrong here and it’s not on me.

I’ve encountered so many problems with the code thus far that you wouldn’t believe it. Yesterday I gave a shot to the „Assasination Plugin” tutorial by Albo1125. (https://www.youtube.com/watch?v=lZUAXBYRaE4&t=185s)

Despite of using literally the same code my plugin crashes. It’s not the first time things go down that road. What the f… is going on here? Did I miss something?  I'm totally helpless.

1) I added the following references:

LSPD First Response
RAGENativeUI
RagePluginHookSDK
System.Windows.Forms (for pressing the key)

2) The code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Rage;

[assembly: Rage.Attributes.Plugin("wtf", Description = "B", Author = "Pawel")]
namespace wtf
{
    public static class EntryPoint
    {

        public static void Main()
        {
            GameFiber.StartNew(delegate
            {
                Game.DisplayNotification("To ostatnia wtyczka");



                while (true)
                {
                    GameFiber.Yield();
                    if (Game.IsKeyDown(System.Windows.Forms.Keys.Enter))
                    {
                        break;
                    }
                }
                Ped RogueOfficer = new Ped(Game.LocalPlayer.Character.GetOffsetPositionFront(10f));
                Vehicle RogueOfficerCar = new Vehicle("POLICE4", Game.LocalPlayer.Character.GetOffsetPositionFront(15f));

                RogueOfficer.BlockPermanentEvents = true;
                RogueOfficer.IsPersistent = true;
                RogueOfficerCar.IsPersistent = true;

                RogueOfficer.Tasks.EnterVehicle(RogueOfficerCar, 10000, -1).WaitForCompletion(3000);

                RogueOfficer.Tasks.DriveToPosition(Game.LocalPlayer.Character.Position, 15f, VehicleDrivingFlags.Emergency).WaitForCompletion(6000);
                RogueOfficer.Tasks.LeaveVehicle(LeaveVehicleFlags.None);

                RogueOfficer.Inventory.GiveNewWeapon("WEAPON_SHOTGUN", -1, true);
                RogueOfficer.Tasks.FightAgainst(Game.LocalPlayer.Character);

                while(true)
                {
                    GameFiber.Yield();
                    if (Game.LocalPlayer.Character.IsDead || RogueOfficer.IsDead)
                    {
                        break;
                    }
                }

                if (RogueOfficer.Exists())
                {
                    RogueOfficer.Dismiss();
                }

                GameFiber.Hibernate();
            });
        }
    }
}

3) The log:

 

[4/26/2020 10:48:20 AM.632] wtf: UNHANDLED EXCEPTION DURING GAME FIBER TICK
[4/26/2020 10:48:20 AM.632] wtf: ------------------------------
[4/26/2020 10:48:20 AM.632] wtf: Origin: Game fiber "<UNNAMED THREAD>".
[4/26/2020 10:48:20 AM.632] wtf: ------------------------------
[4/26/2020 10:48:20 AM.632] wtf: Exception type: Rage.Exceptions.InvalidHandleableException
[4/26/2020 10:48:20 AM.632] wtf: Exception message: Operation is not valid because the specified  Rage.Vehicle is invalid.
[4/26/2020 10:48:20 AM.632] wtf: ------------------------------
[4/26/2020 10:48:20 AM.632] wtf: Inner exceptions:
[4/26/2020 10:48:20 AM.632] wtf: ------------------------------
[4/26/2020 10:48:20 AM.632] wtf: Stack trace:
[4/26/2020 10:48:20 AM.632] wtf: at Rage.TaskInvoker.DriveToPosition(Vehicle vehicle, Vector3 position, Single speed, VehicleDrivingFlags flags, Single acceptedDistance)
[4/26/2020 10:48:20 AM.632] at Rage.TaskInvoker.DriveToPosition(Vector3 position, Single speed, VehicleDrivingFlags flags)
[4/26/2020 10:48:20 AM.632] at wtf.EntryPoint.<>c.<Main>b__0_0() in D:\Program Files\GTA V MODY\AssasinationPlugin\AssasinationPlugin\Class1.cs:line 46
[4/26/2020 10:48:20 AM.632] at Rage.GameFiber.Main()

Could you please just point out where to look? Thank you for your time.

 

 

Exception message: Operation is not valid because the specified  Rage.Vehicle is invalid.

 

at Rage.TaskInvoker.DriveToPosition(Vehicle vehicle, Vector3 position, Single speed, VehicleDrivingFlags flags, Single acceptedDistance)

 

In this particular case you tell a ped to enter a vehicle you spawned, but then also immediately afterwards tell the same ped to drive that vehicle to a position.

You didn't pass a vehicle to this method, which means it's defaulted to looking for the vehicle the ped is currently sitting in, which is null because the ped hasn't made it inside the vehicle yet. You added .WaitForCompletion() but then set the timeout to 3,000ms (3 seconds). So after 3 seconds it will stop waiting for the task to be completed and move onto the next line of code anyway.

 

Try setting the waitforcompletion to -1 (infinite)

Also, perform safety checks before executing tasks.

eg.

if(myVehicle.Exists())
{
	myPed.Tasks.EnterVehicle(myVehicle);
}

This way if the vehicle doesn't exist for whatever reason you won't instant crash your plugin.

Live Streaming daily from 8pm GMT (UK) at https://twitch.tv/OfficialLukeD - I play a variety of things 😄

Join my official discord server for support, general chat and my stream schedule! https://discord.gg/Mddj7PQ

  • Author
On 4/27/2020 at 11:56 AM, LukeD said:

 


Exception message: Operation is not valid because the specified  Rage.Vehicle is invalid.

 


at Rage.TaskInvoker.DriveToPosition(Vehicle vehicle, Vector3 position, Single speed, VehicleDrivingFlags flags, Single acceptedDistance)

 

In this particular case you tell a ped to enter a vehicle you spawned, but then also immediately afterwards tell the same ped to drive that vehicle to a position.

You didn't pass a vehicle to this method, which means it's defaulted to looking for the vehicle the ped is currently sitting in, which is null because the ped hasn't made it inside the vehicle yet. You added .WaitForCompletion() but then set the timeout to 3,000ms (3 seconds). So after 3 seconds it will stop waiting for the task to be completed and move onto the next line of code anyway.

 

Try setting the waitforcompletion to -1 (infinite)

Also, perform safety checks before executing tasks.

eg.


if(myVehicle.Exists())
{
	myPed.Tasks.EnterVehicle(myVehicle);
}

This way if the vehicle doesn't exist for whatever reason you won't instant crash your plugin.

 

Yeah, it was the "Rage.Vehicle is invalid" part that made my think of missing reference or some deep-seated issue with the code. What could be wrong with the vehicle on this point, I thought. You were right and I'm very grateful.

For the record I must admit that safety checks are really useful. For instance, when I tested the code again I learnt that If player somehow gets to your ped and kills him before he reaches the car the plugin will also crash unless check is in place.

 

  • The title was changed to [Solved] References or what?

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.