Config Server

ESX, QBCore = nil, nil

if Config.Framework == 'ESX' then
    TriggerEvent(Config.GetSharedObjects, function(obj) ESX = obj end)
    
elseif Config.Framework == 'QBCORE' then
    TriggerEvent(Config.GetSharedObjects, function(obj) QBCore = obj end)
    if QBCore == nil then
        QBCore = exports[Config.ResourceName]:GetCoreObject()
    end
    
elseif Config.Framework == 'OTHER' then
    -- // if you want to use other framework, place here the code! 
end


RegisterNetEvent('revel_radar:payment')
AddEventHandler('revel_radar:payment', function(amount)
   if Config.Framework == 'ESX' then 
      local xPlayer = ESX.GetPlayerFromId(source)
      local name = GetPlayerName(source)
      local identifier = GetPlayerIdentifiers(source)
      if xPlayer then
          xPlayer.removeAccountMoney('bank', amount)
          print(xPlayer.getAccount('bank').money)
      end

  elseif Config.Framework == 'QBCORE' then
      local xPlayer = QBCore.Functions.GetPlayer(source)
      if xPlayer then
          xPlayer.Functions.RemoveMoney('bank', amount, 'Radar Fine')
      end

  elseif Config.Framework == 'OTHER' then
      -- // if you want to use other framework, place here the code! 
  end
end)

Last updated