fuck
This commit is contained in:
1 parent
1d0255185d
commit
99f82095d7
7 files changed
+109
-143
No files matched your search
@@ -13,7 +13,7 @@ end
|
||||
-- Framework.GetPlayerIdentifier(src)
|
||||
-- Returns the citizen ID of the player.
|
||||
Framework.GetPlayerIdentifier = function(src)
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
local playerData = player.PlayerData
|
||||
return playerData.citizenid
|
||||
@@ -44,7 +44,7 @@ end
|
||||
-- Returns the first and last name of the player.
|
||||
---@return string, string
|
||||
Framework.GetPlayerName = function(src)
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
local playerData = player.PlayerData
|
||||
return playerData.charinfo.firstname, playerData.charinfo.lastname
|
||||
@@ -53,7 +53,7 @@ end
|
||||
---This will get the players birth date
|
||||
---@return string
|
||||
Framework.GetPlayerDob = function(src)
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
local playerData = player.PlayerData
|
||||
return playerData.charinfo.birthdate
|
||||
@@ -63,7 +63,7 @@ end
|
||||
-- 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 player = QBCore.Functions.GetPlayer(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
local playerData = player.PlayerData
|
||||
local playerInventory = playerData.items
|
||||
@@ -106,7 +106,7 @@ end
|
||||
---@param metadata table
|
||||
---@return number
|
||||
Framework.GetItemCount = function(src, item, metadata)
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
local playerData = player.PlayerData
|
||||
local playerInventory = playerData.items
|
||||
@@ -132,7 +132,7 @@ 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 player = QBCore.Functions.GetPlayer(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
local playerData = player.PlayerData
|
||||
local playerInventory = playerData.items
|
||||
@@ -160,7 +160,7 @@ Framework.GetPlayers = function()
|
||||
end
|
||||
|
||||
Framework.GetItemBySlot = function(src, slot)
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
local playerData = player.PlayerData
|
||||
local playerInventory = playerData.items
|
||||
@@ -186,7 +186,7 @@ end
|
||||
-- Adds the specified metadata key and number value to the player's data.
|
||||
---@return boolean | nil
|
||||
Framework.SetPlayerMetadata = function(src, metadata, value)
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
player.Functions.SetMetaData(metadata, value)
|
||||
return true
|
||||
@@ -195,7 +195,7 @@ end
|
||||
-- Framework.GetMetadata(src, metadata)
|
||||
-- Gets the specified metadata key to the player's data.
|
||||
Framework.GetPlayerMetadata = function(src, metadata)
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
local playerData = player.PlayerData
|
||||
return playerData.metadata[metadata] or false
|
||||
@@ -205,7 +205,7 @@ end
|
||||
-- Adds the specified value to the player's stress level and updates the client HUD.
|
||||
---@return number | nil
|
||||
Framework.AddStress = function(src, value)
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
local playerData = player.PlayerData
|
||||
local newStress = playerData.metadata.stress + value
|
||||
@@ -218,7 +218,7 @@ end
|
||||
-- Removes the specified value from the player's stress level and updates the client HUD.
|
||||
---@return number | nil
|
||||
Framework.RemoveStress = function(src, value)
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
local playerData = player.PlayerData
|
||||
local newStress = (playerData.metadata.stress or 0) - value
|
||||
@@ -231,7 +231,7 @@ end
|
||||
-- Adds the specified value from the player's hunger level.
|
||||
---@return number | nil
|
||||
Framework.AddHunger = function(src, value)
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
local playerData = player.PlayerData
|
||||
local newHunger = (playerData.metadata.hunger or 0) + value
|
||||
@@ -246,7 +246,7 @@ end
|
||||
-- Adds the specified value from the player's thirst level.
|
||||
---@return number | nil
|
||||
Framework.AddThirst = function(src, value)
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
local playerData = player.PlayerData
|
||||
local newThirst = (playerData.metadata.thirst or 0) + value
|
||||
@@ -260,7 +260,7 @@ end
|
||||
---@param src any
|
||||
---@return number | nil
|
||||
Framework.GetHunger = function(src)
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
local playerData = player.PlayerData
|
||||
local newHunger = (playerData.metadata.hunger or 0)
|
||||
@@ -268,7 +268,7 @@ Framework.GetHunger = function(src)
|
||||
end
|
||||
|
||||
Framework.GetIsPlayerDead = function(src)
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
local playerData = player.PlayerData
|
||||
return playerData.metadata.isdead or playerData.metadata.inlaststand or false
|
||||
@@ -286,7 +286,7 @@ end
|
||||
---@param src any
|
||||
---@return number | nil
|
||||
Framework.GetThirst = function(src)
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
local playerData = player.PlayerData
|
||||
local newThirst = (playerData.metadata.thirst or 0)
|
||||
@@ -296,7 +296,7 @@ end
|
||||
-- Framework.GetPlayerPhone(src)
|
||||
-- Returns the phone number of the player.
|
||||
Framework.GetPlayerPhone = function(src)
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
local playerData = player.PlayerData
|
||||
return playerData.charinfo.phone
|
||||
@@ -305,7 +305,7 @@ end
|
||||
-- Framework.GetPlayerGang(src)
|
||||
-- Returns the gang name of the player.
|
||||
Framework.GetPlayerGang = function(src)
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
local playerData = player.PlayerData
|
||||
return playerData.gang.name
|
||||
@@ -318,7 +318,7 @@ Framework.GetPlayersByJob = function(job)
|
||||
local playerList = {}
|
||||
local players = QBCore.Functions.GetPlayers()
|
||||
for _, src in pairs(players) do
|
||||
local player = QBCore.Functions.GetPlayer(src).PlayerData
|
||||
local player = Framework.GetPlayer(src).PlayerData
|
||||
if player.job.name == job then
|
||||
table.insert(playerList, src)
|
||||
end
|
||||
@@ -333,7 +333,7 @@ end
|
||||
---@return string
|
||||
---@return string
|
||||
Framework.GetPlayerJob = function(src)
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
local playerData = player.PlayerData
|
||||
return playerData.job.name, playerData.job.label, playerData.job.grade.name, playerData.job.grade.level
|
||||
@@ -343,7 +343,7 @@ end
|
||||
---@param src number
|
||||
---@return boolean | nil
|
||||
Framework.GetPlayerDuty = function(src)
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
local playerData = player.PlayerData
|
||||
if not playerData.job.onduty then return false end
|
||||
@@ -355,7 +355,7 @@ end
|
||||
---@param status boolean
|
||||
---@return nil
|
||||
Framework.SetPlayerDuty = function(src, status)
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
player.Functions.SetJobDuty(status)
|
||||
TriggerEvent('QBCore:Server:SetDuty', src, player.PlayerData.job.onduty)
|
||||
@@ -367,7 +367,7 @@ end
|
||||
---@param grade string
|
||||
---@return nil
|
||||
Framework.SetPlayerJob = function(src, name, grade)
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
return player.Functions.SetJob(name, grade)
|
||||
end
|
||||
@@ -378,7 +378,7 @@ end
|
||||
---@param amount number
|
||||
---@return boolean | nil
|
||||
Framework.AddAccountBalance = function(src, _type, amount)
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
if _type == 'money' then _type = 'cash' end
|
||||
return player.Functions.AddMoney(_type, amount)
|
||||
@@ -390,7 +390,7 @@ end
|
||||
---@param amount number
|
||||
---@return boolean | nil
|
||||
Framework.RemoveAccountBalance = function(src, _type, amount)
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
if _type == 'money' then _type = 'cash' end
|
||||
return player.Functions.RemoveMoney(_type, amount)
|
||||
@@ -401,7 +401,7 @@ end
|
||||
---@param _type string
|
||||
---@return string | nil
|
||||
Framework.GetAccountBalance = function(src, _type)
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
local playerData = player.PlayerData
|
||||
if _type == 'money' then _type = 'cash' end
|
||||
@@ -411,7 +411,7 @@ end
|
||||
-- Framework.AddItem(src, item, amount, slot, metadata)
|
||||
-- Adds the specified item to the player's inventory.
|
||||
Framework.AddItem = function(src, item, amount, slot, metadata)
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src,
|
||||
{ action = "add", item = item, count = amount, slot = slot, metadata = metadata })
|
||||
@@ -421,7 +421,7 @@ end
|
||||
-- Framework.RemoveItem(src, item, amount, slot, metadata)
|
||||
-- Removes the specified item from the player's inventory.
|
||||
Framework.RemoveItem = function(src, item, amount, slot, metadata)
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src,
|
||||
{ action = "remove", item = item, count = amount, slot = slot, metadata = metadata })
|
||||
@@ -432,7 +432,7 @@ end
|
||||
-- Sets the metadata for the specified item in the player's inventory.
|
||||
-- Notes, this is kinda a jank workaround. with the framework aside from updating the entire table theres not really a better way
|
||||
Framework.SetMetadata = function(src, item, slot, metadata)
|
||||
local player = QBCore.Functions.GetPlayer(src)
|
||||
local player = Framework.GetPlayer(src)
|
||||
if not player then return end
|
||||
local slotFinder = Framework.GetPlayerInventory(src)
|
||||
local freeSlot = Table.FindFirstUnoccupiedSlot(slotFinder)
|
||||
|
||||
Reference in new issue
Block a user