17 files changed
+208
-499
No files matched your search
+1
-1
@@ -4,7 +4,7 @@ lua54 'yes'
|
||||
use_experimental_fxv2_oal 'yes'
|
||||
author 'The Order of the Sacred Framework'
|
||||
description 'A bridge made for the community to use as a base for their own projects. This bridge will allow a single format to work with nearly all commonly used systems while still offering expandability.'
|
||||
version '0.3.11'
|
||||
version '0.3.12'
|
||||
|
||||
shared_scripts {
|
||||
'@ox_lib/init.lua',
|
||||
|
||||
@@ -63,7 +63,9 @@ end
|
||||
Table.FindFirstUnoccupiedSlot = function(tbl)
|
||||
local occupiedSlots = {}
|
||||
for _, v in pairs(tbl) do
|
||||
occupiedSlots[v.slot] = true
|
||||
if v.slot then
|
||||
occupiedSlots[v.slot] = true
|
||||
end
|
||||
end
|
||||
for i = 1, BridgeServerConfig.MaxInventorySlots do
|
||||
if not occupiedSlots[i] then
|
||||
|
||||
@@ -81,12 +81,16 @@ function Dialogue.Open( name, dialogue, characterOptions, dialogueOptions, onSel
|
||||
})
|
||||
SetNuiFocus(true, true)
|
||||
|
||||
|
||||
local prom = promise.new()
|
||||
local wrappedFunction = function(selected)
|
||||
SetNuiFocus(false, false)
|
||||
Dialogue.Close(name)
|
||||
onSelected(selected)
|
||||
if onSelected then onSelected(selected) end
|
||||
prom:resolve(selected)
|
||||
end
|
||||
promises[name] = wrappedFunction
|
||||
return Citizen.Await(prom)
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -12,6 +12,12 @@ Framework.GetPlayerData = function()
|
||||
return ESX.PlayerData
|
||||
end
|
||||
|
||||
Framework.GetPlayerDob = function()
|
||||
local playerData = ESX.GetPlayerData()
|
||||
local dob = playerData.dateofbirth
|
||||
return dob
|
||||
end
|
||||
|
||||
Framework.GetPlayerMetaData = function(metadata)
|
||||
return ESX.GetPlayerData().metadata[metadata]
|
||||
end
|
||||
|
||||
@@ -8,6 +8,12 @@ Framework.GetFrameworkName = function()
|
||||
return 'es_extended'
|
||||
end
|
||||
|
||||
Framework.GetPlayerDob = function(src)
|
||||
local xPlayer = ESX.GetPlayerFromId(src)
|
||||
local dob = xPlayer.get("dateofbirth")
|
||||
return dob
|
||||
end
|
||||
|
||||
-- Framework.GetPlayerIdentifier(src)
|
||||
-- Returns the citizen ID of the player.
|
||||
Framework.GetPlayerIdentifier = function(src)
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
if GetResourceState('ND_Core') ~= 'started' then return end
|
||||
|
||||
local NDCore = exports["ND_Core"]:GetCoreObject()
|
||||
|
||||
Framework = {}
|
||||
|
||||
Framework.GetPlayerData = function()
|
||||
return NDCore:getPlayer()
|
||||
end
|
||||
|
||||
Framework.GetPlayerMetaData = function(metadata)
|
||||
return NDCore:getPlayer().metadata[metadata]
|
||||
end
|
||||
|
||||
--[[
|
||||
-- Unused by this framework
|
||||
Framework.GetItemInfo = function(item)
|
||||
|
||||
end
|
||||
|
||||
Framework.GetPlayerInventory = function()
|
||||
|
||||
end
|
||||
--]]
|
||||
|
||||
Framework.GetPlayerIdentifier = function()
|
||||
return NDCore:getPlayer().id
|
||||
end
|
||||
|
||||
Framework.GetPlayerName = function()
|
||||
return NDCore:getPlayer().fullname
|
||||
end
|
||||
|
||||
Framework.GetPlayerJob = function()
|
||||
local player = NDCore:getPlayer().jobInfo
|
||||
return player.name, player.label, player.rankname, player.rank
|
||||
end
|
||||
|
||||
Framework.GetIsPlayerDead = function()
|
||||
local playerState = LocalPlayer.state
|
||||
return playerState.dead
|
||||
end
|
||||
|
||||
RegisterNetEvent("ND:characterLoaded",function(character)
|
||||
Wait(1500)
|
||||
FillBridgeTables()
|
||||
TriggerEvent('community_bridge:Client:OnPlayerLoaded')
|
||||
end)
|
||||
|
||||
RegisterNetEvent("ND:characterUnloaded",function()
|
||||
ClearClientSideVariables()
|
||||
TriggerEvent('community_bridge:Client:OnPlayerUnload')
|
||||
end)
|
||||
|
||||
RegisterNetEvent("ND:updateCharacter", function(character)
|
||||
PlayerJobName = character.jobInfo.name
|
||||
PlayerJobLabel = character.jobInfo.label
|
||||
PlayerJobGradeName = character.jobInfo.rankName
|
||||
PlayerJobGradeLevel = character.jobInfo.rank
|
||||
TriggerEvent('community_bridge:Client:OnPlayerJobUpdate', PlayerJobName, PlayerJobLabel, PlayerJobGradeName, PlayerJobGradeLevel)
|
||||
end)
|
||||
@@ -1,208 +0,0 @@
|
||||
--local NDCore = exports["ND_Core"]:GetCoreObject()
|
||||
if GetResourceState('ND_Core') ~= 'started' then return end
|
||||
local NDCore = exports["ND_Core"]
|
||||
|
||||
Framework = {}
|
||||
|
||||
-- Framework.GetPlayerIdentifier(src)
|
||||
-- Returns the citizen ID of the player.
|
||||
Framework.GetPlayerIdentifier = function(src)
|
||||
local player = NDCore:getPlayer(src)
|
||||
return player.id
|
||||
end
|
||||
|
||||
-- Framework.GetPlayerName(src)
|
||||
-- Returns the first and last name of the player.
|
||||
Framework.GetPlayerName = function(src)
|
||||
local player = NDCore:getPlayer(src)
|
||||
return player.fullname
|
||||
end
|
||||
|
||||
--[[
|
||||
-- Unused by this framework
|
||||
Framework.GetItem = function(src, item, metadata)
|
||||
|
||||
end
|
||||
|
||||
Framework.GetItemCount = function(src, item, metadata)
|
||||
|
||||
end
|
||||
|
||||
Framework.GetPlayerInventory = function(src)
|
||||
|
||||
end
|
||||
|
||||
Framework.AddItem = function(src, item, amount, slot, metadata)
|
||||
|
||||
end
|
||||
|
||||
Framework.RemoveItem = function(src, item, amount, slot, metadata)
|
||||
|
||||
end
|
||||
|
||||
Framework.SetMetadata = function(src, item, slot, metadata)
|
||||
|
||||
end
|
||||
|
||||
|
||||
Framework.Commands = {}
|
||||
Framework.Commands.Add = function(name, help, arguments, argsrequired, callback, permission, ...)
|
||||
|
||||
end
|
||||
|
||||
--]]
|
||||
|
||||
-- Framework.SetMetadata(src, metadata, value)
|
||||
-- Adds the specified metadata key and number value to the player's data.
|
||||
Framework.SetPlayerMetadata = function(src, metadata, value)
|
||||
local player = NDCore:getPlayer(src)
|
||||
player.setMetadata(metadata, value)
|
||||
return true
|
||||
end
|
||||
|
||||
-- Framework.GetMetadata(src, metadata)
|
||||
-- Gets the specified metadata key to the player's data.
|
||||
Framework.GetPlayerMetadata = function(src, metadata)
|
||||
local player = NDCore:getPlayer(src)
|
||||
local playerData = player.getMetadata(metadata)
|
||||
return playerData or false
|
||||
end
|
||||
|
||||
-- Framework.AddStress(src, value)
|
||||
-- Adds the specified value to the player's stress level and updates the client HUD.
|
||||
Framework.AddStress = function(src, value)
|
||||
print("Not Bridged Yet")
|
||||
return 0
|
||||
end
|
||||
|
||||
-- Framework.RemoveStress(src, value)
|
||||
-- Removes the specified value from the player's stress level and updates the client HUD.
|
||||
Framework.RemoveStress = function(src, value)
|
||||
print("Not Bridged Yet")
|
||||
return 0
|
||||
end
|
||||
|
||||
-- Framework.AddHunger(src, value)
|
||||
-- Adds the specified value from the player's hunger level.
|
||||
Framework.AddHunger = function(src, value)
|
||||
-- Im stuck
|
||||
end
|
||||
|
||||
-- Framework.AddThirst(src, value)
|
||||
-- Adds the specified value from the player's thirst level.
|
||||
Framework.AddThirst = function(src, value)
|
||||
-- Im stuck
|
||||
end
|
||||
|
||||
Framework.GetHunger = function(src)
|
||||
local player = NDCore:getPlayer(src)
|
||||
local metaData = player.metadata
|
||||
local hunger = metaData.status.hunger.status
|
||||
return hunger
|
||||
end
|
||||
|
||||
Framework.GetThirst = function(src)
|
||||
local player = NDCore:getPlayer(src)
|
||||
local metaData = player.metadata
|
||||
local thirst = metaData.status.thirst.status
|
||||
return thirst
|
||||
end
|
||||
|
||||
-- Framework.GetPlayerPhone(src)
|
||||
-- Returns the phone number of the player.
|
||||
Framework.GetPlayerPhone = function(src)
|
||||
local player = NDCore:getPlayer(src)
|
||||
return player.phonenumber
|
||||
end
|
||||
|
||||
-- Framework.GetPlayerGang(src)
|
||||
-- Returns the gang name of the player.
|
||||
Framework.GetPlayerGang = function(src)
|
||||
print("Not Bridged Yet")
|
||||
return "none"
|
||||
end
|
||||
|
||||
-- Framework.GetPlayersByJob(jobname)
|
||||
-- returns a table of player sources that have the specified job name.
|
||||
Framework.GetPlayersByJob = function(job)
|
||||
local playerList = {}
|
||||
local players = NDCore:getPlayers("job", job, false)
|
||||
for playerSource, _ in pairs(players) do
|
||||
table.insert(playerList, playerSource)
|
||||
end
|
||||
return playerList
|
||||
end
|
||||
|
||||
-- Framework.GetPlayerJob(src)
|
||||
-- Returns the job name, label, grade name, and grade level of the player.
|
||||
Framework.GetPlayerJob = function(src)
|
||||
local player = NDCore:getPlayer(src)
|
||||
local jobName, jobInfo = player.getJob()
|
||||
return jobInfo.name, jobInfo.label, jobInfo.rankName, jobInfo.rank
|
||||
end
|
||||
|
||||
-- Framework.SetPlayerJob(src, name, grade)
|
||||
-- Sets the player's job to the specified name and grade.
|
||||
Framework.SetPlayerJob = function(src, name, grade)
|
||||
local player = NDCore:getPlayer(src)
|
||||
return player.setJob(name, grade)
|
||||
end
|
||||
|
||||
Framework.ToggleDuty = function(src, status)
|
||||
print("Not Bridged Yet")
|
||||
return false
|
||||
end
|
||||
|
||||
-- Framework.AddAccountBalance(src, _type, amount)
|
||||
-- Adds the specified amount to the player's account balance of the specified type.
|
||||
Framework.AddAccountBalance = function(src, _type, amount)
|
||||
local player = NDCore:getPlayer(src)
|
||||
if _type == 'money' then _type = 'cash' end
|
||||
return player.addMoney(_type, amount, "")
|
||||
end
|
||||
|
||||
-- Framework.RemoveAccountBalance(src, _type, amount)
|
||||
-- Removes the specified amount from the player's account balance of the specified type.
|
||||
Framework.RemoveAccountBalance = function(src, _type, amount)
|
||||
local player = NDCore:getPlayer(src)
|
||||
if _type == 'money' then _type = 'cash' end
|
||||
return player.deductMoney(_type, amount, "")
|
||||
end
|
||||
|
||||
-- Framework.GetAccountBalance(src, _type)
|
||||
-- Returns the player's account balance of the specified type.
|
||||
Framework.GetAccountBalance = function(src, _type)
|
||||
local player = NDCore:getPlayer(src)
|
||||
if _type == 'money' then _type = 'cash' end
|
||||
return player.getData(_type)
|
||||
end
|
||||
|
||||
Framework.GetOwnedVehicles = function(src)
|
||||
local player = NDCore:getPlayer(src)
|
||||
local vehicles = NDCore:getVehicles(player.id)
|
||||
local foundvehicles = {}
|
||||
for i=1, #vehicles do
|
||||
local veh = vehicles[i]
|
||||
table.insert(foundvehicles, {vehicle = veh.properties.model, plate = veh.plate})
|
||||
end
|
||||
return foundvehicles
|
||||
end
|
||||
|
||||
Framework.RegisterUsableItem = function(itemName, cb)
|
||||
exports(itemName, function(event, item, inventory, slot, data)
|
||||
local slotData = exports.ox_inventory:GetSlot(inventory.id, slot)
|
||||
if event == 'usingItem' then
|
||||
cb(inventory.id, slotData)
|
||||
return false
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
RegisterNetEvent("ND:characterUnloaded", function()
|
||||
TriggerEvent("community_bridge:Server:OnPlayerUnload", source)
|
||||
end)
|
||||
|
||||
AddEventHandler("playerDropped", function()
|
||||
local src = source
|
||||
TriggerEvent("community_bridge:Server:OnPlayerUnload", src)
|
||||
end)
|
||||
@@ -1,64 +0,0 @@
|
||||
if GetResourceState('ox_core') ~= 'started' then return end
|
||||
|
||||
local Ox = require '@ox_core.lib.init'
|
||||
|
||||
Framework = {}
|
||||
|
||||
Framework.GetPlayerData = function()
|
||||
-- wip
|
||||
end
|
||||
|
||||
Framework.GetPlayerMetaData = function(metadata)
|
||||
-- wip
|
||||
end
|
||||
|
||||
Framework.GetPlayerIdentifier = function()
|
||||
local player = Ox.GetPlayer()
|
||||
return player.stateId
|
||||
end
|
||||
|
||||
Framework.GetPlayerName = function()
|
||||
local player = Ox.GetPlayer()
|
||||
local first = player.get('firstName')
|
||||
local last = player.get('lastName')
|
||||
return first, last
|
||||
end
|
||||
|
||||
Framework.GetPlayerJob = function()
|
||||
local group, grade, title = Ox.getGroupInfo()
|
||||
return group, title, title, grade
|
||||
end
|
||||
|
||||
Framework.HasItem = function()
|
||||
local itemCount = ox_inventory:Search('count', item)
|
||||
local hasItem = itemCount ~= 0
|
||||
return hasItem
|
||||
end
|
||||
|
||||
Framework.GetPlayerInventory = function()
|
||||
return exports.ox_inventory:GetPlayerItems()
|
||||
end
|
||||
|
||||
Framework.GetIsPlayerDead = function()
|
||||
-- wip
|
||||
end
|
||||
|
||||
RegisterNetEvent('ox:playerLoaded', function()
|
||||
Wait(1500)
|
||||
FillBridgeTables()
|
||||
TriggerEvent('community_bridge:Client:OnPlayerLoaded')
|
||||
end)
|
||||
|
||||
|
||||
RegisterNetEvent('ox:playerLogout', function()
|
||||
ClearClientSideVariables()
|
||||
TriggerEvent('community_bridge:Client:OnPlayerUnload')
|
||||
end)
|
||||
|
||||
RegisterNetEvent('ox:setGroup', function(name, grade)
|
||||
PlayerJobName = name
|
||||
PlayerJobLabel = name
|
||||
PlayerJobGradeName = grade
|
||||
PlayerJobGradeLevel = grade
|
||||
TriggerEvent('community_bridge:Client:OnPlayerJobUpdate',PlayerJobName, PlayerJobLabel, PlayerJobGradeName, PlayerJobGradeLevel)
|
||||
end)
|
||||
@@ -1,147 +0,0 @@
|
||||
if GetResourceState('ox_core') ~= 'started' then return end
|
||||
|
||||
local Ox = require '@ox_core.lib.init'
|
||||
|
||||
Framework = {}
|
||||
|
||||
-- Framework.GetPlayerIdentifier(src)
|
||||
-- Returns the citizen ID of the player.
|
||||
Framework.GetPlayerIdentifier = function(src)
|
||||
-- wip
|
||||
end
|
||||
|
||||
-- Framework.GetPlayerName(src)
|
||||
-- Returns the first and last name of the player.
|
||||
Framework.GetPlayerName = function(src)
|
||||
-- wip
|
||||
end
|
||||
|
||||
-- Framework.GetItem(src, item, metadata)
|
||||
-- Returns a table of items matching the specified name and if passed metadata from the player's inventory.
|
||||
-- returns {name = v.name, count = v.amount, metadata = v.info, slot = v.slot}
|
||||
Framework.GetItem = function(src, item, _)
|
||||
-- wip
|
||||
end
|
||||
|
||||
-- Framework.GetItemCount(src, item, _)
|
||||
-- Returns the count of items matching the specified name and if passed metadata from the player's inventory.
|
||||
Framework.GetItemCount = function(src, item, _)
|
||||
-- wip
|
||||
end
|
||||
|
||||
-- Framework.GetPlayerInventory(src)
|
||||
-- Returns the entire inventory of the player as a table.
|
||||
-- returns {name = v.name, count = v.amount, _, _}
|
||||
Framework.GetPlayerInventory = function(src)
|
||||
-- wip
|
||||
end
|
||||
|
||||
-- Framework.SetMetadata(src, metadata, value)
|
||||
-- Adds the specified metadata key and number value to the player's data.
|
||||
Framework.SetPlayerMetadata = function(src, metadata, value)
|
||||
-- wip
|
||||
end
|
||||
|
||||
-- Framework.GetMetadata(src, metadata)
|
||||
-- Gets the specified metadata key and value to the player's data.
|
||||
Framework.GetPlayerMetadata = function(src, metadata)
|
||||
-- wip
|
||||
end
|
||||
|
||||
-- defualt esx Available tables are
|
||||
-- identifier, accounts, group, inventory, job, job_grade, loadout,
|
||||
-- metadata, position, firstname, lastname, dateofbirth, sex, height,
|
||||
-- skin, status, is_dead, id, disabled, last_property, created_at, last_seen,
|
||||
-- phone_number, pincode
|
||||
Framework.GetStatus = function(src, column)
|
||||
-- wip
|
||||
end
|
||||
|
||||
-- Framework.AddThirst(src, value)
|
||||
-- Adds the specified value from the player's thirst level.
|
||||
Framework.AddThirst = function(src, value)
|
||||
-- wip
|
||||
end
|
||||
|
||||
-- Framework.AddHunger(src, value)
|
||||
-- Adds the specified value from the player's hunger level.
|
||||
Framework.AddHunger = function(src, value)
|
||||
-- wip
|
||||
end
|
||||
|
||||
Framework.GetHunger = function(src)
|
||||
-- wip
|
||||
end
|
||||
|
||||
Framework.GetThirst = function(src)
|
||||
-- wip
|
||||
end
|
||||
|
||||
-- Framework.GetPlayerPhone(src)
|
||||
-- Returns the phone number of the player.
|
||||
Framework.GetPlayerPhone = function(src)
|
||||
-- wip
|
||||
end
|
||||
|
||||
-- Framework.GetPlayerJob(src)
|
||||
-- Returns the job name, label, grade name, and grade level of the player.
|
||||
Framework.GetPlayerJob = function(src)
|
||||
-- wip
|
||||
end
|
||||
|
||||
-- Framework.GetPlayersByJob(jobname)
|
||||
-- returns a table of player sources that have the specified job name.
|
||||
Framework.GetPlayersByJob = function(job)
|
||||
-- wip
|
||||
end
|
||||
|
||||
-- Framework.SetPlayerJob(src, name, grade)
|
||||
-- Sets the player's job to the specified name and grade.
|
||||
Framework.SetPlayerJob = function(src, name, grade)
|
||||
-- wip
|
||||
end
|
||||
|
||||
Framework.ToggleDuty = function(src, status)
|
||||
-- wip
|
||||
end
|
||||
|
||||
-- Framework.AddAccountBalance(src, _type, amount)
|
||||
-- Adds the specified amount to the player's account balance of the specified type.
|
||||
Framework.AddAccountBalance = function(src, _type, amount)
|
||||
-- wip
|
||||
end
|
||||
|
||||
-- Framework.RemoveAccountBalance(src, _type, amount)
|
||||
-- Removes the specified amount from the player's account balance of the specified type.
|
||||
Framework.RemoveAccountBalance = function(src, _type, amount)
|
||||
-- wip
|
||||
end
|
||||
|
||||
-- Framework.GetAccountBalance(src, _type)
|
||||
-- Returns the player's account balance of the specified type.
|
||||
Framework.GetAccountBalance = function(src, _type)
|
||||
-- wip
|
||||
end
|
||||
|
||||
-- Framework.AddItem(src, item, amount, _, _)
|
||||
-- Adds the specified item to the player's inventory.
|
||||
Framework.AddItem = function(src, item, amount, slot, metadata)
|
||||
-- wip
|
||||
end
|
||||
|
||||
-- Framework.RemoveItem(src, item, amount, _, _)
|
||||
-- Removes the specified item from the player's inventory.
|
||||
Framework.RemoveItem = function(src, item, amount, slot, metadata)
|
||||
-- wip
|
||||
end
|
||||
|
||||
-- Framework.RegisterUsableItem(item, cb)
|
||||
-- Registers a usable item with a callback function.
|
||||
Framework.RegisterUsableItem = function(itemName, cb)
|
||||
exports(itemName, function(event, item, inventory, slot, data)
|
||||
local slotData = exports.ox_inventory:GetSlot(inventory.id, slot)
|
||||
if event == 'usingItem' then
|
||||
cb(inventory.id, item, slotData)
|
||||
end
|
||||
end)
|
||||
end
|
||||
@@ -13,6 +13,12 @@ Framework.GetPlayerData = function()
|
||||
return QBCore.Functions.GetPlayerData()
|
||||
end
|
||||
|
||||
Framework.GetPlayerDob = function()
|
||||
local player = QBCore.Functions.GetPlayerData()
|
||||
local playerData = player.PlayerData
|
||||
return playerData.charinfo.birthdate
|
||||
end
|
||||
|
||||
Framework.GetPlayerMetaData = function(metadata)
|
||||
return QBCore.Functions.GetPlayerData().metadata[metadata]
|
||||
end
|
||||
|
||||
@@ -12,21 +12,32 @@ end
|
||||
-- Framework.GetPlayerIdentifier(src)
|
||||
-- Returns the citizen ID of the player.
|
||||
Framework.GetPlayerIdentifier = function(src)
|
||||
return QBCore.Functions.GetPlayer(src).PlayerData.citizenid
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local playerData = player.PlayerData
|
||||
return playerData.citizenid
|
||||
end
|
||||
|
||||
-- Framework.GetPlayerName(src)
|
||||
-- Returns the first and last name of the player.
|
||||
Framework.GetPlayerName = function(src)
|
||||
local playerData = QBCore.Functions.GetPlayer(src).PlayerData
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local playerData = player.PlayerData
|
||||
return playerData.charinfo.firstname, playerData.charinfo.lastname
|
||||
end
|
||||
|
||||
Framework.GetPlayerDob = function(src)
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local playerData = player.PlayerData
|
||||
return playerData.charinfo.birthdate
|
||||
end
|
||||
|
||||
-- Framework.GetItem(src, item, metadata)
|
||||
-- Returns a table of items matching the specified name and if passed metadata from the player's inventory.
|
||||
-- returns {name = v.name, count = v.amount, metadata = v.info, slot = v.slot}
|
||||
Framework.GetItem = function(src, item, metadata)
|
||||
local playerInventory = QBCore.Functions.GetPlayer(src).PlayerData.items
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local playerData = player.PlayerData
|
||||
local playerInventory = playerData.items
|
||||
local repackedTable = {}
|
||||
for _, v in pairs(playerInventory) do
|
||||
if v.name == item and (not metadata or v.info == metadata) then
|
||||
@@ -44,7 +55,9 @@ end
|
||||
-- Framework.GetItemCount(src, item, metadata)
|
||||
-- Returns the count of items matching the specified name and if passed metadata from the player's inventory.
|
||||
Framework.GetItemCount = function(src, item, metadata)
|
||||
local playerInventory = QBCore.Functions.GetPlayer(src).PlayerData.items
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local playerData = player.PlayerData
|
||||
local playerInventory = playerData.items
|
||||
local count = 0
|
||||
for _, v in pairs(playerInventory) do
|
||||
if v.name == item and (not metadata or v.info == metadata) then
|
||||
@@ -58,9 +71,11 @@ end
|
||||
-- Returns the entire inventory of the player as a table.
|
||||
-- returns {name = v.name, count = v.amount, metadata = v.info, slot = v.slot}
|
||||
Framework.GetPlayerInventory = function(src)
|
||||
local playerItems = QBCore.Functions.GetPlayer(src).PlayerData.items
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local playerData = player.PlayerData
|
||||
local playerInventory = playerData.items
|
||||
local repackedTable = {}
|
||||
for _, v in pairs(playerItems) do
|
||||
for _, v in pairs(playerInventory) do
|
||||
table.insert(repackedTable, {
|
||||
name = v.name,
|
||||
count = v.amount,
|
||||
@@ -72,9 +87,11 @@ Framework.GetPlayerInventory = function(src)
|
||||
end
|
||||
|
||||
Framework.GetItemBySlot = function(src, slot)
|
||||
local playerItems = QBCore.Functions.GetPlayer(src).PlayerData.items
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local playerData = player.PlayerData
|
||||
local playerInventory = playerData.items
|
||||
local repack = {}
|
||||
for _, v in pairs(playerItems) do
|
||||
for _, v in pairs(playerInventory) do
|
||||
if v.slot == slot then
|
||||
return {
|
||||
name = v.name,
|
||||
@@ -159,23 +176,26 @@ Framework.GetHunger = function(src)
|
||||
end
|
||||
|
||||
Framework.GetThirst = function(src)
|
||||
local player = QBCore.Functions.GetPlayer(src).PlayerData
|
||||
local newThirst = (player.metadata.thirst or 0)
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local playerData = player.PlayerData
|
||||
local newThirst = (playerData.metadata.thirst or 0)
|
||||
return newThirst
|
||||
end
|
||||
|
||||
-- Framework.GetPlayerPhone(src)
|
||||
-- Returns the phone number of the player.
|
||||
Framework.GetPlayerPhone = function(src)
|
||||
local playerData = QBCore.Functions.GetPlayer(src).PlayerData
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local playerData = player.PlayerData
|
||||
return playerData.charinfo.phone
|
||||
end
|
||||
|
||||
-- Framework.GetPlayerGang(src)
|
||||
-- Returns the gang name of the player.
|
||||
Framework.GetPlayerGang = function(src)
|
||||
local player = QBCore.Functions.GetPlayer(src).PlayerData
|
||||
return player.gang.name
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local playerData = player.PlayerData
|
||||
return playerData.gang.name
|
||||
end
|
||||
|
||||
-- Framework.GetPlayersByJob(jobname)
|
||||
@@ -195,8 +215,9 @@ end
|
||||
-- Framework.GetPlayerJob(src)
|
||||
-- Returns the job name, label, grade name, and grade level of the player.
|
||||
Framework.GetPlayerJob = function(src)
|
||||
local player = QBCore.Functions.GetPlayer(src).PlayerData
|
||||
return player.job.name, player.job.label, player.job.grade.name, player.job.grade.level
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local playerData = player.PlayerData
|
||||
return playerData.job.name, playerData.job.label, playerData.job.grade.name, playerData.job.grade.level
|
||||
end
|
||||
|
||||
-- Framework.SetPlayerJob(src, name, grade)
|
||||
|
||||
@@ -12,6 +12,11 @@ Framework.GetPlayerData = function()
|
||||
return QBox.GetPlayerData()
|
||||
end
|
||||
|
||||
Framework.GetPlayerDob = function()
|
||||
local playerData = QBox.GetPlayerData()
|
||||
return playerData.charinfo.birthdate
|
||||
end
|
||||
|
||||
Framework.GetPlayerMetaData = function(metadata)
|
||||
local playerData = QBox.GetPlayerData()
|
||||
return playerData.metadata[metadata]
|
||||
|
||||
@@ -8,6 +8,11 @@ Framework.GetFrameworkName = function()
|
||||
return 'qbx_core'
|
||||
end
|
||||
|
||||
Framework.GetPlayerDob = function(src)
|
||||
local playerData = QBox:GetPlayer(src).PlayerData
|
||||
return playerData.charinfo.birthdate
|
||||
end
|
||||
|
||||
-- Framework.GetPlayerIdentifier(src)
|
||||
-- Returns the citizen ID of the player.
|
||||
Framework.GetPlayerIdentifier = function(src)
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
if GetResourceState('core_inventory') ~= 'started' then return end
|
||||
|
||||
Inventory = Inventory or {}
|
||||
|
||||
local core = exports.core_inventory
|
||||
|
||||
Inventory = Inventory or {}
|
||||
|
||||
Inventory.GetImagePath = function(item)
|
||||
local file = LoadResourceFile("core_inventory", string.format("html/img/%s.png", item))
|
||||
local imagePath = file and string.format("nui://core_inventory/html/img/%s.png", item)
|
||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||
end
|
||||
@@ -0,0 +1,30 @@
|
||||
if GetResourceState('core_inventory') ~= 'started' then return end
|
||||
|
||||
Inventory = Inventory or {}
|
||||
|
||||
local core = exports.core_inventory
|
||||
|
||||
Inventory.GetImagePath = function(item)
|
||||
local file = LoadResourceFile("core_inventory", string.format("html/img/%s.png", item))
|
||||
local imagePath = file and string.format("nui://core_inventory/html/img/%s.png", item)
|
||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||
end
|
||||
|
||||
Inventory.UpdatePlate = function(oldplate, newplate)
|
||||
-- have no clue if this will work but fingers crossed
|
||||
local queries = {
|
||||
'UPDATE coreinventories SET name = @newplate WHERE name = @oldplate',
|
||||
'UPDATE coreinventories SET name = @newplate WHERE name = @glovebox_oldplate',
|
||||
'UPDATE coreinventories SET name = @newplate WHERE name = @trunk_oldplate',
|
||||
}
|
||||
local values = {
|
||||
newplate = newplate,
|
||||
oldplate = oldplate,
|
||||
glovebox_oldplate = 'glovebox-' .. oldplate,
|
||||
trunk_oldplate = 'trunk-' .. oldplate
|
||||
}
|
||||
MySQL.transaction.await(queries, values)
|
||||
if GetResourceState('jg-mechanic') ~= 'started' then return true end
|
||||
exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
|
||||
return true
|
||||
end
|
||||
@@ -23,6 +23,7 @@ Target.FixOptions = function(options)
|
||||
return action(entityOrData)
|
||||
end
|
||||
options[k].action = select
|
||||
options[k].job = v.job or v.groups
|
||||
end
|
||||
return options
|
||||
end
|
||||
|
||||
Vendored
+91
-1
@@ -1 +1,91 @@
|
||||
.container{display:flex;flex-direction:column;align-items:center;width:100%;min-height:100vh;background:transparent}.dialogue-container{position:fixed;bottom:30px;width:50%;background:transparent;padding:25px;left:50%;transform:translate(-50%)}.dialogue-text{background:#000000d9;padding:20px;border-radius:4px;margin:15px 0;line-height:1.6;font-size:1.1em;border:1px solid rgba(255,255,255,.15);box-shadow:0 4px 16px #0000004d}.dialogue-options{display:flex;flex-direction:row;flex-wrap:wrap;gap:12px;justify-content:space-between;margin-top:20px;width:100%}.dialogue-button{background:#000000d9;border:1px solid rgba(255,255,255,.15);color:#fff;padding:12px 24px;border-radius:4px;cursor:pointer;transition:all .2s ease;font-size:.95em;flex:1;text-align:center;min-width:calc(33.333% - 8px);box-shadow:0 4px 16px #0003}.dialogue-button:hover{background:#3333338c;transform:translateY(-1px);box-shadow:0 6px 20px #0000004d;border:1px solid rgba(255,255,255,.3)}h2{color:#fff;margin:0;font-size:1.4em;font-weight:600;text-shadow:0 2px 4px rgba(0,0,0,.3)}p{color:#fff;margin:0;text-shadow:0 1px 2px rgba(0,0,0,.2)}*{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.hidden{display:none}*{overflow-y:hidden;overflow-x:hidden}
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
min-height: 100vh;
|
||||
background: transparent
|
||||
}
|
||||
|
||||
.dialogue-container {
|
||||
position: fixed;
|
||||
bottom: 30px;
|
||||
width: 50%;
|
||||
background: transparent;
|
||||
padding: 15px;
|
||||
left: 50%;
|
||||
transform: translate(-50%)
|
||||
}
|
||||
|
||||
.dialogue-text {
|
||||
background: #242424;
|
||||
padding: 10px;
|
||||
border-radius: 4px;
|
||||
margin: 10px 0;
|
||||
line-height: 1.6;
|
||||
font-size: 1.1em;
|
||||
border: 0.5px dotted rgba(203, 203, 203, 0.5);
|
||||
box-shadow: 0 4px 16px #0000007e;
|
||||
|
||||
}
|
||||
|
||||
.dialogue-options {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
justify-content: space-between;
|
||||
margin-top: 20px;
|
||||
width: 100%
|
||||
}
|
||||
|
||||
.dialogue-button {
|
||||
background: #242424;
|
||||
border: 0.5px solid rgba(203, 203, 203, 0.5);
|
||||
color: #fff;
|
||||
padding: 12px 24px;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
transition: all .2s ease;
|
||||
font-size: .95em;
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
min-width: calc(33.333% - 8px);
|
||||
box-shadow: 0 4px 16px #0003
|
||||
}
|
||||
|
||||
.dialogue-button:hover {
|
||||
background: #3333338c;
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 4px 16px #0000007e;
|
||||
border: 1px solid rgba(255, 255, 255, .3);
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #fff;
|
||||
margin: 0;
|
||||
font-size: 1.4em;
|
||||
font-weight: 600;
|
||||
text-shadow: 0 2px 4px rgba(0, 0, 0, .3)
|
||||
}
|
||||
|
||||
p {
|
||||
color: #fff;
|
||||
margin: 0;
|
||||
text-shadow: 0 1px 2px rgba(0, 0, 0, .2)
|
||||
}
|
||||
|
||||
* {
|
||||
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none
|
||||
}
|
||||
|
||||
* {
|
||||
overflow-y: hidden;
|
||||
overflow-x: hidden
|
||||
}
|
||||
Reference in new issue
Block a user