While the queue system comes with it's own basic Discord bot that will allow players to redeem and gift their packages, it is highly recommended to develop a system that will seamlessly integrate with your server to do this. The provided exports will allow you to do this.
hasPaymentBeenProcessed(transaction_id)
This function will just check the database to check if the queue has already processed the transaction, it's utility is to ensure that two players cannot claim the same transaction.
Basic Example:
RegisterCommand('check_transaction', function(source, args, rawCommand)
local txnId = args[1]
if not txnId then return end
local processed = exports['nyx_queue']:hasPaymentBeenProcessed(txnId)
if processed then
QBCore.Functions.Notify(source, 'This transaction has been processed', 'success')
else
QBCore.Functions.Notify(source, 'This transaction has not been processed', 'error')
end
end, false)
addPriorityPoints(amount, discord_id)
This function will add priority points to the discord id provided, for example if you want an admin to be able to add priority points for good roleplay.
Basic Example:
RegisterCommand('add_priority', function(source, args, rawCommand)
local ply = args[1]
if not ply then return end
local amount = tonumber(args[2])
if not amount then return end
local discord = GetPlayerIdentifierByType(ply, 'discord')
discord = discord:gsub('discord:', '')
if not discord then return end
local points, message = exports['nyx_queue']:addPriorityPoints(amount, discord)
QBCore.Functions.Notify(source, 'Added '..amount..' points to '..ply..', they now have '..points..' points! Message: '..message, 'success)
end, true)
addQueueSlot(discord_id)
This function will add a reserved slot to the discord id provided, for example if you want an admin to be able to add a reserved slot for good roleplay.
Basic Example:
RegisterCommand('add_slot', function(source, args, rawCommand)
local ply = args[1]
if not ply then return end
local amount = tonumber(args[2])
if not amount then return end
local discord = GetPlayerIdentifierByType(ply, 'discord')
discord = discord:gsub('discord:', '')
if not discord then return end
local success, message = exports['nyx_queue']:addQueueSlot(discord)
if success then
QBCore.Functions.Notify(source, 'Reserved slot added, message: '..message, 'success')
else
QBCore.Functions.Notify(source, 'Failed to add reserved slot: '..message, 'error')
end
end, true)
CheckPayment(transaction_id, discord_id)
This function will grab the payment information from Tebex, compare it's packages to the config, and add the priority points or the slot associated with the payment. It will check if the payment has already been processed first, though. It will return a string, like:
Added 10 points. You now have 10 priority points. Added reserved slot.
Basic Example:
RegisterCommand('redeem', function(source, args, rawCommand)
local src = source
local discord = GetPlayerIdentifierByType(src, 'discord')
discord = discord:gsub('discord:', '')
if not discord then
return
end
if not args[1] then
return
end
local txnId = args[1]
local res = exports['nyx_queue']:CheckPayment(txnId, discord)
QBCore.Functions.Notify(src, res, 'success')
end)
While we do our best, we're probably not going to be able to help you setting up your own integration with our system. Please review the example provided in nyx_discord.