forked from Simnation/Main
32 lines
997 B
Lua
32 lines
997 B
Lua
if not QBCore then
|
|
QBCore = exports['qb-core']:GetCoreObject()
|
|
end
|
|
|
|
---Logger function
|
|
---@param source string
|
|
---@param event string
|
|
---@param message string
|
|
---@param data table
|
|
function Log(source, event, message, data)
|
|
TriggerEvent('qb-log:server:CreateLog', 'default', "Slashtire", 'default', string.format("%s (%s) %s. data: %s", GetPlayerName(source), source, message, json.encode(data, {indent = true})))
|
|
end
|
|
|
|
---Checks if the player can slash tires
|
|
---@param source string
|
|
---@param playerPed integer
|
|
---@return boolean canPlayerSlash
|
|
---@return string|nil reason nil if canPlayerSlash is true
|
|
function CanPlayerSlashTires(source, playerPed)
|
|
local QBPlayer = QBCore.Functions.GetPlayer(source)
|
|
local metadata = QBPlayer?.PlayerData?.metadata
|
|
|
|
if metadata?.isdead or metadata?.inlaststand then
|
|
return false, 'is_dead'
|
|
end
|
|
|
|
if metadata?.ishandcuffed then
|
|
return false, 'is_handcuffed'
|
|
end
|
|
|
|
return true
|
|
end
|