Main/resources/[carscripts]/slashtires/bridge/framework/ox/server.lua
2025-06-07 08:51:21 +02:00

34 lines
1 KiB
Lua

if not lib then
error("ox_lib was not included or did not load before this file! Please make sure to add '@ox_lib/init.lua' before shared/bridge.lua inside the fxmanifest!")
end
---Logger function
---@param source string
---@param event string
---@param message string
---@param data table
function Log(source, event, message, data)
lib.logger(source, event, string.format("%s %s. data: %s", GetPlayerName(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 playerState = Player(source).state
if playerState.isDead then
return false, 'is_dead'
end
if playerState.isCuffed then
return false, 'is_handcuffed'
end
if playerState.invBusy or playerState.isEscorted then
return false, 'generic_fail_reason'
end
return true
end