Hello,
I need help. You are my last hope. Otherwise I will give up my project.
I am trying to use certain functions in C# but it doesn’t work! I am trying to code a mod. And for that project I need to use an entity iteration. I have found that functions:
FIND_FIRST_PED and FIND_NEXT_PED
In Lua it works well. But in C# it doesn’t work at all!
In the in-game console I have an error
Also I don’t really understand how these functions work, it seems that they return 2 values. Here is a piece of the code:
public class Class1 : BaseScript
{
public Class1()
{
Tick += OnTick;
}
public async Task OnTick()
{
await Delay(0);
var handle = 0;
var success = false;
OutputArgument entityOut = new OutputArgument();
Function.Call<int>(Hash.FIND_FIRST_PED, entityOut);
int ped = entityOut.GetResult<int>();
do
{
Vector3 Pos = Function.Call<Vector3>(Hash.GET_ENTITY_COORDS, ped);
API.DrawMarker(1, Pos.X, Pos.Y, Pos.Z - 1f, 0f, 0f, 0f, 0f, 0f, 0f, .8f, 8f, 2f, 255, 255, 0, 75, false, false, 2, false, null, null, false);
OutputArgument nextEntityOut = new OutputArgument();
success = Function.Call<bool>(Hash.FIND_NEXT_PED, handle, nextEntityOut);
ped = nextEntityOut.GetResult<int>();
}
while (success == true);
Function.Call(Hash.END_FIND_PED, handle);
}