mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-08-29 01:01:24 +00:00
Merge branch 'main' into patch-2
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
|
||||
#
|
||||
# You can adjust the behavior by modifying this file.
|
||||
# For more information, see:
|
||||
# https://github.com/actions/stale
|
||||
name: Mark stale issues and pull requests
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '41 15 * * *'
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
|
||||
steps:
|
||||
- uses: actions/stale@v5
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: 'This issue has had 60 days of inactivity & will close within 7 days'
|
||||
stale-pr-message: 'This PR has had 60 days of inactivity & will close within 7 days'
|
||||
close-issue-label: 'Stale Closed'
|
||||
close-pr-label: 'Stale Closed'
|
||||
exempt-issue-labels: 'Suggestion'
|
||||
exempt-pr-labels: 'Suggestion'
|
||||
@@ -23,9 +23,9 @@ function QBCore.Functions.DrawText(x, y, width, height, scale, r, g, b, a, text)
|
||||
SetTextFont(4)
|
||||
SetTextScale(scale, scale)
|
||||
SetTextColour(r, g, b, a)
|
||||
SetTextEntry('STRING')
|
||||
AddTextComponentString(text)
|
||||
DrawText(x - width / 2, y - height / 2 + 0.005)
|
||||
BeginTextCommandDisplayText('STRING')
|
||||
AddTextComponentSubstringPlayerName(text)
|
||||
EndTextCommandDisplayText(x - width / 2, y - height / 2 + 0.005)
|
||||
end
|
||||
|
||||
function QBCore.Functions.DrawText3D(x, y, z, text)
|
||||
@@ -34,11 +34,11 @@ function QBCore.Functions.DrawText3D(x, y, z, text)
|
||||
SetTextFont(4)
|
||||
SetTextProportional(1)
|
||||
SetTextColour(255, 255, 255, 215)
|
||||
SetTextEntry('STRING')
|
||||
BeginTextCommandDisplayText('STRING')
|
||||
SetTextCentre(true)
|
||||
AddTextComponentString(text)
|
||||
AddTextComponentSubstringPlayerName(text)
|
||||
SetDrawOrigin(x, y, z, 0)
|
||||
DrawText(0.0, 0.0)
|
||||
EndTextCommandDisplayText(0.0, 0.0)
|
||||
local factor = (string.len(text)) / 370
|
||||
DrawRect(0.0, 0.0 + 0.0125, 0.017 + factor, 0.03, 0, 0, 0, 75)
|
||||
ClearDrawOrigin()
|
||||
|
||||
@@ -76,6 +76,13 @@ function QBCore.Functions.GetOfflinePlayerByCitizenId(citizenid)
|
||||
return QBCore.Player.GetOfflinePlayer(citizenid)
|
||||
end
|
||||
|
||||
---Get player by license
|
||||
---@param license string
|
||||
---@return table?
|
||||
function QBCore.Functions.GetPlayerByLicense(license)
|
||||
return QBCore.Player.GetPlayerByLicense(license)
|
||||
end
|
||||
|
||||
---Get player by phone number
|
||||
---@param number number
|
||||
---@return table?
|
||||
|
||||
+30
-1
@@ -43,7 +43,28 @@ end
|
||||
|
||||
function QBCore.Player.GetOfflinePlayer(citizenid)
|
||||
if citizenid then
|
||||
local PlayerData = MySQL.Sync.prepare('SELECT * FROM players where citizenid = ?', {citizenid})
|
||||
local PlayerData = MySQL.prepare.await('SELECT * FROM players where citizenid = ?', {citizenid})
|
||||
if PlayerData then
|
||||
PlayerData.money = json.decode(PlayerData.money)
|
||||
PlayerData.job = json.decode(PlayerData.job)
|
||||
PlayerData.position = json.decode(PlayerData.position)
|
||||
PlayerData.metadata = json.decode(PlayerData.metadata)
|
||||
PlayerData.charinfo = json.decode(PlayerData.charinfo)
|
||||
if PlayerData.gang then
|
||||
PlayerData.gang = json.decode(PlayerData.gang)
|
||||
else
|
||||
PlayerData.gang = {}
|
||||
end
|
||||
|
||||
return QBCore.Player.CheckPlayerData(nil, PlayerData)
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
function QBCore.Player.GetPlayerByLicense(license)
|
||||
if license then
|
||||
local PlayerData = MySQL.prepare.await('SELECT * FROM players where license = ?', {license})
|
||||
if PlayerData then
|
||||
PlayerData.money = json.decode(PlayerData.money)
|
||||
PlayerData.job = json.decode(PlayerData.job)
|
||||
@@ -254,6 +275,14 @@ function QBCore.Player.CreatePlayer(PlayerData, Offline)
|
||||
return true
|
||||
end
|
||||
|
||||
function self.Functions.Notify(text, type, lenght)
|
||||
TriggerClientEvent('QBCore:Notify', self.PlayerData.source, text, type, lenght)
|
||||
end
|
||||
|
||||
function self.Functions.HasItem(items, amount)
|
||||
QBCore.Functions.HasItem(self.PlayerData.source, items, amount)
|
||||
end
|
||||
|
||||
function self.Functions.SetJobDuty(onDuty)
|
||||
self.PlayerData.job.onduty = not not onDuty -- Make sure the value is a boolean if nil is sent
|
||||
TriggerEvent('QBCore:Server:OnJobUpdate', self.PlayerData.source, self.PlayerData.job)
|
||||
|
||||
Reference in New Issue
Block a user