qbx_core

if not GetResourceState('qbx_core') == 'started' then return end

Billing = {
  ---@param author_stateid string
  ---@param target_stateid string
  ---@param amount number
  ---@return boolean
  penalize = function(author_stateid, target_stateid, amount)
    local authorIdentifier = exports.drx_mdt:GetIdentifierByStateId(author_stateid)
    local targetIdentifier = exports.drx_mdt:GetIdentifierByStateId(target_stateid)

    if not authorIdentifier or not targetIdentifier then
      prints.error("Failed to retrieve identifier for penalization")
      return false
    end

    local playerSource = exports.qbx_core:GetSource(targetIdentifier)
    if not playerSource then
      prints.error("Player source not found for identifier: %s", targetIdentifier)
      return false
    end

    local player = exports.qbx_core:GetPlayer(playerSource)
    if player then
      -- player.Functions.RemoveMoney("bank", amount) -- Example: Remove money from player's bank account
      print("Player fined successfully:", playerSource, amount)
      return true
    else
      prints.error("Failed to find player entity for source: %s", playerSource)
      return false
    end
  end
}

Last updated

Was this helpful?