for _, item in pairs(Config.Shark) do
local npc = CreatePed(4, model, item.x, item.y, item.z, item.heading, false, false)
FreezeEntityPosition(npc, false)
SetEntityInvincible(npc, false)
sharkCoords = GetEntityCoords(npc, false)
plyCoords = GetEntityCoords(GetPlayerPed(-1), false)
dist = Vdist(plyCoords.x, plyCoords.y, plyCoords.z, sharkCoords.x, sharkCoords.y , sharkCoords.z)
if dist <= 20.0 then
SetPedSeeingRange(npc, 100.0)
SetPedHearingRange(npc, 80.0)
SetPedCombatAttributes(npc, 46, 1)
SetPedFleeAttributes(npc, 0, 0)
SetPedCombatRange(npc,2)
SetPedRelationshipGroupHash(npc, GetHashKey(0x06C3F072))
SetRelationshipBetweenGroups(5,GetHashKey("PLAYER"),GetHashKey("0x06C3F072"))
SetRelationshipBetweenGroups(5,GetHashKey("0x06C3F072"),GetHashKey("PLAYER"))
TaskCombatPed(npc, GetPlayerPed(-1), 0, 16)
i try this way but the shark alway swim away. it not attack any player. is there any solution to fix it ?