fix nearby players

This commit is contained in:
Mycroft
2022-08-11 19:56:49 +01:00
parent 16c747fc2a
commit c8bc5e7e77
2 changed files with 7 additions and 7 deletions
+2 -2
View File
@@ -45,8 +45,8 @@ end
---@param source vector3|number playerId or vector3 coordinates
---@param maxDistance number
---@param ignore table playerIds to ignore, where the key is playerId and value is true
function ESX.OneSync.GetPlayersInArea(source, maxDistance, ignore, cb)
cb(getNearbyPlayers(source, false, maxDistance, ignore))
function ESX.OneSync.GetPlayersInArea(source, maxDistance, ignore)
return getNearbyPlayers(source, false, maxDistance, ignore)
end
---@param source vector3|number playerId or vector3 coordinates
+5 -5
View File
@@ -749,15 +749,15 @@ ESX.RegisterServerCallback('esx_property:GetNearbyPlayers', function(source, cb,
local Property = Properties[property]
local Players = {}
local xPlayer = ESX.GetPlayerFromId(source)
ESX.OneSync.GetPlayersInArea(vector3(Property.Entrance.x, Property.Entrance.y, Property.Entrance.z), 5.0, function(NearbyPlayers)
local NearbyPlayers = ESX.OneSync.GetPlayersInArea(vector3(Property.Entrance.x, Property.Entrance.y, Property.Entrance.z), 5.0)
Wait(100)
for k, v in pairs(NearbyPlayers) do
local xTarget = ESX.GetPlayerFromId(v.id)
---if xPlayer.identifier ~= xTarget.identifier then
Players[#Players + 1] = {name = xTarget.getName(), source = xTarget.source}
-- end
if xPlayer.identifier ~= xTarget.identifier then
Players[#Players + 1] = {name = xTarget.getName(), source = xTarget.source}
end
end
cb(Players)
end)
end)
ESX.RegisterServerCallback('esx_property:GetPlayersWithKeys', function(source, cb, property)