So I’m doing a script to count when a ped is killed by a player
The main part of my script is working when you aim at a ped and you kill him.
So I want to make the script working when you kill a ped when you are in melee (and not aiming) and when you kill a ped with a vehicle
function deleteEntity(entity)
Citizen.InvokeNative(0xAE3CBE5BF394C9C9, Citizen.PointerValueIntInitialized(entity))
end
function rewards()
aiming, ent = GetEntityPlayerIsFreeAimingAt(PlayerId(), Citizen.ReturnResultAnyway())
if IsEntityAPed(ent) then
if IsEntityDead(ent) then
deleteEntity(ent)
local cash
cash = GetPedMoney(GetPlayerPed(-1))
if type(cash) == "boolean" then
cash = 0
end
Wait(1)
SetPedMoney(GetPlayerPed(-1), cash + 10)
PlaySound(-1, "LOCAL_PLYR_CASH_COUNTER_INCREASE", "DLC_HEISTS_GENERAL_FRONTEND_SOUNDS", 0, 0, 1)
end
end
end
Citizen.CreateThread(function()
while true do
Wait(1)
rewards()
end
end)