forked from Simnation/Main
25 lines
751 B
Lua
25 lines
751 B
Lua
---Logger function
|
|
---@param source string
|
|
---@param event string
|
|
---@param message string
|
|
---@param data table
|
|
function Log(source, event, message, data)
|
|
print(source, event, string.format("[Slashtire] %s (%s) %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)
|
|
if GetEntityHealth(playerPed) == 0 then
|
|
return false, 'is_dead'
|
|
end
|
|
|
|
if IsPedHandcuffed(playerPed) then
|
|
return false, 'is_handcuffed'
|
|
end
|
|
|
|
return true
|
|
end
|