Trying to figure out how to tell when a payer kills a ped. GetNearbyPeds should be the way to go, but doesn’t work, __data has a problem and breaks the function.
I am at the point of using the ped the player is targeting using Citizen.InvokeNative(“GET_PLAYER_TARGET_ENTITY”, playerPed, entity, Citizen.ReturnResultAnyway()). That function returns a hash for the ped, problem is, how do i turn that hash into a Ped item? Or does the Ped being returned by GetRandomPedAtCoord,for example, just a hash?
Having troubles trying to figure out how to tell when a player kills a ped. Any help or guidance is much appreciated.
Current code:
– Get the player, used all over the script
local playerPed = GetPlayerPed(-1)
– make sure the player is targeting something
if IsPlayerFreeAiming(playerPed) and IsPlayerTargettingAnything(playerPed) then
– get the entity being tageted
entity = 0
if Citizen.InvokeNative(“GET_PLAYER_TARGET_ENTITY”, playerPed, entity, Citizen.ReturnResultAnyway()) then
– got the entity, how to convert to a ped?
-- add ped to ped table to keep an eye out for death
table.insert(peds, ped)
end
end