Jump to content

Rage.Vehicle is invalid


Recommended Posts

Hello, when I accept my callout I'm developing, it crashes and says "Operation Invalid Because Rage.Vehicle is invalid".  

 

SuspectVehicle = new Vehicle("CRUSADER", SpawnPoint, 0f);
            SuspectVehicle.IsPersistent = true;
            Game.LogTrivial("About To Spawn Ped");
            Suspect = new Ped("s_m_y_marine_03", SpawnPoint, 0f);
            Game.LogTrivial("Ped Spawned");
            Suspect.IsPersistent = true;
            Suspect.BlockPermanentEvents = true;
            SuspectBlip = Suspect.AttachBlip();
            SuspectBlip.IsFriendly = false;
            if (Suspect.Exists())
            {
                Suspect.Tasks.EnterVehicle(SuspectVehicle, 1);
            }
            Game.LogTrivial("Ped Told To Enter Vehicle");
            Suspect.Tasks.CruiseWithVehicle(70f, VehicleDrivingFlags.Emergency);

 

I'm really confused why this is happening and would like to know why and how to fix it.

Youtube: President Shadow

Creator Of Shadow Callouts

Discord: Contact Me and Apply For The Beta: https://discord.gg/q7JPXaR

 

Link to comment
Share on other sites

SuspectVehicle = new Vehicle("CRUSADER", SpawnPoint, 0f)
{
  IsPersistent = true
};

Suspect = new Ped("s_m_y_marine_03", SpawnPoint, 0f)
{
  IsPersistent = true,
  BlockPermanentEvents = true
};

SuspectBlip = new Blip(Suspect)
{
  IsFriendly = false
};

if (Suspect && SuspectVehicle)
{
  Suspect.Tasks.EnterVehicle(SuspectVehicle, 1);
  Suspect.Tasks.CruiseWithVehicle(30f, VehicleDrivingFlags.Emergency);
}

 

Link to comment
Share on other sites

11 hours ago, ToastinYou said:

SuspectVehicle = new Vehicle("CRUSADER", SpawnPoint, 0f)
{
  IsPersistent = true
};

Suspect = new Ped("s_m_y_marine_03", SpawnPoint, 0f)
{
  IsPersistent = true,
  BlockPermanentEvents = true
};

SuspectBlip = new Blip(Suspect)
{
  IsFriendly = false
};

if (Suspect && SuspectVehicle)
{
  Suspect.Tasks.EnterVehicle(SuspectVehicle, 1);
  Suspect.Tasks.CruiseWithVehicle(30f, VehicleDrivingFlags.Emergency);
}

 

This did not work. It keeps on saying that Rage.Vehicle is invalid.

This is what the log is saying.

 

[5/23/2017 6:57:38 AM.231] LSPD First Response: ==============================
[5/23/2017 6:57:38 AM.231] LSPD First Response: UNHANDLED EXCEPTION DURING GAME FIBER TICK
[5/23/2017 6:57:38 AM.232] LSPD First Response: ------------------------------
[5/23/2017 6:57:38 AM.232] LSPD First Response: Origin: Game fiber "CalloutManager".
[5/23/2017 6:57:38 AM.232] LSPD First Response: ------------------------------
[5/23/2017 6:57:38 AM.233] LSPD First Response: Exception type: Rage.Exceptions.InvalidHandleableException
[5/23/2017 6:57:38 AM.233] LSPD First Response: Exception message: Operation is not valid because the specified  Rage.Vehicle is invalid.
[5/23/2017 6:57:38 AM.233] LSPD First Response: ------------------------------
[5/23/2017 6:57:38 AM.234] LSPD First Response: Inner exceptions:
[5/23/2017 6:57:38 AM.234] LSPD First Response: ------------------------------
[5/23/2017 6:57:38 AM.234] LSPD First Response: Stack trace:
[5/23/2017 6:57:38 AM.235] LSPD First Response: at Rage.TaskInvoker.CruiseWithVehicle(Single speed, VehicleDrivingFlags flags)
[5/23/2017 6:57:38 AM.235] at Shadow_Callouts.Callouts.RogueSoldiers.OnCalloutAccepted()

Edited by President Shadow

Youtube: President Shadow

Creator Of Shadow Callouts

Discord: Contact Me and Apply For The Beta: https://discord.gg/q7JPXaR

 

Link to comment
Share on other sites

29 minutes ago, President Shadow said:

This did not work. It keeps on saying that Rage.Vehicle is invalid.

This is what the log is saying.

 

[5/23/2017 6:57:38 AM.231] LSPD First Response: ==============================
[5/23/2017 6:57:38 AM.231] LSPD First Response: UNHANDLED EXCEPTION DURING GAME FIBER TICK
[5/23/2017 6:57:38 AM.232] LSPD First Response: ------------------------------
[5/23/2017 6:57:38 AM.232] LSPD First Response: Origin: Game fiber "CalloutManager".
[5/23/2017 6:57:38 AM.232] LSPD First Response: ------------------------------
[5/23/2017 6:57:38 AM.233] LSPD First Response: Exception type: Rage.Exceptions.InvalidHandleableException
[5/23/2017 6:57:38 AM.233] LSPD First Response: Exception message: Operation is not valid because the specified  Rage.Vehicle is invalid.
[5/23/2017 6:57:38 AM.233] LSPD First Response: ------------------------------
[5/23/2017 6:57:38 AM.234] LSPD First Response: Inner exceptions:
[5/23/2017 6:57:38 AM.234] LSPD First Response: ------------------------------
[5/23/2017 6:57:38 AM.234] LSPD First Response: Stack trace:
[5/23/2017 6:57:38 AM.235] LSPD First Response: at Rage.TaskInvoker.CruiseWithVehicle(Single speed, VehicleDrivingFlags flags)
[5/23/2017 6:57:38 AM.235] at Shadow_Callouts.Callouts.RogueSoldiers.OnCalloutAccepted()

Add some logs to see where your code is reaching before it crashes. If you did exactly as I showed you it shouldn't be crashing unless the model ID is invalid or if the vehicle is being cleaned up.

Link to comment
Share on other sites

It says it's invalid because the ped isn't in the vehicle when the CruiseWithVehicle task is invoked. You either need to wait for the EnterVehicle task to finish, or since you are just creating the ped and vehicle, I guess you want the ped to be inside the vehicle right after creating it, in that case use Ped.WarpIntoVehicle instead of the task.

Link to comment
Share on other sites

9 hours ago, alexguirre said:

It says it's invalid because the ped isn't in the vehicle when the CruiseWithVehicle task is invoked. You either need to wait for the EnterVehicle task to finish, or since you are just creating the ped and vehicle, I guess you want the ped to be inside the vehicle right after creating it, in that case use Ped.WarpIntoVehicle instead of the task.

Thank you!

Youtube: President Shadow

Creator Of Shadow Callouts

Discord: Contact Me and Apply For The Beta: https://discord.gg/q7JPXaR

 

Link to comment
Share on other sites

  • 1 year later...

Where do you guys find the CIV's id's ?  @ToastinYou

HELLO!!     I'm a Greek guy and YouTuber.   I really like Modding and playing LSPDFR!  I'm  very familiar with Programming (Coding) and PC Hardware / Software. I'm also a Cuber ( I Solve Rubicks Cubes and other kinds).   

My YouTube Channel:  https://www.youtube.com/c/ATGGGR/

 

 

 

Link to comment
Share on other sites

19 hours ago, NoNameSet said:

persona

 

Sorry?

HELLO!!     I'm a Greek guy and YouTuber.   I really like Modding and playing LSPDFR!  I'm  very familiar with Programming (Coding) and PC Hardware / Software. I'm also a Cuber ( I Solve Rubicks Cubes and other kinds).   

My YouTube Channel:  https://www.youtube.com/c/ATGGGR/

 

 

 

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.



×
×
  • Create New...