From ee7cef2ad533051c666e4e45bf8ad66889b4bd78 Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Fri, 7 Jun 2024 13:30:56 +1000 Subject: [PATCH 1/4] wip: ox_core docs --- pages/ox_core/Classes/Client/OxPlayer.mdx | 10 + .../Classes/Client/OxPlayer/addStatus.mdx | 11 ++ pages/ox_core/Classes/Client/OxPlayer/get.mdx | 11 ++ .../Classes/Client/OxPlayer/getCoords.mdx | 11 ++ .../Classes/Client/OxPlayer/getGroup.mdx | 13 ++ .../Client/OxPlayer/getGroupByType.mdx | 11 ++ .../Classes/Client/OxPlayer/getGroups.mdx | 11 ++ .../Classes/Client/OxPlayer/getStatus.mdx | 11 ++ .../Classes/Client/OxPlayer/getStatuses.mdx | 11 ++ .../Classes/Client/OxPlayer/hasPermission.mdx | 11 ++ pages/ox_core/Classes/Client/OxPlayer/on.mdx | 11 ++ .../Classes/Client/OxPlayer/removeStatus.mdx | 11 ++ .../Classes/Client/OxPlayer/setStatus.mdx | 11 ++ .../Server/Functions/CreateVehicle.mdx | 17 ++ .../Classes/Server/Functions/GetPlayer.mdx | 11 ++ .../Server/Functions/GetPlayerFromFilter.mdx | 11 ++ .../Server/Functions/GetPlayerFromUserId.mdx | 11 ++ .../Classes/Server/Functions/GetPlayers.mdx | 11 ++ .../Classes/Server/Functions/GetVehicle.mdx | 11 ++ .../Server/Functions/GetVehicleFromNetId.mdx | 11 ++ .../Server/Functions/GetVehicleFromVin.mdx | 11 ++ .../Classes/Server/Functions/SpawnVehicle.mdx | 11 ++ pages/ox_core/Classes/Server/OxPlayer.mdx | 14 ++ .../Classes/Server/OxPlayer/addLicense.mdx | 11 ++ .../Classes/Server/OxPlayer/addStatus.mdx | 11 ++ .../Server/OxPlayer/createCharacter.mdx | 11 ++ .../Server/OxPlayer/deleteCharacter.mdx | 11 ++ pages/ox_core/Classes/Server/OxPlayer/get.mdx | 11 ++ .../Classes/Server/OxPlayer/getAccount.mdx | 11 ++ .../Classes/Server/OxPlayer/getAccounts.mdx | 11 ++ .../Classes/Server/OxPlayer/getCoords.mdx | 11 ++ .../Classes/Server/OxPlayer/getGroup.mdx | 13 ++ .../Server/OxPlayer/getGroupByType.mdx | 11 ++ .../Classes/Server/OxPlayer/getGroups.mdx | 11 ++ .../Classes/Server/OxPlayer/getLicense.mdx | 11 ++ .../Classes/Server/OxPlayer/getLicenses.mdx | 11 ++ .../Server/OxPlayer/getPlayersInScope.mdx | 11 ++ .../Classes/Server/OxPlayer/getStatus.mdx | 11 ++ .../Classes/Server/OxPlayer/getStatuses.mdx | 11 ++ .../Classes/Server/OxPlayer/hasPermission.mdx | 11 ++ .../Server/OxPlayer/isPlayerInScope.mdx | 11 ++ .../Classes/Server/OxPlayer/logout.mdx | 11 ++ .../Classes/Server/OxPlayer/removeLicense.mdx | 11 ++ .../Classes/Server/OxPlayer/removeStatus.mdx | 11 ++ .../ox_core/Classes/Server/OxPlayer/save.mdx | 11 ++ pages/ox_core/Classes/Server/OxPlayer/set.mdx | 11 ++ .../Server/OxPlayer/setActiveCharacter.mdx | 11 ++ .../Server/OxPlayer/setActiveGroup.mdx | 11 ++ .../Classes/Server/OxPlayer/setAsJoined.mdx | 11 ++ .../Classes/Server/OxPlayer/setGroup.mdx | 11 ++ .../Classes/Server/OxPlayer/setStatus.mdx | 11 ++ .../Server/OxPlayer/triggerScopedEvent.mdx | 11 ++ .../Classes/Server/OxPlayer/updateLicense.mdx | 11 ++ pages/ox_core/Classes/Server/OxVehicle.mdx | 15 ++ .../Classes/Server/OxVehicle/delete.mdx | 11 ++ .../Classes/Server/OxVehicle/despawn.mdx | 11 ++ .../ox_core/Classes/Server/OxVehicle/get.mdx | 11 ++ .../Classes/Server/OxVehicle/getCoords.mdx | 11 ++ .../ox_core/Classes/Server/OxVehicle/save.mdx | 11 ++ .../ox_core/Classes/Server/OxVehicle/set.mdx | 11 ++ .../Classes/Server/OxVehicle/setGroup.mdx | 11 ++ .../Classes/Server/OxVehicle/setOwner.mdx | 11 ++ .../Classes/Server/OxVehicle/setPlate.mdx | 11 ++ .../Classes/Server/OxVehicle/setStored.mdx | 11 ++ pages/ox_core/Client/Player.mdx | 19 -- pages/ox_core/Client/Player/callbacks.mdx | 40 ---- pages/ox_core/Client/Player/events.mdx | 65 ------- pages/ox_core/Client/functions.mdx | 3 - pages/ox_core/Server/Player.mdx | 101 ---------- pages/ox_core/Server/Player/events.mdx | 73 ------- pages/ox_core/Server/Player/methods.mdx | 181 ------------------ pages/ox_core/Server/Vehicle.mdx | 56 ------ pages/ox_core/Server/Vehicle/callbacks.mdx | 16 -- pages/ox_core/Server/Vehicle/methods.mdx | 98 ---------- pages/ox_core/Server/functions.mdx | 3 - pages/ox_core/concepts.mdx | 46 ----- 76 files changed, 720 insertions(+), 701 deletions(-) create mode 100644 pages/ox_core/Classes/Client/OxPlayer.mdx create mode 100644 pages/ox_core/Classes/Client/OxPlayer/addStatus.mdx create mode 100644 pages/ox_core/Classes/Client/OxPlayer/get.mdx create mode 100644 pages/ox_core/Classes/Client/OxPlayer/getCoords.mdx create mode 100644 pages/ox_core/Classes/Client/OxPlayer/getGroup.mdx create mode 100644 pages/ox_core/Classes/Client/OxPlayer/getGroupByType.mdx create mode 100644 pages/ox_core/Classes/Client/OxPlayer/getGroups.mdx create mode 100644 pages/ox_core/Classes/Client/OxPlayer/getStatus.mdx create mode 100644 pages/ox_core/Classes/Client/OxPlayer/getStatuses.mdx create mode 100644 pages/ox_core/Classes/Client/OxPlayer/hasPermission.mdx create mode 100644 pages/ox_core/Classes/Client/OxPlayer/on.mdx create mode 100644 pages/ox_core/Classes/Client/OxPlayer/removeStatus.mdx create mode 100644 pages/ox_core/Classes/Client/OxPlayer/setStatus.mdx create mode 100644 pages/ox_core/Classes/Server/Functions/CreateVehicle.mdx create mode 100644 pages/ox_core/Classes/Server/Functions/GetPlayer.mdx create mode 100644 pages/ox_core/Classes/Server/Functions/GetPlayerFromFilter.mdx create mode 100644 pages/ox_core/Classes/Server/Functions/GetPlayerFromUserId.mdx create mode 100644 pages/ox_core/Classes/Server/Functions/GetPlayers.mdx create mode 100644 pages/ox_core/Classes/Server/Functions/GetVehicle.mdx create mode 100644 pages/ox_core/Classes/Server/Functions/GetVehicleFromNetId.mdx create mode 100644 pages/ox_core/Classes/Server/Functions/GetVehicleFromVin.mdx create mode 100644 pages/ox_core/Classes/Server/Functions/SpawnVehicle.mdx create mode 100644 pages/ox_core/Classes/Server/OxPlayer.mdx create mode 100644 pages/ox_core/Classes/Server/OxPlayer/addLicense.mdx create mode 100644 pages/ox_core/Classes/Server/OxPlayer/addStatus.mdx create mode 100644 pages/ox_core/Classes/Server/OxPlayer/createCharacter.mdx create mode 100644 pages/ox_core/Classes/Server/OxPlayer/deleteCharacter.mdx create mode 100644 pages/ox_core/Classes/Server/OxPlayer/get.mdx create mode 100644 pages/ox_core/Classes/Server/OxPlayer/getAccount.mdx create mode 100644 pages/ox_core/Classes/Server/OxPlayer/getAccounts.mdx create mode 100644 pages/ox_core/Classes/Server/OxPlayer/getCoords.mdx create mode 100644 pages/ox_core/Classes/Server/OxPlayer/getGroup.mdx create mode 100644 pages/ox_core/Classes/Server/OxPlayer/getGroupByType.mdx create mode 100644 pages/ox_core/Classes/Server/OxPlayer/getGroups.mdx create mode 100644 pages/ox_core/Classes/Server/OxPlayer/getLicense.mdx create mode 100644 pages/ox_core/Classes/Server/OxPlayer/getLicenses.mdx create mode 100644 pages/ox_core/Classes/Server/OxPlayer/getPlayersInScope.mdx create mode 100644 pages/ox_core/Classes/Server/OxPlayer/getStatus.mdx create mode 100644 pages/ox_core/Classes/Server/OxPlayer/getStatuses.mdx create mode 100644 pages/ox_core/Classes/Server/OxPlayer/hasPermission.mdx create mode 100644 pages/ox_core/Classes/Server/OxPlayer/isPlayerInScope.mdx create mode 100644 pages/ox_core/Classes/Server/OxPlayer/logout.mdx create mode 100644 pages/ox_core/Classes/Server/OxPlayer/removeLicense.mdx create mode 100644 pages/ox_core/Classes/Server/OxPlayer/removeStatus.mdx create mode 100644 pages/ox_core/Classes/Server/OxPlayer/save.mdx create mode 100644 pages/ox_core/Classes/Server/OxPlayer/set.mdx create mode 100644 pages/ox_core/Classes/Server/OxPlayer/setActiveCharacter.mdx create mode 100644 pages/ox_core/Classes/Server/OxPlayer/setActiveGroup.mdx create mode 100644 pages/ox_core/Classes/Server/OxPlayer/setAsJoined.mdx create mode 100644 pages/ox_core/Classes/Server/OxPlayer/setGroup.mdx create mode 100644 pages/ox_core/Classes/Server/OxPlayer/setStatus.mdx create mode 100644 pages/ox_core/Classes/Server/OxPlayer/triggerScopedEvent.mdx create mode 100644 pages/ox_core/Classes/Server/OxPlayer/updateLicense.mdx create mode 100644 pages/ox_core/Classes/Server/OxVehicle.mdx create mode 100644 pages/ox_core/Classes/Server/OxVehicle/delete.mdx create mode 100644 pages/ox_core/Classes/Server/OxVehicle/despawn.mdx create mode 100644 pages/ox_core/Classes/Server/OxVehicle/get.mdx create mode 100644 pages/ox_core/Classes/Server/OxVehicle/getCoords.mdx create mode 100644 pages/ox_core/Classes/Server/OxVehicle/save.mdx create mode 100644 pages/ox_core/Classes/Server/OxVehicle/set.mdx create mode 100644 pages/ox_core/Classes/Server/OxVehicle/setGroup.mdx create mode 100644 pages/ox_core/Classes/Server/OxVehicle/setOwner.mdx create mode 100644 pages/ox_core/Classes/Server/OxVehicle/setPlate.mdx create mode 100644 pages/ox_core/Classes/Server/OxVehicle/setStored.mdx delete mode 100644 pages/ox_core/Client/Player.mdx delete mode 100644 pages/ox_core/Client/Player/callbacks.mdx delete mode 100644 pages/ox_core/Client/Player/events.mdx delete mode 100644 pages/ox_core/Client/functions.mdx delete mode 100644 pages/ox_core/Server/Player.mdx delete mode 100644 pages/ox_core/Server/Player/events.mdx delete mode 100644 pages/ox_core/Server/Player/methods.mdx delete mode 100644 pages/ox_core/Server/Vehicle.mdx delete mode 100644 pages/ox_core/Server/Vehicle/callbacks.mdx delete mode 100644 pages/ox_core/Server/Vehicle/methods.mdx delete mode 100644 pages/ox_core/Server/functions.mdx delete mode 100644 pages/ox_core/concepts.mdx diff --git a/pages/ox_core/Classes/Client/OxPlayer.mdx b/pages/ox_core/Classes/Client/OxPlayer.mdx new file mode 100644 index 0000000000..d76d5e786b --- /dev/null +++ b/pages/ox_core/Classes/Client/OxPlayer.mdx @@ -0,0 +1,10 @@ +--- +title: OxPlayer +--- + +# OxPlayer + +- state: `StateBagInterface` +- userId: `number` +- charId?: `number` +- stateId?: `string` diff --git a/pages/ox_core/Classes/Client/OxPlayer/addStatus.mdx b/pages/ox_core/Classes/Client/OxPlayer/addStatus.mdx new file mode 100644 index 0000000000..0c16607605 --- /dev/null +++ b/pages/ox_core/Classes/Client/OxPlayer/addStatus.mdx @@ -0,0 +1,11 @@ +--- +title: addStatus +--- + +# OxPlayer.addStatus + +Description.. + +```lua +player.addStatus(statusName: string, value: number): boolean +``` diff --git a/pages/ox_core/Classes/Client/OxPlayer/get.mdx b/pages/ox_core/Classes/Client/OxPlayer/get.mdx new file mode 100644 index 0000000000..6a9ec4cb8a --- /dev/null +++ b/pages/ox_core/Classes/Client/OxPlayer/get.mdx @@ -0,0 +1,11 @@ +--- +title: get +--- + +# OxPlayer.get + +Description.. + +```lua +player.get(key: string): unknown +``` diff --git a/pages/ox_core/Classes/Client/OxPlayer/getCoords.mdx b/pages/ox_core/Classes/Client/OxPlayer/getCoords.mdx new file mode 100644 index 0000000000..0ebb0a8850 --- /dev/null +++ b/pages/ox_core/Classes/Client/OxPlayer/getCoords.mdx @@ -0,0 +1,11 @@ +--- +title: getCoords +--- + +# OxPlayer.getCoords + +Description.. + +```lua +player.getCoords(getShared?: boolean): Vector3 +``` diff --git a/pages/ox_core/Classes/Client/OxPlayer/getGroup.mdx b/pages/ox_core/Classes/Client/OxPlayer/getGroup.mdx new file mode 100644 index 0000000000..a38f9329e6 --- /dev/null +++ b/pages/ox_core/Classes/Client/OxPlayer/getGroup.mdx @@ -0,0 +1,13 @@ +--- +title: getGroup +--- + +# OxPlayer.getGroup + +Description.. + +```lua +player.getGroup(filter: string): number +player.getGroup(filter: string[]): [string, number] +player.getGroup(filter: Record): [string, number] +``` diff --git a/pages/ox_core/Classes/Client/OxPlayer/getGroupByType.mdx b/pages/ox_core/Classes/Client/OxPlayer/getGroupByType.mdx new file mode 100644 index 0000000000..c716b3c15b --- /dev/null +++ b/pages/ox_core/Classes/Client/OxPlayer/getGroupByType.mdx @@ -0,0 +1,11 @@ +--- +title: getGroupByType +--- + +# OxPlayer.getGroupByType + +Description.. + +```lua +player.getGroupByType(type: string): [string, number] +``` diff --git a/pages/ox_core/Classes/Client/OxPlayer/getGroups.mdx b/pages/ox_core/Classes/Client/OxPlayer/getGroups.mdx new file mode 100644 index 0000000000..5871a4a7e2 --- /dev/null +++ b/pages/ox_core/Classes/Client/OxPlayer/getGroups.mdx @@ -0,0 +1,11 @@ +--- +title: getGroups +--- + +# OxPlayer.getGroups + +Description.. + +```lua +player.getGroups(): Record +``` diff --git a/pages/ox_core/Classes/Client/OxPlayer/getStatus.mdx b/pages/ox_core/Classes/Client/OxPlayer/getStatus.mdx new file mode 100644 index 0000000000..b0d8dac8ef --- /dev/null +++ b/pages/ox_core/Classes/Client/OxPlayer/getStatus.mdx @@ -0,0 +1,11 @@ +--- +title: getStatus +--- + +# OxPlayer.getStatus + +Description.. + +```lua +player.getStatus(statusName: string): number +``` diff --git a/pages/ox_core/Classes/Client/OxPlayer/getStatuses.mdx b/pages/ox_core/Classes/Client/OxPlayer/getStatuses.mdx new file mode 100644 index 0000000000..013794134b --- /dev/null +++ b/pages/ox_core/Classes/Client/OxPlayer/getStatuses.mdx @@ -0,0 +1,11 @@ +--- +title: getStatuses +--- + +# OxPlayer.getStatuses + +Description.. + +```lua +player.getStatuses(): Record +``` diff --git a/pages/ox_core/Classes/Client/OxPlayer/hasPermission.mdx b/pages/ox_core/Classes/Client/OxPlayer/hasPermission.mdx new file mode 100644 index 0000000000..ed0fe1689e --- /dev/null +++ b/pages/ox_core/Classes/Client/OxPlayer/hasPermission.mdx @@ -0,0 +1,11 @@ +--- +title: hasPermission +--- + +# OxPlayer.hasPermission + +Description.. + +```lua +player.hasPermission(permission: string): boolean +``` diff --git a/pages/ox_core/Classes/Client/OxPlayer/on.mdx b/pages/ox_core/Classes/Client/OxPlayer/on.mdx new file mode 100644 index 0000000000..cb4365eef1 --- /dev/null +++ b/pages/ox_core/Classes/Client/OxPlayer/on.mdx @@ -0,0 +1,11 @@ +--- +title: on +--- + +# OxPlayer.on + +Description.. + +```lua +player.on(key: string, cb: (data: unknown) => void): unknown +``` diff --git a/pages/ox_core/Classes/Client/OxPlayer/removeStatus.mdx b/pages/ox_core/Classes/Client/OxPlayer/removeStatus.mdx new file mode 100644 index 0000000000..65dd0f605b --- /dev/null +++ b/pages/ox_core/Classes/Client/OxPlayer/removeStatus.mdx @@ -0,0 +1,11 @@ +--- +title: removeStatus +--- + +# OxPlayer.removeStatus + +Description.. + +```lua +player.removeStatus(statusName: string, value: number): boolean +``` diff --git a/pages/ox_core/Classes/Client/OxPlayer/setStatus.mdx b/pages/ox_core/Classes/Client/OxPlayer/setStatus.mdx new file mode 100644 index 0000000000..f46c5fc570 --- /dev/null +++ b/pages/ox_core/Classes/Client/OxPlayer/setStatus.mdx @@ -0,0 +1,11 @@ +--- +title: setStatus +--- + +# OxPlayer.setStatus + +Description.. + +```lua +player.setStatus(statusName: string, value: number): boolean +``` diff --git a/pages/ox_core/Classes/Server/Functions/CreateVehicle.mdx b/pages/ox_core/Classes/Server/Functions/CreateVehicle.mdx new file mode 100644 index 0000000000..3a19aa2978 --- /dev/null +++ b/pages/ox_core/Classes/Server/Functions/CreateVehicle.mdx @@ -0,0 +1,17 @@ +--- +title: CreateVehicle +--- + +# Ox.CreateVehicle + +Description.. + +```lua +Ox.CreateVehicle({ + model: string, + owner?: number, + group?: string, + stored?: number, + properties?: object +}, coords?: Vector3, heading?: number): OxVehicle +``` diff --git a/pages/ox_core/Classes/Server/Functions/GetPlayer.mdx b/pages/ox_core/Classes/Server/Functions/GetPlayer.mdx new file mode 100644 index 0000000000..b5b627c8f8 --- /dev/null +++ b/pages/ox_core/Classes/Server/Functions/GetPlayer.mdx @@ -0,0 +1,11 @@ +--- +title: GetPlayer +--- + +# Ox.GetPlayer + +Description.. + +```lua +Ox.GetPlayer(playerId: string | number): OxPlayer +``` diff --git a/pages/ox_core/Classes/Server/Functions/GetPlayerFromFilter.mdx b/pages/ox_core/Classes/Server/Functions/GetPlayerFromFilter.mdx new file mode 100644 index 0000000000..7b0ec73980 --- /dev/null +++ b/pages/ox_core/Classes/Server/Functions/GetPlayerFromFilter.mdx @@ -0,0 +1,11 @@ +--- +title: GetPlayerFromFilter +--- + +# Ox.GetPlayerFromFilter + +Description.. + +```lua +Ox.GetPlayerFromFilter(filter?: Record): OxPlayer +``` diff --git a/pages/ox_core/Classes/Server/Functions/GetPlayerFromUserId.mdx b/pages/ox_core/Classes/Server/Functions/GetPlayerFromUserId.mdx new file mode 100644 index 0000000000..da7ab0bee9 --- /dev/null +++ b/pages/ox_core/Classes/Server/Functions/GetPlayerFromUserId.mdx @@ -0,0 +1,11 @@ +--- +title: GetPlayerFromUserId +--- + +# Ox.GetPlayerFromUserId + +Description.. + +```lua +Ox.GetPlayerFromUserId(userId: number): OxPlayer +``` diff --git a/pages/ox_core/Classes/Server/Functions/GetPlayers.mdx b/pages/ox_core/Classes/Server/Functions/GetPlayers.mdx new file mode 100644 index 0000000000..a984e2fd07 --- /dev/null +++ b/pages/ox_core/Classes/Server/Functions/GetPlayers.mdx @@ -0,0 +1,11 @@ +--- +title: GetPlayers +--- + +# Ox.GetPlayers + +Description.. + +```lua +Ox.GetPlayers(filter?: Record): Record +``` diff --git a/pages/ox_core/Classes/Server/Functions/GetVehicle.mdx b/pages/ox_core/Classes/Server/Functions/GetVehicle.mdx new file mode 100644 index 0000000000..6945b2660c --- /dev/null +++ b/pages/ox_core/Classes/Server/Functions/GetVehicle.mdx @@ -0,0 +1,11 @@ +--- +title: GetVehicle +--- + +# Ox.GetVehicle + +Description.. + +```lua +Ox.GetVehicle(entityId: number): OxVehicle +``` diff --git a/pages/ox_core/Classes/Server/Functions/GetVehicleFromNetId.mdx b/pages/ox_core/Classes/Server/Functions/GetVehicleFromNetId.mdx new file mode 100644 index 0000000000..8428818a1b --- /dev/null +++ b/pages/ox_core/Classes/Server/Functions/GetVehicleFromNetId.mdx @@ -0,0 +1,11 @@ +--- +title: GetVehicleFromNetId +--- + +# Ox.GetVehicleFromNetId + +Description.. + +```lua +Ox.GetVehicleFromNetId(netId: number): OxVehicle +``` diff --git a/pages/ox_core/Classes/Server/Functions/GetVehicleFromVin.mdx b/pages/ox_core/Classes/Server/Functions/GetVehicleFromVin.mdx new file mode 100644 index 0000000000..ff5f83e173 --- /dev/null +++ b/pages/ox_core/Classes/Server/Functions/GetVehicleFromVin.mdx @@ -0,0 +1,11 @@ +--- +title: GetVehicleFromVin +--- + +# Ox.GetVehicleFromVin + +Description.. + +```lua +Ox.GetVehicleFromVin(vin: string): OxVehicle +``` diff --git a/pages/ox_core/Classes/Server/Functions/SpawnVehicle.mdx b/pages/ox_core/Classes/Server/Functions/SpawnVehicle.mdx new file mode 100644 index 0000000000..2d0edd7d92 --- /dev/null +++ b/pages/ox_core/Classes/Server/Functions/SpawnVehicle.mdx @@ -0,0 +1,11 @@ +--- +title: SpawnVehicle +--- + +# Ox.SpawnVehicle + +Description.. + +```lua +Ox.SpawnVehicle(dbId: number, coords?: Vector3, heading?: number): OxVehicle +``` diff --git a/pages/ox_core/Classes/Server/OxPlayer.mdx b/pages/ox_core/Classes/Server/OxPlayer.mdx new file mode 100644 index 0000000000..bdc49892e2 --- /dev/null +++ b/pages/ox_core/Classes/Server/OxPlayer.mdx @@ -0,0 +1,14 @@ +--- +title: OxPlayer +--- + +# OxPlayer + +- charId: `number` +- identifier: `string` +- ped: `number` +- source: `number` +- state: `StateBagInterface` +- stateId: `string` +- userId: `number` +- username: `string` \ No newline at end of file diff --git a/pages/ox_core/Classes/Server/OxPlayer/addLicense.mdx b/pages/ox_core/Classes/Server/OxPlayer/addLicense.mdx new file mode 100644 index 0000000000..a66266a232 --- /dev/null +++ b/pages/ox_core/Classes/Server/OxPlayer/addLicense.mdx @@ -0,0 +1,11 @@ +--- +title: addLicense +--- + +# OxPlayer.addLicense + +Description.. + +```lua +player.addLicense(licenseName: string): Promise +``` diff --git a/pages/ox_core/Classes/Server/OxPlayer/addStatus.mdx b/pages/ox_core/Classes/Server/OxPlayer/addStatus.mdx new file mode 100644 index 0000000000..0c16607605 --- /dev/null +++ b/pages/ox_core/Classes/Server/OxPlayer/addStatus.mdx @@ -0,0 +1,11 @@ +--- +title: addStatus +--- + +# OxPlayer.addStatus + +Description.. + +```lua +player.addStatus(statusName: string, value: number): boolean +``` diff --git a/pages/ox_core/Classes/Server/OxPlayer/createCharacter.mdx b/pages/ox_core/Classes/Server/OxPlayer/createCharacter.mdx new file mode 100644 index 0000000000..83fce89933 --- /dev/null +++ b/pages/ox_core/Classes/Server/OxPlayer/createCharacter.mdx @@ -0,0 +1,11 @@ +--- +title: createCharacter +--- + +# OxPlayer.createCharacter + +Description.. + +```lua +player.createCharacter(data: object): Promise +``` diff --git a/pages/ox_core/Classes/Server/OxPlayer/deleteCharacter.mdx b/pages/ox_core/Classes/Server/OxPlayer/deleteCharacter.mdx new file mode 100644 index 0000000000..a8337451a9 --- /dev/null +++ b/pages/ox_core/Classes/Server/OxPlayer/deleteCharacter.mdx @@ -0,0 +1,11 @@ +--- +title: deleteCharacter +--- + +# OxPlayer.deleteCharacter + +Description.. + +```lua +player.deleteCharacter(charId: number): Promise +``` diff --git a/pages/ox_core/Classes/Server/OxPlayer/get.mdx b/pages/ox_core/Classes/Server/OxPlayer/get.mdx new file mode 100644 index 0000000000..6a9ec4cb8a --- /dev/null +++ b/pages/ox_core/Classes/Server/OxPlayer/get.mdx @@ -0,0 +1,11 @@ +--- +title: get +--- + +# OxPlayer.get + +Description.. + +```lua +player.get(key: string): unknown +``` diff --git a/pages/ox_core/Classes/Server/OxPlayer/getAccount.mdx b/pages/ox_core/Classes/Server/OxPlayer/getAccount.mdx new file mode 100644 index 0000000000..a040272d14 --- /dev/null +++ b/pages/ox_core/Classes/Server/OxPlayer/getAccount.mdx @@ -0,0 +1,11 @@ +--- +title: getAccount +--- + +# OxPlayer.getAccount + +Description.. + +```lua +player.getAccount(): Promise +``` diff --git a/pages/ox_core/Classes/Server/OxPlayer/getAccounts.mdx b/pages/ox_core/Classes/Server/OxPlayer/getAccounts.mdx new file mode 100644 index 0000000000..db6e999e7c --- /dev/null +++ b/pages/ox_core/Classes/Server/OxPlayer/getAccounts.mdx @@ -0,0 +1,11 @@ +--- +title: getAccounts +--- + +# OxPlayer.getAccounts + +Description.. + +```lua +player.getAccounts(getShared?: boolean): Promise +``` diff --git a/pages/ox_core/Classes/Server/OxPlayer/getCoords.mdx b/pages/ox_core/Classes/Server/OxPlayer/getCoords.mdx new file mode 100644 index 0000000000..0ebb0a8850 --- /dev/null +++ b/pages/ox_core/Classes/Server/OxPlayer/getCoords.mdx @@ -0,0 +1,11 @@ +--- +title: getCoords +--- + +# OxPlayer.getCoords + +Description.. + +```lua +player.getCoords(getShared?: boolean): Vector3 +``` diff --git a/pages/ox_core/Classes/Server/OxPlayer/getGroup.mdx b/pages/ox_core/Classes/Server/OxPlayer/getGroup.mdx new file mode 100644 index 0000000000..a38f9329e6 --- /dev/null +++ b/pages/ox_core/Classes/Server/OxPlayer/getGroup.mdx @@ -0,0 +1,13 @@ +--- +title: getGroup +--- + +# OxPlayer.getGroup + +Description.. + +```lua +player.getGroup(filter: string): number +player.getGroup(filter: string[]): [string, number] +player.getGroup(filter: Record): [string, number] +``` diff --git a/pages/ox_core/Classes/Server/OxPlayer/getGroupByType.mdx b/pages/ox_core/Classes/Server/OxPlayer/getGroupByType.mdx new file mode 100644 index 0000000000..c716b3c15b --- /dev/null +++ b/pages/ox_core/Classes/Server/OxPlayer/getGroupByType.mdx @@ -0,0 +1,11 @@ +--- +title: getGroupByType +--- + +# OxPlayer.getGroupByType + +Description.. + +```lua +player.getGroupByType(type: string): [string, number] +``` diff --git a/pages/ox_core/Classes/Server/OxPlayer/getGroups.mdx b/pages/ox_core/Classes/Server/OxPlayer/getGroups.mdx new file mode 100644 index 0000000000..5871a4a7e2 --- /dev/null +++ b/pages/ox_core/Classes/Server/OxPlayer/getGroups.mdx @@ -0,0 +1,11 @@ +--- +title: getGroups +--- + +# OxPlayer.getGroups + +Description.. + +```lua +player.getGroups(): Record +``` diff --git a/pages/ox_core/Classes/Server/OxPlayer/getLicense.mdx b/pages/ox_core/Classes/Server/OxPlayer/getLicense.mdx new file mode 100644 index 0000000000..ce7844d706 --- /dev/null +++ b/pages/ox_core/Classes/Server/OxPlayer/getLicense.mdx @@ -0,0 +1,11 @@ +--- +title: getLicense +--- + +# OxPlayer.getLicense + +Description.. + +```lua +player.getLicense(licenseName: string): object +``` diff --git a/pages/ox_core/Classes/Server/OxPlayer/getLicenses.mdx b/pages/ox_core/Classes/Server/OxPlayer/getLicenses.mdx new file mode 100644 index 0000000000..a8327a5fff --- /dev/null +++ b/pages/ox_core/Classes/Server/OxPlayer/getLicenses.mdx @@ -0,0 +1,11 @@ +--- +title: getLicenses +--- + +# OxPlayer.getLicenses + +Description.. + +```lua +player.getLicenses(): object +``` diff --git a/pages/ox_core/Classes/Server/OxPlayer/getPlayersInScope.mdx b/pages/ox_core/Classes/Server/OxPlayer/getPlayersInScope.mdx new file mode 100644 index 0000000000..3b395063cc --- /dev/null +++ b/pages/ox_core/Classes/Server/OxPlayer/getPlayersInScope.mdx @@ -0,0 +1,11 @@ +--- +title: getPlayersInScope +--- + +# OxPlayer.getPlayersInScope + +Description.. + +```lua +player.getPlayersInScope(): object +``` diff --git a/pages/ox_core/Classes/Server/OxPlayer/getStatus.mdx b/pages/ox_core/Classes/Server/OxPlayer/getStatus.mdx new file mode 100644 index 0000000000..b0d8dac8ef --- /dev/null +++ b/pages/ox_core/Classes/Server/OxPlayer/getStatus.mdx @@ -0,0 +1,11 @@ +--- +title: getStatus +--- + +# OxPlayer.getStatus + +Description.. + +```lua +player.getStatus(statusName: string): number +``` diff --git a/pages/ox_core/Classes/Server/OxPlayer/getStatuses.mdx b/pages/ox_core/Classes/Server/OxPlayer/getStatuses.mdx new file mode 100644 index 0000000000..013794134b --- /dev/null +++ b/pages/ox_core/Classes/Server/OxPlayer/getStatuses.mdx @@ -0,0 +1,11 @@ +--- +title: getStatuses +--- + +# OxPlayer.getStatuses + +Description.. + +```lua +player.getStatuses(): Record +``` diff --git a/pages/ox_core/Classes/Server/OxPlayer/hasPermission.mdx b/pages/ox_core/Classes/Server/OxPlayer/hasPermission.mdx new file mode 100644 index 0000000000..ed0fe1689e --- /dev/null +++ b/pages/ox_core/Classes/Server/OxPlayer/hasPermission.mdx @@ -0,0 +1,11 @@ +--- +title: hasPermission +--- + +# OxPlayer.hasPermission + +Description.. + +```lua +player.hasPermission(permission: string): boolean +``` diff --git a/pages/ox_core/Classes/Server/OxPlayer/isPlayerInScope.mdx b/pages/ox_core/Classes/Server/OxPlayer/isPlayerInScope.mdx new file mode 100644 index 0000000000..c18de80652 --- /dev/null +++ b/pages/ox_core/Classes/Server/OxPlayer/isPlayerInScope.mdx @@ -0,0 +1,11 @@ +--- +title: isPlayerInScope +--- + +# OxPlayer.isPlayerInScope + +Description.. + +```lua +player.isPlayerInScope(targetId: number): boolean +``` diff --git a/pages/ox_core/Classes/Server/OxPlayer/logout.mdx b/pages/ox_core/Classes/Server/OxPlayer/logout.mdx new file mode 100644 index 0000000000..5549cd1380 --- /dev/null +++ b/pages/ox_core/Classes/Server/OxPlayer/logout.mdx @@ -0,0 +1,11 @@ +--- +title: logout +--- + +# OxPlayer.logout + +Description.. + +```lua +player.logout(dropped?: boolean) +``` diff --git a/pages/ox_core/Classes/Server/OxPlayer/removeLicense.mdx b/pages/ox_core/Classes/Server/OxPlayer/removeLicense.mdx new file mode 100644 index 0000000000..90b94cfa06 --- /dev/null +++ b/pages/ox_core/Classes/Server/OxPlayer/removeLicense.mdx @@ -0,0 +1,11 @@ +--- +title: removeLicense +--- + +# OxPlayer.removeLicense + +Description.. + +```lua +player.removeLicense(licenseName: string): Promise +``` diff --git a/pages/ox_core/Classes/Server/OxPlayer/removeStatus.mdx b/pages/ox_core/Classes/Server/OxPlayer/removeStatus.mdx new file mode 100644 index 0000000000..65dd0f605b --- /dev/null +++ b/pages/ox_core/Classes/Server/OxPlayer/removeStatus.mdx @@ -0,0 +1,11 @@ +--- +title: removeStatus +--- + +# OxPlayer.removeStatus + +Description.. + +```lua +player.removeStatus(statusName: string, value: number): boolean +``` diff --git a/pages/ox_core/Classes/Server/OxPlayer/save.mdx b/pages/ox_core/Classes/Server/OxPlayer/save.mdx new file mode 100644 index 0000000000..30fa3699e1 --- /dev/null +++ b/pages/ox_core/Classes/Server/OxPlayer/save.mdx @@ -0,0 +1,11 @@ +--- +title: save +--- + +# OxPlayer.save + +Description.. + +```lua +player.save(statusName: string, value: number): Promise +``` diff --git a/pages/ox_core/Classes/Server/OxPlayer/set.mdx b/pages/ox_core/Classes/Server/OxPlayer/set.mdx new file mode 100644 index 0000000000..476cb7c4fb --- /dev/null +++ b/pages/ox_core/Classes/Server/OxPlayer/set.mdx @@ -0,0 +1,11 @@ +--- +title: set +--- + +# OxPlayer.set + +Description.. + +```lua +player.set(key: string, value: any, replicated?: boolean) +``` diff --git a/pages/ox_core/Classes/Server/OxPlayer/setActiveCharacter.mdx b/pages/ox_core/Classes/Server/OxPlayer/setActiveCharacter.mdx new file mode 100644 index 0000000000..c78867f069 --- /dev/null +++ b/pages/ox_core/Classes/Server/OxPlayer/setActiveCharacter.mdx @@ -0,0 +1,11 @@ +--- +title: setActiveCharacter +--- + +# OxPlayer.setActiveCharacter + +Description.. + +```lua +player.setActiveCharacter(data: number | object): Promise +``` diff --git a/pages/ox_core/Classes/Server/OxPlayer/setActiveGroup.mdx b/pages/ox_core/Classes/Server/OxPlayer/setActiveGroup.mdx new file mode 100644 index 0000000000..cac2887483 --- /dev/null +++ b/pages/ox_core/Classes/Server/OxPlayer/setActiveGroup.mdx @@ -0,0 +1,11 @@ +--- +title: setActiveGroup +--- + +# OxPlayer.setActiveGroup + +Description.. + +```lua +player.setActiveGroup(setActiveGroup: string, temp?: boolean): boolean +``` diff --git a/pages/ox_core/Classes/Server/OxPlayer/setAsJoined.mdx b/pages/ox_core/Classes/Server/OxPlayer/setAsJoined.mdx new file mode 100644 index 0000000000..d8dc4e0bc1 --- /dev/null +++ b/pages/ox_core/Classes/Server/OxPlayer/setAsJoined.mdx @@ -0,0 +1,11 @@ +--- +title: setAsJoined +--- + +# OxPlayer.setAsJoined + +Description.. + +```lua +player.setAsJoined() +``` diff --git a/pages/ox_core/Classes/Server/OxPlayer/setGroup.mdx b/pages/ox_core/Classes/Server/OxPlayer/setGroup.mdx new file mode 100644 index 0000000000..00e0452f71 --- /dev/null +++ b/pages/ox_core/Classes/Server/OxPlayer/setGroup.mdx @@ -0,0 +1,11 @@ +--- +title: setGroup +--- + +# OxPlayer.setGroup + +Description.. + +```lua +player.setGroup(groupName: string, grade?: number): Promise +``` diff --git a/pages/ox_core/Classes/Server/OxPlayer/setStatus.mdx b/pages/ox_core/Classes/Server/OxPlayer/setStatus.mdx new file mode 100644 index 0000000000..f46c5fc570 --- /dev/null +++ b/pages/ox_core/Classes/Server/OxPlayer/setStatus.mdx @@ -0,0 +1,11 @@ +--- +title: setStatus +--- + +# OxPlayer.setStatus + +Description.. + +```lua +player.setStatus(statusName: string, value: number): boolean +``` diff --git a/pages/ox_core/Classes/Server/OxPlayer/triggerScopedEvent.mdx b/pages/ox_core/Classes/Server/OxPlayer/triggerScopedEvent.mdx new file mode 100644 index 0000000000..fb4e6b3929 --- /dev/null +++ b/pages/ox_core/Classes/Server/OxPlayer/triggerScopedEvent.mdx @@ -0,0 +1,11 @@ +--- +title: triggerScopedEvent +--- + +# OxPlayer.triggerScopedEvent + +Description.. + +```lua +player.triggerScopedEvent(eventName: string, ...args) +``` diff --git a/pages/ox_core/Classes/Server/OxPlayer/updateLicense.mdx b/pages/ox_core/Classes/Server/OxPlayer/updateLicense.mdx new file mode 100644 index 0000000000..6169a269cf --- /dev/null +++ b/pages/ox_core/Classes/Server/OxPlayer/updateLicense.mdx @@ -0,0 +1,11 @@ +--- +title: updateLicense +--- + +# OxPlayer.updateLicense + +Description.. + +```lua +player.updateLicense(licenseName: string, key: string, value: unknown): Promise +``` diff --git a/pages/ox_core/Classes/Server/OxVehicle.mdx b/pages/ox_core/Classes/Server/OxVehicle.mdx new file mode 100644 index 0000000000..0492bb66ad --- /dev/null +++ b/pages/ox_core/Classes/Server/OxVehicle.mdx @@ -0,0 +1,15 @@ +--- +title: OxVehicle +--- + +# OxVehicle + +- entity: `number` +- make: `string` +- model: `string` +- netId: `number` +- plate: `string` +- group?: `string` +- id?: `number` +- owner?: `number` +- vin: `string` \ No newline at end of file diff --git a/pages/ox_core/Classes/Server/OxVehicle/delete.mdx b/pages/ox_core/Classes/Server/OxVehicle/delete.mdx new file mode 100644 index 0000000000..2db109b8a7 --- /dev/null +++ b/pages/ox_core/Classes/Server/OxVehicle/delete.mdx @@ -0,0 +1,11 @@ +--- +title: delete +--- + +# OxVehicle.delete + +Description.. + +```lua +vehicle.delete() +``` diff --git a/pages/ox_core/Classes/Server/OxVehicle/despawn.mdx b/pages/ox_core/Classes/Server/OxVehicle/despawn.mdx new file mode 100644 index 0000000000..94bcd1231c --- /dev/null +++ b/pages/ox_core/Classes/Server/OxVehicle/despawn.mdx @@ -0,0 +1,11 @@ +--- +title: despawn +--- + +# OxVehicle.despawn + +Description.. + +```lua +vehicle.despawn(save?: boolean) +``` diff --git a/pages/ox_core/Classes/Server/OxVehicle/get.mdx b/pages/ox_core/Classes/Server/OxVehicle/get.mdx new file mode 100644 index 0000000000..241917094f --- /dev/null +++ b/pages/ox_core/Classes/Server/OxVehicle/get.mdx @@ -0,0 +1,11 @@ +--- +title: get +--- + +# OxVehicle.get + +Description.. + +```lua +vehicle.get(key: string): unknown +``` diff --git a/pages/ox_core/Classes/Server/OxVehicle/getCoords.mdx b/pages/ox_core/Classes/Server/OxVehicle/getCoords.mdx new file mode 100644 index 0000000000..c84e23db50 --- /dev/null +++ b/pages/ox_core/Classes/Server/OxVehicle/getCoords.mdx @@ -0,0 +1,11 @@ +--- +title: getCoords +--- + +# OxVehicle.getCoords + +Description.. + +```lua +vehicle.getCoords(): Vector3 +``` diff --git a/pages/ox_core/Classes/Server/OxVehicle/save.mdx b/pages/ox_core/Classes/Server/OxVehicle/save.mdx new file mode 100644 index 0000000000..0bf7cf1d15 --- /dev/null +++ b/pages/ox_core/Classes/Server/OxVehicle/save.mdx @@ -0,0 +1,11 @@ +--- +title: save +--- + +# OxVehicle.save + +Description.. + +```lua +vehicle.save(): Promise +``` diff --git a/pages/ox_core/Classes/Server/OxVehicle/set.mdx b/pages/ox_core/Classes/Server/OxVehicle/set.mdx new file mode 100644 index 0000000000..e8314554b5 --- /dev/null +++ b/pages/ox_core/Classes/Server/OxVehicle/set.mdx @@ -0,0 +1,11 @@ +--- +title: set +--- + +# OxVehicle.set + +Description.. + +```lua +vehicle.set(key: string, value: any): Promise +``` diff --git a/pages/ox_core/Classes/Server/OxVehicle/setGroup.mdx b/pages/ox_core/Classes/Server/OxVehicle/setGroup.mdx new file mode 100644 index 0000000000..9a8d2e0435 --- /dev/null +++ b/pages/ox_core/Classes/Server/OxVehicle/setGroup.mdx @@ -0,0 +1,11 @@ +--- +title: setGroup +--- + +# OxVehicle.setGroup + +Description.. + +```lua +vehicle.setGroup(groupName?: string) +``` diff --git a/pages/ox_core/Classes/Server/OxVehicle/setOwner.mdx b/pages/ox_core/Classes/Server/OxVehicle/setOwner.mdx new file mode 100644 index 0000000000..402eec6b89 --- /dev/null +++ b/pages/ox_core/Classes/Server/OxVehicle/setOwner.mdx @@ -0,0 +1,11 @@ +--- +title: setOwner +--- + +# OxVehicle.setOwner + +Description.. + +```lua +vehicle.setOwner(charId?: number) +``` diff --git a/pages/ox_core/Classes/Server/OxVehicle/setPlate.mdx b/pages/ox_core/Classes/Server/OxVehicle/setPlate.mdx new file mode 100644 index 0000000000..bb386d48ef --- /dev/null +++ b/pages/ox_core/Classes/Server/OxVehicle/setPlate.mdx @@ -0,0 +1,11 @@ +--- +title: setPlate +--- + +# OxVehicle.setPlate + +Description.. + +```lua +vehicle.setPlate(plate: string) +``` diff --git a/pages/ox_core/Classes/Server/OxVehicle/setStored.mdx b/pages/ox_core/Classes/Server/OxVehicle/setStored.mdx new file mode 100644 index 0000000000..bb38bb4c6f --- /dev/null +++ b/pages/ox_core/Classes/Server/OxVehicle/setStored.mdx @@ -0,0 +1,11 @@ +--- +title: setStored +--- + +# OxVehicle.setStored + +Description.. + +```lua +vehicle.setStored(value?: string, despawn?: boolean) +``` diff --git a/pages/ox_core/Client/Player.mdx b/pages/ox_core/Client/Player.mdx deleted file mode 100644 index 21b5e8039b..0000000000 --- a/pages/ox_core/Client/Player.mdx +++ /dev/null @@ -1,19 +0,0 @@ -# Client - -When ox_core is imported into a resource it will create the `player` global. -If `player` is nil, then the client has not yet selected a character and spawned. - -**Example:** - -```lua -print(json.encode(player, { indent = true })) -``` - -- player?: `table` - - userId: `number` - - charId: `number` - - stateId: `string` - - firstName: `string` - - lastName: `string` - - name: `string` - - groups: `table` \ No newline at end of file diff --git a/pages/ox_core/Client/Player/callbacks.mdx b/pages/ox_core/Client/Player/callbacks.mdx deleted file mode 100644 index c9c5f7b3cb..0000000000 --- a/pages/ox_core/Client/Player/callbacks.mdx +++ /dev/null @@ -1,40 +0,0 @@ ---- -title: Callbacks ---- - -# Callbacks - -### ox:getStatus - -```lua -lib.callback.await('ox:getStatus', delay, targetId, statusName) -``` - -- delay: `number` -- targetId: `number` - - The server id for the player to get statuses for. -- statusName?: `string` - - The name of the status (i.e. hunger). Can be omitted to return all statuses. - -### ox:getLicense - -```lua -lib.callback.await('ox:getLicense', delay, licenseName, targetId) -``` - -- delay: `number` -- licenseName: `string` - - The name of the license to get data for. Can be omitted to return all licenses. -- targetId?: `number` - - The server id to get license data for, defaulting to the current player. - -### ox:getNearbyVehicles - -```lua -lib.callback.register('ox:getNearbyVehicles', function(radius) -``` - -Returns an array of vehicle netids within a given radius of the player's location. - -- radius?: `number` - - The radius from the player's location to return vehicles. diff --git a/pages/ox_core/Client/Player/events.mdx b/pages/ox_core/Client/Player/events.mdx deleted file mode 100644 index 41bb02e9fd..0000000000 --- a/pages/ox_core/Client/Player/events.mdx +++ /dev/null @@ -1,65 +0,0 @@ ---- -title: Events ---- - -# Events - -## Client events - -### ox:playerLoaded - -Triggered once the player has selected a character and spawned. - -```lua -AddEventHandler('ox:playerLoaded', function(data) end) -``` - -### ox:playerLogout - -Triggered when the player enters character selection if they were previously playing a character. - -```lua -AddEventHandler('ox:playerLogout', function() end) -``` - -### ox:statusTick - -Triggered every 1000ms interval, when status values are updated internally. - -```lua -AddEventHandler('ox:statusTick', function(statuses) end) -``` - -### ox:playerDeath - -Triggered on player death and revival. - -```lua -AddEventHandler('ox:playerDeath', function(isDead) end) -``` - -## Networked events - -### ox:setGroup - -Triggered when the player's grade in a group is modified on the server with `player.setGroup`. - -```lua -RegisterNetEvent('ox:setGroup', function(group, grade) end) -``` - -### ox:licenseAdded - -Triggered when the player has been granted a license. - -```lua -RegisterNetEvent('ox:licenseAdded', function(name) end) -``` - -### ox:licenseRemoved - -Triggered when the player's license is revoked. - -```lua -RegisterNetEvent('ox:licenseRemoved', function(name) end) -``` diff --git a/pages/ox_core/Client/functions.mdx b/pages/ox_core/Client/functions.mdx deleted file mode 100644 index fcf7758d0e..0000000000 --- a/pages/ox_core/Client/functions.mdx +++ /dev/null @@ -1,3 +0,0 @@ -# Functions - -todo diff --git a/pages/ox_core/Server/Player.mdx b/pages/ox_core/Server/Player.mdx deleted file mode 100644 index d2d3bf46f9..0000000000 --- a/pages/ox_core/Server/Player.mdx +++ /dev/null @@ -1,101 +0,0 @@ -import { Tabs, Tab } from 'nextra-theme-docs'; - -# Server - -## Ox.GetPlayer - -Return an instance of OxPlayer for the given player source. - - - -```lua -local player = Ox.GetPlayer(source) -print(json.encode(player, { indent = true })) -``` - - - - -```ts -import { GetPlayer } from '@overextended/ox_core/server'; - -const player = GetPlayer(source); -console.log(JSON.stringify(player)); -``` - - - - -- player?: `table` - - source: `number` - - userId: `number` - - charId: `number` - - stateId: `string` - - firstName: `string` - - lastName: `string` - - name: `string` - - username: `string` - -## Ox.GetPlayerByFilter - -Return the first OxPlayer that matches the filter properties. - - - -```lua -local filter = { phoneNumber = '556-560-6609' } -local player = Ox.GetPlayerByFilter(filter) -print(json.encode(player, { indent = true })) -``` - - - - -```ts -import { GetPlayerByFilter } from '@overextended/ox_core/server'; - -const filter = { phoneNumber: '556-560-6609' }; -const player = GetPlayerByFilter(filter); -console.log(JSON.stringify(player)); -``` - - - - -## Ox.GetPlayers - -Returns an array containing all players. Methods will not be applied if the first argument is false. -Players can be filtered to only return players that match the given properties, or groups. - - - - -```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(filter) - -for i = 1, #players do - local player = players[i] - print(json.encode(player, { indent = true })) -end -``` - - - - -```ts -import { GetPlayers } from '@overextended/ox_core/server'; - -// Get an array containing all players in the police or sheriff groups, with grade 3 or higher. -const filter = { groups: { sheriff: 3, police: 3 } }) - -const players = GetPlayers(filter); -for (let i = 0; i < players.length; i++) { - const player = players[i]; - console.log(JSON.stringify(player)); -} -``` - - - diff --git a/pages/ox_core/Server/Player/events.mdx b/pages/ox_core/Server/Player/events.mdx deleted file mode 100644 index be29065a55..0000000000 --- a/pages/ox_core/Server/Player/events.mdx +++ /dev/null @@ -1,73 +0,0 @@ ---- -title: Events ---- - -# Events - -## Server events - -### ox:playerLoaded - -Triggered after a player has selected a character. - -```lua -AddEventHandler('ox:playerLoaded', function(source, userid, charid) end) -``` - -### ox:setGroup - -Triggered when a player's grade in a group is modified with `player.setGroup`. - -```lua -AddEventHandler('ox:setGroup', function(source, group, grade) end) -``` - -### ox:playerLogout - -Triggered when a player logs out from their current character or disconnects from the server. - -```lua -AddEventHandler('ox:playerLogout', function(source, userid, charid) end) -``` - -### ox:characterDeleted - -Triggered when a player has deleted a character. - -```lua -AddEventHandler('ox:characterDeleted', function(source, userid, charid) end) -``` - -### ox:licenseAdded - -Triggered when a player has been granted a license. - -```lua -AddEventHandler('ox:licenseAdded', function(source, name) end) -``` - -### ox:licenseRemoved - -Triggered when a player's license is revoked. - -```lua -AddEventHandler('ox:licenseRemoved', function(source, name) end) -``` - -## Networked events - -### ox:playerDeath - -Triggered on player death and revival. - -```lua -RegisterNetEvent('ox:playerDeath', function(isDead) end) -``` - -### ox:setPlayerInService - -Can be triggered to set a player as "in service" for a specific group they are a member of. - -```lua -RegisterNetEvent('ox:setPlayerInService', function(group) end) -``` diff --git a/pages/ox_core/Server/Player/methods.mdx b/pages/ox_core/Server/Player/methods.mdx deleted file mode 100644 index 45955cdb4e..0000000000 --- a/pages/ox_core/Server/Player/methods.mdx +++ /dev/null @@ -1,181 +0,0 @@ ---- -title: Methods ---- - -# Methods - -These functions are inherited from the [Player class](../Server/). - -## player.set - -Update the player's metadata, optionally syncing it with the client. - -```lua -player.set(key, value, replicated) -``` - -- key: `string` -- value: `any` -- replicated?: `boolean` - -## player.get - -Get a value from the player's metadata, or omit the argument to get all metadata. - -```lua -player.get(key) -``` - -- key?: `string` - -## player.getState - -Return the player's statebag. - -```lua -player.getState() -``` - -## player.getCoords - -Return the player's position. - -```lua -player.getCoords() -``` - -## player.setGroup - -Updates the player's grade for the given group. Any value below 1 will remove the group from the player. - -```lua -player.setGroup(group, grade) -``` - -- group: `string` -- grade?: `number` - -## player.getGroup - -Returns the player's current grade for a given group. - -```lua -player.getGroup() -``` - -## player.getGroups - -Returns an object of all groups the player is in, with the current grade as the value. - -```lua -player.getGroups() -``` - -## player.hasGroup - -Check if the player is a member of a given group, and returns the matching group name and grade. -The filter can be a string, array, or object where key is the group, and value is the minimum grade. - -```lua -player.hasGroup(filter) -``` - -- filter: `string | string[] | { [string]: number }` - -## player.setStatus - -Set the current value for a status (i.e. hunger, thirst). - -```lua -player.setStatus(name, value) -``` - -- name: string -- value: number - -## player.addStatus - -Add the given amount to the total value for a status (i.e. hunger, thirst). - -```lua -player.addStatus(name, value) -``` - -- name: string -- value: number - -## player.removeStatus - -Remove the given amount from the total value for a status (i.e. hunger, thirst). - -```lua -player.removeStatus(name, value) -``` - -- name: string -- value: number - -## player.getLicenses - -Get all licenses for the player. - -```lua -player.getLicenses() -``` - -## player.getLicense - -Get the license of the given name for the player, as an object containing license information. - -```lua -player.getLicense(name) -``` - -- name: string - -## player.addLicense - -Grants a license to the player and triggers 'ox:licenseAdded' on the server and client. - -```lua -player.addLicense(name) -``` - -- name: string - -## player.removeLicense - -Revokes a license from the player and triggers 'ox:licenseRemoved' on the server and client. - -```lua -player.removeLicense(name) -``` - -- name: string - -## player.getPlayersInScope - -Return an array of all player id's inside the player's scope. - -```lua -player.getPlayersInScope() -``` - -## player.isPlayerInScope - -Check if the given source is inside the player's scope. - -```lua -player.isPlayerInScope(target) -``` - -- target: `number` - -## player.triggerScopedEvent - -```lua -player.triggerScopedEvent(eventName, ...) -``` - -- eventName: `string` -- ...?: `any[]` diff --git a/pages/ox_core/Server/Vehicle.mdx b/pages/ox_core/Server/Vehicle.mdx deleted file mode 100644 index c6930a4475..0000000000 --- a/pages/ox_core/Server/Vehicle.mdx +++ /dev/null @@ -1,56 +0,0 @@ ---- -title: Server -sidebar_position: 1 ---- - -# Server - -## Ox.GetVehicle - -Return an instance of OxVehicle for the given entity. - -```lua -local vehicle = Ox.GetVehicle(entity) -print(json.encode(vehicle, { indent = true })) -``` - -## Ox.GetVehicles - -Returns an array containing all vehicles. Methods will not be applied if the first argument is false. - -```lua -local vehicles = Ox.GetVehicles(usemetatable) - -for i = 1, #vehicles do - local vehicle = vehicles[i] - print(json.encode(vehicle, { indent = true })) -end -``` - -## Ox.CreateVehicle - -Spawns a vehicle and returns the instance of OxVehicle. -If the first argument is a number, it will attempt to spawn a vehicle from the database with a matching id. - -```lua -local vehicleId = MySQL.scalar.await('SELECT id FROM vehicles WHERE owner = ? LIMIT 1', { player.charid }) - -if vehicleId then - local coords = player.getCoords() - local vehicle = Ox.CreateVehicle(vehicleId, vector3(coords.x, coords.y + 1.0, coords.z) , GetEntityHeading(player.ped)) - - if vehicle then - print(json.encode(vehicle, { indent = true })) - end -end -``` - -If the first argument is a table and the owner property is a number, or nil, the vehicle will be added to the database. -Setting the owner as false creates a non-persistent vehicle. - -```lua -local vehicle = Ox.CreateVehicle({ - model = 'sultanrs', - owner = player.charid, -}, player.getCoords(), GetEntityHeading(player.ped)) -``` diff --git a/pages/ox_core/Server/Vehicle/callbacks.mdx b/pages/ox_core/Server/Vehicle/callbacks.mdx deleted file mode 100644 index 12d101310b..0000000000 --- a/pages/ox_core/Server/Vehicle/callbacks.mdx +++ /dev/null @@ -1,16 +0,0 @@ ---- -title: Callbacks ---- - -# Callbacks - -### ox:getNearbyVehicles - -Get all vehicles within range of the target player. - -```lua -lib.callback.await('ox:getNearbyVehicles', playerId, radius) -``` - -- playerId: `number` -- radius?: `number` diff --git a/pages/ox_core/Server/Vehicle/methods.mdx b/pages/ox_core/Server/Vehicle/methods.mdx deleted file mode 100644 index 5898e28ad2..0000000000 --- a/pages/ox_core/Server/Vehicle/methods.mdx +++ /dev/null @@ -1,98 +0,0 @@ ---- -title: Methods ---- - -# Methods - -These functions are inherited from the [Vehicle class](../Server/). - -## vehicle.set - -Sets the vehicle's metadata for key to the given value. - -```lua -vehicle.set(key, value) -``` - -- key: `string` -- value: `any` - -## vehicle.get - -Get a value from the vehicles's metadata, or omit the argument to get all metadata. - -```lua -vehicle.get(key) -``` - -- key?: `string` - -## vehicle.getState - -Return the vehicle's statebag. - -```lua -vehicle.getState() -``` - -## vehicle.getCoords - -Return the vehicle's position. - -```lua -vehicle.getCoords() -``` - -## vehicle.despawn - -Despawns the vehicle but doesn't save it or update the stored value. - -## vehicle.delete - -Remove the vehicle from the database and despawns the entity. - -```lua -vehicle.delete() -``` - -## vehicle.setStored - -Updates the vehicle's "stored" value and optionally despawns it. - -```lua -vehicle.setStored(value, despawn) -``` - -- value?: `string` -- despawn?: `boolean` - -## vehicle.setOwner - -Sets the vehicle's owner, matching a charid or nil to set it as unowned. - -```lua -vehicle.setOwner(owner) -``` - -- owner?: `number` - -## vehicle.setGroup - -Sets the vehicle's group, which can be used for garage restrictions, unowned group vehicles, etc. - -```lua -vehicle.setGroup(group) -``` - -- group?: `string` - -## vehicle.setPlate - -Sets the vehicle's plate, used in the database to ensure uniqueness. Does not necessarily match the plate property (i.e. fake plates). -Plate is always formatted to 8 characters. - -```lua -vehicle.setPlate(plate) -``` - -- plate: `string` diff --git a/pages/ox_core/Server/functions.mdx b/pages/ox_core/Server/functions.mdx deleted file mode 100644 index fcf7758d0e..0000000000 --- a/pages/ox_core/Server/functions.mdx +++ /dev/null @@ -1,3 +0,0 @@ -# Functions - -todo diff --git a/pages/ox_core/concepts.mdx b/pages/ox_core/concepts.mdx deleted file mode 100644 index 6f8089ef6c..0000000000 --- a/pages/ox_core/concepts.mdx +++ /dev/null @@ -1,46 +0,0 @@ -# Concepts - -We'll try to explain some technical but core concepts used in ox_core here. - -## Classes - -Lua doesn't have support for true classes, but rather prototype-based inheritance. -A prototype can hold its own variables and methods, which another object (an instance) can reference or call. - -```lua --- OxPlayer will hold all inherited variables and methods for instances of it. -local OxPlayer = {} - --- Sets the "index metamethod" of OxPlayer to reference itself. --- This is how instances will know to look up the table. -OxPlayer.__index = OxPlayer - --- Set a new metatable on the table passed to the function. --- The important code here is { __index = OxPlayer }. -function OxPlayer.new(player) - return setmetatable(player, OxPlayer) -end - --- Using the `:` syntax will pass the object as the first parameter. -function OxPlayer:getUsername() - return self.username -end - --- Create our instance of OxPlayer. -local player = OxPlayer.new({ - username = 'Bob the Builder' -}) - --- This is the same as OxPlayer.getUsername(player). -local username = player:getUsername() - --- 'Bob the Builder' -print(username) -``` - -When using the imported classes in your resources you can treat the methods as if you are calling a regular function. - -```lua -local player = Ox.GetPlayer(playerId) -print(player.getUsername()) -``` From 487f450d2d14ba6acbc5cfc1262ee87f9bfe413f Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Sat, 8 Jun 2024 14:31:22 +1000 Subject: [PATCH 2/4] more placeholder pages --- pages/ox_core/Classes/Server/OxPlayer/emit.mdx | 11 +++++++++++ pages/ox_core/Classes/Server/OxPlayer/logout.mdx | 2 +- pages/ox_core/Classes/Server/OxVehicle.mdx | 2 +- .../ox_core/Functions/Common/GetTopVehicleStats.mdx | 12 ++++++++++++ pages/ox_core/Functions/Common/GetVehicleData.mdx | 13 +++++++++++++ .../ox_core/Functions/Server/AddAccountBalance.mdx | 11 +++++++++++ pages/ox_core/Functions/Server/CreateBalance.mdx | 11 +++++++++++ .../ox_core/Functions/Server/CreateGroupAccount.mdx | 11 +++++++++++ .../Server}/CreateVehicle.mdx | 0 pages/ox_core/Functions/Server/DeleteAccount.mdx | 11 +++++++++++ pages/ox_core/Functions/Server/DepositMoney.mdx | 11 +++++++++++ .../Functions/Server/GenerateVehiclePlate.mdx | 11 +++++++++++ .../ox_core/Functions/Server/GenerateVehicleVin.mdx | 11 +++++++++++ pages/ox_core/Functions/Server/GetAccountById.mdx | 11 +++++++++++ .../Functions/Server/GetCharIdFromStateId.mdx | 11 +++++++++++ .../Functions/Server/GetCharacterAccount.mdx | 11 +++++++++++ .../Functions/Server/GetCharacterAccounts.mdx | 11 +++++++++++ pages/ox_core/Functions/Server/GetGroupAccount.mdx | 11 +++++++++++ pages/ox_core/Functions/Server/GetGroupAccounts.mdx | 11 +++++++++++ .../Functions => Functions/Server}/GetPlayer.mdx | 0 .../Server}/GetPlayerFromFilter.mdx | 0 .../Server}/GetPlayerFromUserId.mdx | 0 .../Functions => Functions/Server}/GetPlayers.mdx | 2 +- .../Functions => Functions/Server}/GetVehicle.mdx | 0 .../Server}/GetVehicleFromNetId.mdx | 0 .../Server}/GetVehicleFromVin.mdx | 0 .../Functions/Server/RemoveAccountBalance.mdx | 11 +++++++++++ pages/ox_core/Functions/Server/SaveAllPlayers.mdx | 11 +++++++++++ pages/ox_core/Functions/Server/SaveAllVehicles.mdx | 11 +++++++++++ .../Functions => Functions/Server}/SpawnVehicle.mdx | 0 .../Functions/Server/TransferAccountBalance.mdx | 11 +++++++++++ pages/ox_core/Functions/Server/WithdrawMoney.mdx | 11 +++++++++++ 32 files changed, 237 insertions(+), 3 deletions(-) create mode 100644 pages/ox_core/Classes/Server/OxPlayer/emit.mdx create mode 100644 pages/ox_core/Functions/Common/GetTopVehicleStats.mdx create mode 100644 pages/ox_core/Functions/Common/GetVehicleData.mdx create mode 100644 pages/ox_core/Functions/Server/AddAccountBalance.mdx create mode 100644 pages/ox_core/Functions/Server/CreateBalance.mdx create mode 100644 pages/ox_core/Functions/Server/CreateGroupAccount.mdx rename pages/ox_core/{Classes/Server/Functions => Functions/Server}/CreateVehicle.mdx (100%) create mode 100644 pages/ox_core/Functions/Server/DeleteAccount.mdx create mode 100644 pages/ox_core/Functions/Server/DepositMoney.mdx create mode 100644 pages/ox_core/Functions/Server/GenerateVehiclePlate.mdx create mode 100644 pages/ox_core/Functions/Server/GenerateVehicleVin.mdx create mode 100644 pages/ox_core/Functions/Server/GetAccountById.mdx create mode 100644 pages/ox_core/Functions/Server/GetCharIdFromStateId.mdx create mode 100644 pages/ox_core/Functions/Server/GetCharacterAccount.mdx create mode 100644 pages/ox_core/Functions/Server/GetCharacterAccounts.mdx create mode 100644 pages/ox_core/Functions/Server/GetGroupAccount.mdx create mode 100644 pages/ox_core/Functions/Server/GetGroupAccounts.mdx rename pages/ox_core/{Classes/Server/Functions => Functions/Server}/GetPlayer.mdx (100%) rename pages/ox_core/{Classes/Server/Functions => Functions/Server}/GetPlayerFromFilter.mdx (100%) rename pages/ox_core/{Classes/Server/Functions => Functions/Server}/GetPlayerFromUserId.mdx (100%) rename pages/ox_core/{Classes/Server/Functions => Functions/Server}/GetPlayers.mdx (50%) rename pages/ox_core/{Classes/Server/Functions => Functions/Server}/GetVehicle.mdx (100%) rename pages/ox_core/{Classes/Server/Functions => Functions/Server}/GetVehicleFromNetId.mdx (100%) rename pages/ox_core/{Classes/Server/Functions => Functions/Server}/GetVehicleFromVin.mdx (100%) create mode 100644 pages/ox_core/Functions/Server/RemoveAccountBalance.mdx create mode 100644 pages/ox_core/Functions/Server/SaveAllPlayers.mdx create mode 100644 pages/ox_core/Functions/Server/SaveAllVehicles.mdx rename pages/ox_core/{Classes/Server/Functions => Functions/Server}/SpawnVehicle.mdx (100%) create mode 100644 pages/ox_core/Functions/Server/TransferAccountBalance.mdx create mode 100644 pages/ox_core/Functions/Server/WithdrawMoney.mdx diff --git a/pages/ox_core/Classes/Server/OxPlayer/emit.mdx b/pages/ox_core/Classes/Server/OxPlayer/emit.mdx new file mode 100644 index 0000000000..07832eb120 --- /dev/null +++ b/pages/ox_core/Classes/Server/OxPlayer/emit.mdx @@ -0,0 +1,11 @@ +--- +title: emit +--- + +# OxPlayer.emit + +Description.. + +```lua +player.emit(eventName: string, ...args) +``` diff --git a/pages/ox_core/Classes/Server/OxPlayer/logout.mdx b/pages/ox_core/Classes/Server/OxPlayer/logout.mdx index 5549cd1380..95a25c76b0 100644 --- a/pages/ox_core/Classes/Server/OxPlayer/logout.mdx +++ b/pages/ox_core/Classes/Server/OxPlayer/logout.mdx @@ -7,5 +7,5 @@ title: logout Description.. ```lua -player.logout(dropped?: boolean) +player.logout(save?: boolean, dropped?: boolean) ``` diff --git a/pages/ox_core/Classes/Server/OxVehicle.mdx b/pages/ox_core/Classes/Server/OxVehicle.mdx index 0492bb66ad..8d192d2e33 100644 --- a/pages/ox_core/Classes/Server/OxVehicle.mdx +++ b/pages/ox_core/Classes/Server/OxVehicle.mdx @@ -12,4 +12,4 @@ title: OxVehicle - group?: `string` - id?: `number` - owner?: `number` -- vin: `string` \ No newline at end of file +- vin?: `string` \ No newline at end of file diff --git a/pages/ox_core/Functions/Common/GetTopVehicleStats.mdx b/pages/ox_core/Functions/Common/GetTopVehicleStats.mdx new file mode 100644 index 0000000000..a3da88b258 --- /dev/null +++ b/pages/ox_core/Functions/Common/GetTopVehicleStats.mdx @@ -0,0 +1,12 @@ +--- +title: GetTopVehicleStats +--- + +# Ox.GetTopVehicleStats + +Description.. + +```lua +Ox.GetTopVehicleStats(): Record +Ox.GetTopVehicleStats(category: VehicleCategories): VehicleStats +``` diff --git a/pages/ox_core/Functions/Common/GetVehicleData.mdx b/pages/ox_core/Functions/Common/GetVehicleData.mdx new file mode 100644 index 0000000000..770aaa7ccd --- /dev/null +++ b/pages/ox_core/Functions/Common/GetVehicleData.mdx @@ -0,0 +1,13 @@ +--- +title: GetVehicleData +--- + +# Ox.GetVehicleData + +Description.. + +```lua +Ox.GetVehicleData(): Record +Ox.GetVehicleData(filter: string): VehicleData +OX.GetVehicleData(filter: string[]): Record +``` diff --git a/pages/ox_core/Functions/Server/AddAccountBalance.mdx b/pages/ox_core/Functions/Server/AddAccountBalance.mdx new file mode 100644 index 0000000000..2fbc19354b --- /dev/null +++ b/pages/ox_core/Functions/Server/AddAccountBalance.mdx @@ -0,0 +1,11 @@ +--- +title: AddAccountBalance +--- + +# Ox.AddAccountBalance + +Description.. + +```lua +Ox.AddAccountBalance(accountId: number, amount: number, message?: string): Promise +``` diff --git a/pages/ox_core/Functions/Server/CreateBalance.mdx b/pages/ox_core/Functions/Server/CreateBalance.mdx new file mode 100644 index 0000000000..a5e8f81db8 --- /dev/null +++ b/pages/ox_core/Functions/Server/CreateBalance.mdx @@ -0,0 +1,11 @@ +--- +title: CreateAccount +--- + +# Ox.CreateAccount + +Description.. + +```lua +Ox.CreateAccount(charId: number, label: string, shared?: boolean): Promise +``` diff --git a/pages/ox_core/Functions/Server/CreateGroupAccount.mdx b/pages/ox_core/Functions/Server/CreateGroupAccount.mdx new file mode 100644 index 0000000000..3b096fdefe --- /dev/null +++ b/pages/ox_core/Functions/Server/CreateGroupAccount.mdx @@ -0,0 +1,11 @@ +--- +title: CreateGroupAccount +--- + +# Ox.CreateGroupAccount + +Description.. + +```lua +Ox.CreateGroupAccount(groupName: string, label: string, shared?: boolean): Promise +``` diff --git a/pages/ox_core/Classes/Server/Functions/CreateVehicle.mdx b/pages/ox_core/Functions/Server/CreateVehicle.mdx similarity index 100% rename from pages/ox_core/Classes/Server/Functions/CreateVehicle.mdx rename to pages/ox_core/Functions/Server/CreateVehicle.mdx diff --git a/pages/ox_core/Functions/Server/DeleteAccount.mdx b/pages/ox_core/Functions/Server/DeleteAccount.mdx new file mode 100644 index 0000000000..24a6f71252 --- /dev/null +++ b/pages/ox_core/Functions/Server/DeleteAccount.mdx @@ -0,0 +1,11 @@ +--- +title: DeleteAccount +--- + +# Ox.DeleteAccount + +Description.. + +```lua +Ox.DeleteAccount(accountId: number): Promise +``` diff --git a/pages/ox_core/Functions/Server/DepositMoney.mdx b/pages/ox_core/Functions/Server/DepositMoney.mdx new file mode 100644 index 0000000000..942738ef33 --- /dev/null +++ b/pages/ox_core/Functions/Server/DepositMoney.mdx @@ -0,0 +1,11 @@ +--- +title: DepositMoney +--- + +# Ox.DepositMoney + +Description.. + +```lua +Ox.DepositMoney(playerId: number, accountId: number, amount: number): Promise +``` diff --git a/pages/ox_core/Functions/Server/GenerateVehiclePlate.mdx b/pages/ox_core/Functions/Server/GenerateVehiclePlate.mdx new file mode 100644 index 0000000000..88952b6f3b --- /dev/null +++ b/pages/ox_core/Functions/Server/GenerateVehiclePlate.mdx @@ -0,0 +1,11 @@ +--- +title: GenerateVehiclePlate +--- + +# Ox.GenerateVehiclePlate + +Description.. + +```lua +Ox.GenerateVehiclePlate(): Promise +``` diff --git a/pages/ox_core/Functions/Server/GenerateVehicleVin.mdx b/pages/ox_core/Functions/Server/GenerateVehicleVin.mdx new file mode 100644 index 0000000000..49266cdff8 --- /dev/null +++ b/pages/ox_core/Functions/Server/GenerateVehicleVin.mdx @@ -0,0 +1,11 @@ +--- +title: GenerateVehicleVin +--- + +# Ox.GenerateVehicleVin + +Description.. + +```lua +Ox.GenerateVehicleVin(model: string): Promise +``` diff --git a/pages/ox_core/Functions/Server/GetAccountById.mdx b/pages/ox_core/Functions/Server/GetAccountById.mdx new file mode 100644 index 0000000000..bec7940441 --- /dev/null +++ b/pages/ox_core/Functions/Server/GetAccountById.mdx @@ -0,0 +1,11 @@ +--- +title: GetAccountById +--- + +# Ox.GetAccountById + +Description.. + +```lua +Ox.GetAccountById(id: number): Promise +``` diff --git a/pages/ox_core/Functions/Server/GetCharIdFromStateId.mdx b/pages/ox_core/Functions/Server/GetCharIdFromStateId.mdx new file mode 100644 index 0000000000..a46dc7d485 --- /dev/null +++ b/pages/ox_core/Functions/Server/GetCharIdFromStateId.mdx @@ -0,0 +1,11 @@ +--- +title: GetCharIdFromStateId +--- + +# Ox.GetCharIdFromStateId + +Description.. + +```lua +Ox.GetCharIdFromStateId(stateId: string): Promise +``` diff --git a/pages/ox_core/Functions/Server/GetCharacterAccount.mdx b/pages/ox_core/Functions/Server/GetCharacterAccount.mdx new file mode 100644 index 0000000000..01e329aa65 --- /dev/null +++ b/pages/ox_core/Functions/Server/GetCharacterAccount.mdx @@ -0,0 +1,11 @@ +--- +title: GetCharacterAccount +--- + +# Ox.GetCharacterAccount + +Description.. + +```lua +Ox.GetCharacterAccount(id: number | string): Promise +``` diff --git a/pages/ox_core/Functions/Server/GetCharacterAccounts.mdx b/pages/ox_core/Functions/Server/GetCharacterAccounts.mdx new file mode 100644 index 0000000000..3b4d26074d --- /dev/null +++ b/pages/ox_core/Functions/Server/GetCharacterAccounts.mdx @@ -0,0 +1,11 @@ +--- +title: GetCharacterAccounts +--- + +# Ox.GetCharacterAccounts + +Description.. + +```lua +Ox.GetCharacterAccounts(id: number | string, includeAll?: boolean): Promise +``` diff --git a/pages/ox_core/Functions/Server/GetGroupAccount.mdx b/pages/ox_core/Functions/Server/GetGroupAccount.mdx new file mode 100644 index 0000000000..aae7344a72 --- /dev/null +++ b/pages/ox_core/Functions/Server/GetGroupAccount.mdx @@ -0,0 +1,11 @@ +--- +title: GetGroupAccount +--- + +# Ox.GetGroupAccount + +Description.. + +```lua +Ox.GetGroupAccount(groupName: string): Promise +``` diff --git a/pages/ox_core/Functions/Server/GetGroupAccounts.mdx b/pages/ox_core/Functions/Server/GetGroupAccounts.mdx new file mode 100644 index 0000000000..567d0427e2 --- /dev/null +++ b/pages/ox_core/Functions/Server/GetGroupAccounts.mdx @@ -0,0 +1,11 @@ +--- +title: GetGroupAccounts +--- + +# Ox.GetGroupAccounts + +Description.. + +```lua +Ox.GetGroupAccounts(groupName: string): Promise +``` diff --git a/pages/ox_core/Classes/Server/Functions/GetPlayer.mdx b/pages/ox_core/Functions/Server/GetPlayer.mdx similarity index 100% rename from pages/ox_core/Classes/Server/Functions/GetPlayer.mdx rename to pages/ox_core/Functions/Server/GetPlayer.mdx diff --git a/pages/ox_core/Classes/Server/Functions/GetPlayerFromFilter.mdx b/pages/ox_core/Functions/Server/GetPlayerFromFilter.mdx similarity index 100% rename from pages/ox_core/Classes/Server/Functions/GetPlayerFromFilter.mdx rename to pages/ox_core/Functions/Server/GetPlayerFromFilter.mdx diff --git a/pages/ox_core/Classes/Server/Functions/GetPlayerFromUserId.mdx b/pages/ox_core/Functions/Server/GetPlayerFromUserId.mdx similarity index 100% rename from pages/ox_core/Classes/Server/Functions/GetPlayerFromUserId.mdx rename to pages/ox_core/Functions/Server/GetPlayerFromUserId.mdx diff --git a/pages/ox_core/Classes/Server/Functions/GetPlayers.mdx b/pages/ox_core/Functions/Server/GetPlayers.mdx similarity index 50% rename from pages/ox_core/Classes/Server/Functions/GetPlayers.mdx rename to pages/ox_core/Functions/Server/GetPlayers.mdx index a984e2fd07..2a8e4d4559 100644 --- a/pages/ox_core/Classes/Server/Functions/GetPlayers.mdx +++ b/pages/ox_core/Functions/Server/GetPlayers.mdx @@ -7,5 +7,5 @@ title: GetPlayers Description.. ```lua -Ox.GetPlayers(filter?: Record): Record +Ox.GetPlayers(filter?: Record): OxPlayer[] ``` diff --git a/pages/ox_core/Classes/Server/Functions/GetVehicle.mdx b/pages/ox_core/Functions/Server/GetVehicle.mdx similarity index 100% rename from pages/ox_core/Classes/Server/Functions/GetVehicle.mdx rename to pages/ox_core/Functions/Server/GetVehicle.mdx diff --git a/pages/ox_core/Classes/Server/Functions/GetVehicleFromNetId.mdx b/pages/ox_core/Functions/Server/GetVehicleFromNetId.mdx similarity index 100% rename from pages/ox_core/Classes/Server/Functions/GetVehicleFromNetId.mdx rename to pages/ox_core/Functions/Server/GetVehicleFromNetId.mdx diff --git a/pages/ox_core/Classes/Server/Functions/GetVehicleFromVin.mdx b/pages/ox_core/Functions/Server/GetVehicleFromVin.mdx similarity index 100% rename from pages/ox_core/Classes/Server/Functions/GetVehicleFromVin.mdx rename to pages/ox_core/Functions/Server/GetVehicleFromVin.mdx diff --git a/pages/ox_core/Functions/Server/RemoveAccountBalance.mdx b/pages/ox_core/Functions/Server/RemoveAccountBalance.mdx new file mode 100644 index 0000000000..0376773f9e --- /dev/null +++ b/pages/ox_core/Functions/Server/RemoveAccountBalance.mdx @@ -0,0 +1,11 @@ +--- +title: RemoveAccountBalance +--- + +# Ox.RemoveAccountBalance + +Description.. + +```lua +Ox.RemoveAccountBalance(accountId: number, amount: number, overdraw?: boolean, message?: string): Promise +``` diff --git a/pages/ox_core/Functions/Server/SaveAllPlayers.mdx b/pages/ox_core/Functions/Server/SaveAllPlayers.mdx new file mode 100644 index 0000000000..c632f67627 --- /dev/null +++ b/pages/ox_core/Functions/Server/SaveAllPlayers.mdx @@ -0,0 +1,11 @@ +--- +title: SaveAllPlayers +--- + +# Ox.SaveAllPlayers + +Description.. + +```lua +Ox.SaveAllPlayers(kickWithReason?: string) +``` diff --git a/pages/ox_core/Functions/Server/SaveAllVehicles.mdx b/pages/ox_core/Functions/Server/SaveAllVehicles.mdx new file mode 100644 index 0000000000..350251948e --- /dev/null +++ b/pages/ox_core/Functions/Server/SaveAllVehicles.mdx @@ -0,0 +1,11 @@ +--- +title: SaveAllVehicles +--- + +# Ox.SaveAllVehicles + +Description.. + +```lua +Ox.SaveAllVehicles() +``` diff --git a/pages/ox_core/Classes/Server/Functions/SpawnVehicle.mdx b/pages/ox_core/Functions/Server/SpawnVehicle.mdx similarity index 100% rename from pages/ox_core/Classes/Server/Functions/SpawnVehicle.mdx rename to pages/ox_core/Functions/Server/SpawnVehicle.mdx diff --git a/pages/ox_core/Functions/Server/TransferAccountBalance.mdx b/pages/ox_core/Functions/Server/TransferAccountBalance.mdx new file mode 100644 index 0000000000..2d073178d5 --- /dev/null +++ b/pages/ox_core/Functions/Server/TransferAccountBalance.mdx @@ -0,0 +1,11 @@ +--- +title: TransferAccountBalance +--- + +# Ox.TransferAccountBalance + +Description.. + +```lua +Ox.TransferAccountBalance(fromAccount: number, toAccount: number, amount: number, overdraw?: boolean, message?: string): Promise +``` diff --git a/pages/ox_core/Functions/Server/WithdrawMoney.mdx b/pages/ox_core/Functions/Server/WithdrawMoney.mdx new file mode 100644 index 0000000000..fd71edfd96 --- /dev/null +++ b/pages/ox_core/Functions/Server/WithdrawMoney.mdx @@ -0,0 +1,11 @@ +--- +title: WithdrawMoney +--- + +# Ox.WithdrawMoney + +Description.. + +```lua +Ox.WithdrawMoney(playerId: number, accountId: number, amount: number): Promise +``` From 8311c54f899e11db1e9c367f8f86b9fc1a224488 Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Sat, 8 Jun 2024 14:59:53 +1000 Subject: [PATCH 3/4] event placeholders I don't feel great about these --- pages/ox_core/Events/client.mdx | 67 +++++++++++++++++++++++++++++++++ pages/ox_core/Events/server.mdx | 61 ++++++++++++++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 pages/ox_core/Events/client.mdx create mode 100644 pages/ox_core/Events/server.mdx diff --git a/pages/ox_core/Events/client.mdx b/pages/ox_core/Events/client.mdx new file mode 100644 index 0000000000..2641af0bbe --- /dev/null +++ b/pages/ox_core/Events/client.mdx @@ -0,0 +1,67 @@ +# Server Events + +## ox:savedPlayers + +```lua +function(playersSaved: number) +``` + +## ox:setActiveGroup + +```lua +function(playerId: number, groupName: string) +``` + +## ox:setGroup + +```lua +function(playerId: number, groupName: string, grade?: number) +``` + +## ox:licenseAdded + +```lua +function(playerId: number, licenseName: string) +``` + +## ox:licenseRemoved + +```lua +function(playerId: number, licenseName: string) +``` + +## ox:playerLogout + +```lua +function(playerId: number, userId: number, charId: number) +``` + +## ox:createdCharacter + +```lua +function(playerId: number, userId: number, charId: number) +``` + +## ox:playerLoaded + +```lua +function(playerId: number, userId: number, charId: number) +``` + +## ox:deletedCharacter + +```lua +function(playerId: number, userId: number, charId: number) +``` + +## ox:savedVehicles + +```lua +function(vehiclesSaved: number) +``` + +## ox:spawnedVehicle + +```lua +function(entityId: number, id: number) +``` \ No newline at end of file diff --git a/pages/ox_core/Events/server.mdx b/pages/ox_core/Events/server.mdx new file mode 100644 index 0000000000..f46cc5e170 --- /dev/null +++ b/pages/ox_core/Events/server.mdx @@ -0,0 +1,61 @@ +# Client Events + +## ox:playerLoaded + +Description.. + +```lua +function(playerId: number, isNew: boolean) +``` + +## ox:statusTick + +Description.. + +```lua +function(statuses: Record) +``` + +--- + +# Net Events + +## ox:setGroup + +Description.. + +```lua +function(groupName: string, grade?: number) +``` + +## ox:licenseAdded + +Description.. + +```lua +function(licenseName: string) +``` + +## ox:licenseRemoved + +Description.. + +```lua +function(licenseName: string) +``` + +## ox:startCharacterSelect + +Description.. + +```lua +function(userId: number, characters: Character[]) +``` + +## ox:setActiveCharacter + +Description.. + +```lua +function(character: Character, groups: Record) +``` \ No newline at end of file From 026c59869cbfdc6bf5d2030bf46c6f83805fa117 Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Sat, 8 Jun 2024 18:06:23 +1000 Subject: [PATCH 4/4] update setup guide --- pages/ox_core.mdx | 100 ++++++++++++++++------------------- pages/ox_core/_category_.yml | 2 +- 2 files changed, 48 insertions(+), 54 deletions(-) diff --git a/pages/ox_core.mdx b/pages/ox_core.mdx index dc2472e2f1..fd55111fba 100644 --- a/pages/ox_core.mdx +++ b/pages/ox_core.mdx @@ -7,7 +7,7 @@ import { NpmButton } from '@components/button'; -An experimental framework for FiveM. Limited support and breaking changes guaranteed. +A modern FiveM framework. Limited support and breaking changes guaranteed. @@ -20,7 +20,7 @@ Documentation may not be kept updated in some cases. -We **strongly** recommend referring to [Guides](../guides) for setting up Git, Node.js, and pnpm. +We **strongly** recommend referring to [Guides](../guides) to setup necessary development tools. @@ -28,70 +28,51 @@ We **strongly** recommend referring to [Guides](../guides) for setting up Git, N ### Install all resource dependencies. - [oxmysql](../oxmysql) - [ox_lib](../ox_lib/) -- [fivem-appearance](https://github.com/pedr0fontoura/fivem-appearance) -- [ox_appearance](https://github.com/overextended/ox_appearance) -### Download a [release](https://github.com/overextended/ox_core/releases) or build the source code. +### Download the latest [release](https://github.com/overextended/ox_core/releases/latest) or build the source code. + +- Setup [Git](../guides/git), [Node.js](../guides/nodejs), and [pnpm](../guides/pnpm). +- Download and setup [MariaDB](https://mariadb.com/downloads/community/community-server/), if you do not already have a database server. +- Run the following commands in your CLI (e.g. Terminal, Command Prompt). ```bash git clone https://github.com/overextended/ox_core.git -cd ox_core/web +cd ox_core pnpm i pnpm build ``` ### Install optional dependencies. -These resources aren't required but provide additional functionality. +These resources aren't strictly required, but they are strongly recommended. - [ox_inventory](../ox_inventory/) - [npwd](https://github.com/project-error/npwd) -- [pefcl](https://github.com/project-error/pefcl) - -### (Optional) Configure pefcl - -If using it with ox_inventory, open `pefcl/config.json` and enable framework integration. - -```json -"frameworkIntegration": { - "enabled": true, - "resource": "ox_inventory", - "syncInitialBankBalance": false -}, -``` +- [illenium-appearance](https://github.com/iLLeniumStudios/illenium-appearance/archive/refs/heads/main.zip) -## Importing into resources +## Using ox_core in your resources ### Lua -Lua imports can be defined as part of fxmanifest, or loaded with the load function. +You can import ox_core definitions by loading `@ox_core/lib/init.lua` into your resource. - + + Add the import path into your resource's fxmanifest.lua, like any other script file. + This can be a client_script or server_script, if necessary. ```lua - client_scripts { - '@ox_core/imports/client.lua', - 'client/main.lua', - } - - server_scripts { - '@oxmysql/lib/MySQL.lua', - '@ox_core/imports/server.lua', - 'server/main.lua', - } + shared_script '@ox_core/lib/init.lua' ``` + If you prefer, you can use our [require](../ox_lib/Modules/Require/Shared) function from [ox_lib](../ox_lib). ```lua - local file = ('imports/%s.lua'):format(IsDuplicityVersion() and 'server' or 'client') - local import = LoadResourceFile('ox_core', file) - local chunk = assert(load(import, ('@@ox_core/%s'):format(file))) - chunk() + local Ox = require '@ox_core/lib/init.lua' ``` @@ -99,27 +80,40 @@ Lua imports can be defined as part of fxmanifest, or loaded with the load functi ### JavaScript -To use ox_core with your JS/TS resources you'll need to use our npm package, allowing you to import core functions with full type and intellisense support. +To use ox_core with your JavaScript resources you'll need to use our npm package, providing full support for TypeScript and Intellisense. -## Config - -Resource configuration is handled using [convars](https://docs.fivem.net/docs/scripting-reference/convars/). +To get started, try our [fivem-typescript-boilerplate](https://github.com/overextended/fivem-typescript-boilerplate) and install the ox_core package. ```bash -# Players must have a valid identifier to join the server. Used to fetch userid from the database. -set ox:primaryIdentifier "fivem" - -# Set the number of active characters a user can have registered. -setr ox:characterSlots 5 +pnpm i @overextended/ox_core +``` -# Enables debug and development features. Should only be used in a development environment. -setr ox:debug 0 +## Config -# Disable death system handle by core. -setr ox:deathSystem 0 +Resource configuration is handled using [convars](https://docs.fivem.net/docs/scripting-reference/convars/). -# Disable the spawn selection. -setr ox:spawnSelect 0 -``` +### Replicated + +These convars should use the `setr` command to be read by clients. + +- `ox:debug` + - Default: `false` + - Enables debug messages and commands. Enabled by default when using `pnpm watch`. +- `ox:characterSlots` + - Default: `1` + - Sets the number of character slots available for character selection resources (e.g. ox_charselect). +- `ox:plateFormat` + - Default: `"........"` + - See [SET_DEFAULT_VEHICLE_NUMBER_PLATE_TEXT_PATTERN](https://docs.fivem.net/natives/?_0x79780FD2). +- `ox:deathSystem` + - Default: `true` + - Enables the built-in death and respawn system. +- `ox:characterSelect` + - Default: `true` + - Enables built-in character registration, and uses uses that character when joining. +- `ox:spawnLocation` + - Default: `[-258.211, -293.077, 21.6132, 206.0]` + - Sets the default spawn location for newly created characters. + \ No newline at end of file diff --git a/pages/ox_core/_category_.yml b/pages/ox_core/_category_.yml index a4dde0b395..66e9c17346 100644 --- a/pages/ox_core/_category_.yml +++ b/pages/ox_core/_category_.yml @@ -3,5 +3,5 @@ collapsible: true collapsed: true link: type: generated-index - description: An experimental framework for FiveM. Limited support and breaking changes guaranteed. + description: A modern FiveM framework. position: 4