Hi there everyone,
I need to modify a loop that allows someone standing in a circle to check for another player in the circle before it allows them to interact with something.
AddEventHandler('crate:hasEnteredMarker', function(zone, name)
if LastZone == 'containerzone' then
CurrentAction = 'open_container'
CurrentActionMsg = 'Press ~INPUT_CONTEXT~ to open container'
CurrentActionData = {zone = zone}
CurrentActionName = name
end
end)
And I’m not sure how to do that. I looked in the natives for “nearby” but didn’t see anything to catch players The GetClosestPed native states:
This function does not return ped who is:
1. Standing still
2. Driving
3. Fleeing
4. Attacking
This function only work if the ped is:
1. walking normally.
2. waiting to cross a road.
Which won’t do at all. The two players will likely be standing still when the check occurs in the marker.
Is there any way for me to determine if there’s another player nearby?