diff --git a/docs/ox_core/Player/Server/index.md b/docs/ox_core/Player/Server/index.md index 1170723b..1a524cd5 100644 --- a/docs/ox_core/Player/Server/index.md +++ b/docs/ox_core/Player/Server/index.md @@ -30,6 +30,32 @@ console.log(JSON.stringify(player)); +## Ox.GetPlayerByFilter + +Return the first CPlayer that matches the filter properties. + + + +```lua +local filter = { phoneNumber = '556-560-6609' } +local player = Ox.GetPlayerByFilter(source, filter) +print(json.encode(player, { indent = true })) +``` + + + + +```ts +import { GetPlayerByFilter } from '@overextended/ox_core/server'; + +const filter = { phoneNumber: '556-560-6609' }; +const player = GetPlayerByFilter(source); +console.log(JSON.stringify(player)); +``` + + + + ## Ox.GetPlayers Returns an array containing all players. Methods will not be applied if the first argument is false. @@ -41,7 +67,6 @@ Players can be filtered to only return players that match the given properties, ```lua -- Get an array containing all players in the police or sheriff groups, with grade 3 or higher. local filter = { groups = {['sheriff'] = 3, ['police'] = 3} }) - local players = Ox.GetPlayers(usemetatable, filter) for i = 1, #players do