Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function hasClearLos(guardPedId, guardCoords, ped, pedCoords)
- local dist = #(guardCoords-pedCoords)
- if dist < Config.NearDistanceAlarm then
- local clearLos = HasEntityClearLosToEntity(guardPedId, ped, 17)
- if clearLos then
- return IsPedFacingPed(guardPedId, ped, 45.0)
- end
- return false
- end
- return false
- end
- function isPlayerNearGuard()
- local ped = PlayerPedId()
- local coords = GetEntityCoords(ped)
- for _, lPedId in pairs(localPeds) do
- local guardCoords = GetEntityCoords(lPedId)
- if not IsPedDeadOrDying(lPedId) and hasClearLos(lPedId, guardCoords, ped, coords) then
- return true, lPedId
- end
- end
- return false
- end
Advertisement
Add Comment
Please, Sign In to add comment