-
-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: initial support for ox_core (#382)
- Loading branch information
Showing
5 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
if not Framework.Ox() then return end | ||
|
||
local Ox = require '@ox_core.lib.init' | ||
local player = Ox.GetPlayer() | ||
|
||
RegisterNetEvent("ox:setActiveCharacter", function(character) | ||
if character.isNew then | ||
return InitializeCharacter(Framework.GetGender(true)) | ||
end | ||
|
||
InitAppearance() | ||
end) | ||
|
||
---@todo groups | ||
-- RegisterNetEvent("ox:setGroup", function(group, grade) | ||
-- end) | ||
|
||
function Framework.GetPlayerGender() | ||
return player.get('gender') == 'female' and 'Female' or 'Male' | ||
end | ||
|
||
function Framework.UpdatePlayerData() end | ||
|
||
function Framework.HasTracker() return false end | ||
|
||
function Framework.CheckPlayerMeta() | ||
return LocalPlayer.state.isDead or IsPedCuffed(cache.ped) | ||
end | ||
|
||
function Framework.IsPlayerAllowed(charId) | ||
return charId == player.charId | ||
end | ||
|
||
function Framework.GetRankInputValues() end | ||
|
||
function Framework.GetJobGrade() end | ||
|
||
function Framework.GetGangGrade() end | ||
|
||
function Framework.CachePed() end | ||
|
||
function Framework.RestorePlayerArmour() end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
if not Framework.Ox() then return end | ||
|
||
local Ox = require '@ox_core.lib.init' | ||
|
||
function Framework.GetPlayerID(playerId) | ||
return Ox.GetPlayer(playerId).charId | ||
end | ||
|
||
function Framework.HasMoney(playerId, item, amount) | ||
return exports.ox_inventory:GetItemCount(playerId, item) >= amount | ||
end | ||
|
||
function Framework.RemoveMoney(playerId, type, amount) | ||
return exports.ox_inventory:RemoveItem(playerId, type, amount) | ||
end | ||
|
||
function Framework.GetJob() | ||
return ---@todo | ||
end | ||
|
||
function Framework.GetGang() | ||
return ---@todo | ||
end | ||
|
||
function Framework.SaveAppearance(appearance, charId) | ||
Database.PlayerSkins.UpdateActiveField(charId, 0) | ||
Database.PlayerSkins.DeleteByModel(charId, appearance.model) | ||
Database.PlayerSkins.Add(charId, appearance.model, json.encode(appearance), 1) | ||
end | ||
|
||
function Framework.GetAppearance(charId, model) | ||
local result = Database.PlayerSkins.GetByCitizenID(charId, model) | ||
if result then | ||
return json.decode(result) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters