I was doing some testing as I am looking to create a script that would require some managing of peds. During this testing, I also had a 2nd player (my other computer) in the server with me. I had the other player standing near me, and I was trying to spawn 3 peds and perform a simple TaskSequence.
My other computer was able to do this just fine with no error, but on my computer I got the following error in the client console.
[ 2193218] InvokeNative: execution failed: Error executing native 0x93b93a37987f1f3d at address 0x140a6f96e.
The native corresponds to one of the tasks in the tasksequence. I have tried changing tasks, moving them around, commenting some, etc. After I get this error, I’m unable to press the button and spawn any more – as if the script crashed.
I always get an error of this sort (with the respective native code) when I try this on my main computer. If my other computer is disconnected, I can do this just fine. If I connect to the server after my other computer, I can do this just fine (but then my other computer can’t do it).
Here’s the code I am using. I really hope somebody can help me out with this . Also, the “NetworkRequestControlOfEntity” returns true (never has to request it), and I still get the error.
if (Game.IsControlJustReleased(0, Control.PhoneUp))
{
Ped first = await World.CreatePed(new Model(1004114196), new Vector3(2050f, 3450f, 44f)); // bodybuilding lady
Ped second = await World.CreatePed(new Model(2119136831), new Vector3(2045f, 3450f, 44f)); // chinese man
Ped third = await World.CreatePed(new Model(275618457), new Vector3(2040f, 3450f, 44f)); // mask man
Debug.WriteLine($"(1) {API.NetworkRequestControlOfEntity(second.Handle)}");
while (!API.NetworkRequestControlOfEntity(second.Handle))
{
await Delay(250);
API.NetworkRequestControlOfEntity(second.Handle);
Debug.WriteLine($"REQUESTED...");
}
Debug.WriteLine($"(2) {API.NetworkRequestControlOfEntity(second.Handle)}");
TaskSequence ts = new TaskSequence();
ts.AddTask.AchieveHeading(180f);
ts.AddTask.GoTo(new Vector3(2030f, 3450f, 44f));
ts.AddTask.FleeFrom(new Vector3(2045f, 3450f, 44f));
ts.Close();
first.Task.PerformSequence(ts);
second.Task.PerformSequence(ts);
third.Task.PerformSequence(ts);
}