Yesterday, FiveM introduced two new events for OneSync Infinity in the (2437+) server build. As you may have noticed players are only loading closest players and entities. These events allow you to know from the server who entered, who left a player’s scope.
playerEnteredScope
Triggered when a player enters another player’s scope.
playerLeftScope
Triggered when a player leaves another player’s scope.
Examples
AddEventHandler("playerEnteredScope", function(data)
local playerEntering, player = data["player"], data["for"]
print(("%s is entering %s's scope"):format(playerEntering, player))
end)
AddEventHandler("playerLeftScope", function(data)
local playerLeaving, player = data["player"], data["for"]
print(("%s is leaving %s's scope"):format(playerLeaving, player))
end)
This can be very useful to target players in a specific area or to avoid sending an event to all players.