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.