6 files changed
+65
-9
No files matched your search
@@ -124,6 +124,34 @@ Framework.GetPlayerJobData = function()
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--This is an internal function to get status data
|
||||||
|
--- @param search string
|
||||||
|
Framework.GetStatusData = function(search)
|
||||||
|
local playerData = Framework.GetPlayerData()
|
||||||
|
if not playerData then return 0 end
|
||||||
|
local status = playerData.variables.status
|
||||||
|
for _, entry in ipairs(status) do
|
||||||
|
if entry.name == search then
|
||||||
|
return entry.percent or 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
---This will get the hunger of a player
|
||||||
|
---@return number
|
||||||
|
Framework.GetHunger = function()
|
||||||
|
local status = Framework.GetStatusData("hunger")
|
||||||
|
return math.floor((status) + 0.5) or 0
|
||||||
|
end
|
||||||
|
|
||||||
|
---This will get the thirst of a player
|
||||||
|
---@return number
|
||||||
|
Framework.GetThirst = function()
|
||||||
|
local status = Framework.GetStatusData("thirst")
|
||||||
|
return math.floor((status) + 0.5) or 0
|
||||||
|
end
|
||||||
|
|
||||||
--- @description This will return if the player has the specified item in their inventory
|
--- @description This will return if the player has the specified item in their inventory
|
||||||
--- @param item string
|
--- @param item string
|
||||||
--- @return boolean
|
--- @return boolean
|
||||||
|
|||||||
@@ -253,11 +253,11 @@ end
|
|||||||
--- @return number | nil
|
--- @return number | nil
|
||||||
Framework.GetHunger = function(src)
|
Framework.GetHunger = function(src)
|
||||||
local status = Framework.GetStatus(src, "status")
|
local status = Framework.GetStatus(src, "status")
|
||||||
if not status then return nil end
|
if not status then return end
|
||||||
|
if type(status) ~= "table" then return end
|
||||||
for _, entry in ipairs(status) do
|
for _, entry in ipairs(status) do
|
||||||
if entry.name == "hunger" then
|
if entry.name == "hunger" then
|
||||||
return math.floor(entry.percent)
|
return math.floor((entry.percent) + 0.5) or 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -268,10 +268,10 @@ end
|
|||||||
Framework.GetThirst = function(src)
|
Framework.GetThirst = function(src)
|
||||||
local status = Framework.GetStatus(src, "status")
|
local status = Framework.GetStatus(src, "status")
|
||||||
if not status then return nil end
|
if not status then return nil end
|
||||||
|
if type(status) ~= "table" then return end
|
||||||
for _, entry in ipairs(status) do
|
for _, entry in ipairs(status) do
|
||||||
if entry.name == "thirst" then
|
if entry.name == "thirst" then
|
||||||
return math.floor(entry.percent)
|
return math.floor((entry.percent) + 0.5) or 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -109,6 +109,20 @@ Framework.GetItemInfo = function(item)
|
|||||||
return repackedTable
|
return repackedTable
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---This will get the hunger of a player
|
||||||
|
---@return number
|
||||||
|
Framework.GetHunger = function()
|
||||||
|
local hunger = Framework.GetPlayerMetaData("hunger") or 0
|
||||||
|
return math.floor((hunger) + 0.5) or 0
|
||||||
|
end
|
||||||
|
|
||||||
|
---This will get the thirst of a player
|
||||||
|
---@return number
|
||||||
|
Framework.GetThirst = function()
|
||||||
|
local thirst = Framework.GetPlayerMetaData("thirst") or 0
|
||||||
|
return math.floor((thirst) + 0.5) or 0
|
||||||
|
end
|
||||||
|
|
||||||
---This will get the players identifier (citizenid) etc.
|
---This will get the players identifier (citizenid) etc.
|
||||||
---@return string
|
---@return string
|
||||||
Framework.GetPlayerIdentifier = function()
|
Framework.GetPlayerIdentifier = function()
|
||||||
|
|||||||
@@ -303,7 +303,7 @@ Framework.GetHunger = function(src)
|
|||||||
if not player then return end
|
if not player then return end
|
||||||
local playerData = player.PlayerData
|
local playerData = player.PlayerData
|
||||||
local newHunger = (playerData.metadata.hunger or 0)
|
local newHunger = (playerData.metadata.hunger or 0)
|
||||||
return newHunger
|
return math.floor((newHunger) + 0.5) or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will return a boolean if the player is dead or in last stand.
|
---This will return a boolean if the player is dead or in last stand.
|
||||||
@@ -335,7 +335,7 @@ Framework.GetThirst = function(src)
|
|||||||
if not player then return end
|
if not player then return end
|
||||||
local playerData = player.PlayerData
|
local playerData = player.PlayerData
|
||||||
local newThirst = (playerData.metadata.thirst or 0)
|
local newThirst = (playerData.metadata.thirst or 0)
|
||||||
return newThirst
|
return math.floor((newThirst) + 0.5) or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Framework.GetPlayerPhone(src)
|
-- Framework.GetPlayerPhone(src)
|
||||||
|
|||||||
@@ -68,6 +68,20 @@ Framework.Notify = function(message, type, time)
|
|||||||
return QBox:Notify("Notification", type, time, message)
|
return QBox:Notify("Notification", type, time, message)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---This will get the hunger of a player
|
||||||
|
---@return number
|
||||||
|
Framework.GetHunger = function()
|
||||||
|
local hunger = Framework.GetPlayerMetaData("hunger") or 0
|
||||||
|
return math.floor((hunger) + 0.5) or 0
|
||||||
|
end
|
||||||
|
|
||||||
|
---This will get the thirst of a player
|
||||||
|
---@return number
|
||||||
|
Framework.GetThirst = function()
|
||||||
|
local thirst = Framework.GetPlayerMetaData("thirst") or 0
|
||||||
|
return math.floor((thirst) + 0.5) or 0
|
||||||
|
end
|
||||||
|
|
||||||
---This will get the players identifier (citizenid) etc.
|
---This will get the players identifier (citizenid) etc.
|
||||||
---@return string
|
---@return string
|
||||||
Framework.GetPlayerIdentifier = function()
|
Framework.GetPlayerIdentifier = function()
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ Framework.GetHunger = function(src)
|
|||||||
if not player then return end
|
if not player then return end
|
||||||
local playerData = player.PlayerData
|
local playerData = player.PlayerData
|
||||||
local newHunger = (playerData.metadata.hunger or 0)
|
local newHunger = (playerData.metadata.hunger or 0)
|
||||||
return newHunger
|
return math.floor((newHunger) + 0.5) or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will return a boolean if the player is dead or in last stand.
|
---This will return a boolean if the player is dead or in last stand.
|
||||||
@@ -265,7 +265,7 @@ Framework.GetThirst = function(src)
|
|||||||
if not player then return end
|
if not player then return end
|
||||||
local playerData = player.PlayerData
|
local playerData = player.PlayerData
|
||||||
local newThirst = (playerData.metadata.thirst or 0)
|
local newThirst = (playerData.metadata.thirst or 0)
|
||||||
return newThirst
|
return math.floor((newThirst) + 0.5) or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
---Returns the phone number of the player.
|
---Returns the phone number of the player.
|
||||||
|
|||||||
Reference in new issue
Block a user