C# Proper Way to Call Native NETWORK GET ENTITY KILLER OF PLAYER

Trying to call: Hash.NETWORK_GET_ENTITY_KILLER_OF_PLAYER

Trying to get the entity that killed the player. CitizenFX.Core doesn’t have any method to call the native, so trying to make my own. So far I have:

unsafe
            {
                int weaphash = 0;
                Entity killer = Function.Call<Entity>(Hash.NETWORK_GET_ENTITY_KILLER_OF_PLAYER, new InputArgument[] { this.LocalPlayer.Handle, &weaphash });

                
            }

Fivem immediately crashes and the logs only show

[     56031] connect 1a86337f
[     56140] EndpointMapper::HandleRequest: POST /gta5/11/gameservices/auth.asmx/CreateTicketScAuthToken
[     56219] closesocket 0x9ec
[     63406] connect 1a86337f
[     63515] EndpointMapper::HandleRequest: POST /gta5/11/gameservices/auth.asmx/CreateTicketScAuthToken
[     63609] closesocket 0x88c
[     67859] process exited with 31064288!

Anyone have an idea of how to call the native? Thanks.

You can’t use unsafe, try using OutputArgument instead.

Neither does it return an entity. It returns an int (the ped handle). You can do new Ped(pedHandle) afterwards to get a Ped object.