ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
if not IsDuplicityVersion() then
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if NetworkIsSessionStarted() then
TriggerServerEvent("Queue:playerActivated")
return
end
end
end)
return
end
local Queue = {}
Queue.MaxPlayers = GetConvarInt("sv_maxclients")
Queue.Debug = GetConvar("sv_debugqueue", "true") == "true" and true or false
Queue.DisplayQueue = GetConvar("sv_displayqueue", "true") == "true" and true or
false
Queue.InitHostName = GetConvar("sv_hostname")
-- This is needed because msgpack will break when tables are too large
local _Queue = {}
_Queue.QueueList = {}
_Queue.PlayerList = {}
_Queue.PlayerCount = 0
_Queue.Priority = {}
_Queue.Connecting = {}
_Queue.JoinCbs = {}
_Queue.TempPriority = {}
_Queue.JoinDelay = GetGameTimer() + 2500
local tostring = tostring
local tonumber = tonumber
local ipairs = ipairs
local pairs = pairs
local print = print
local string_len = string.len
local string_sub = string.sub
local string_format = string.format
local string_lower = string.lower
local math_abs = math.abs
local math_floor = math.floor
local math_random = math.random
local os_time = os.time
local table_insert = table.insert
local table_remove = table.remove
Queue.InitHostName = Queue.InitHostName ~= "default FXServer" and
Queue.InitHostName or false
local SqlPriorities = {}
for id, power in pairs(Config.Priority) do
_Queue.Priority[string_lower(id)] = power
end
MySQL.ready(function ()
MySQL.Async.fetchAll("SELECT * FROM hacker_priority",{}, function(data)
if data ~= nil then
for k,v in pairs(data) do
_Queue.Priority[string_lower(v.SteamID)] = v.Power
end
Wait(400)
debug('Priority List Loaded')
end
end)
end)
local name = nil
RegisterServerEvent('hacker_queue:GetOfflineInfo')
AddEventHandler('hacker_queue:GetOfflineInfo', function(id)
local _source = source
name = id
end)
ESX.RegisterServerCallback('hacker_queue:GetPriorities', function(source, cb)
local data = MySQL.Sync.fetchAll("SELECT * FROM `users` WHERE
LOWER(users.`name`) LIKE @name",{['@name'] =
"%"..string.lower(tostring(name)).."%"})
cb(data)
name = nil
end)
RegisterServerEvent('hacker_queue:addpriority')
AddEventHandler('hacker_queue:addpriority', function(steam,days,power)
local _source = source
local identifier = GetPlayerIdentifier(_source)
local expiration = days * 86400
if expiration < os.time() then
expiration = os.time()+expiration
end
local base = MySQL.Sync.fetchAll("SELECT name FROM `users` WHERE identifier
= @identifier",{['@identifier'] = steam})
local data = MySQL.Sync.fetchAll("SELECT * FROM `hacker_priority` WHERE
SteamID = @SteamID ",{['@SteamID'] = steam})
local name
if #base > 0 then
name = base[1].name
end
if #data < 1 then
MySQL.Async.execute('INSERT INTO hacker_priority (SteamID, Power,
Adder, Expire, SteamName) VALUES (@SteamID, @Power, @Adder, @Expire, @SteamName)',
{
['@SteamID'] = steam,
['@Power'] = tonumber(power),
['@Adder'] = identifier,
['@Expire'] = expiration,
['@SteamName'] = name,
}, function (change)
if change > 0 then
sendToDiscord('Add Priority', '**Staff Name:**\
n```'..GetPlayerName(_source)..'[SteamID:'..identifier..']```\n**Add Priority to
Player:**\n```'..name..'[SteamID:'..steam..']```\n**Days:**\n```'..days..'```\
n**Power:**\n```'..power..'```', math.random(1000,5000))
end
end)
_Queue.Priority[string_lower(steam)] = tonumber(power)
TriggerClientEvent('esx:showNotification', _source, '~bold~~r~Priority
~r~Succeffully to added!\n~y~PlayerName: ~w~'..name)
else
MySQL.Async.execute('UPDATE hacker_priority SET Power = @Power, Expire
= @Expire, SteamName = @SteamName, Adder = @Adder WHERE SteamID = @SteamID',
{
['@Adder'] = identifier,
['@SteamName'] = name,
['@SteamID'] = steam,
['@Power'] = power,
['@Expire'] = expiration
}, function(change)
if change > 0 then
sendToDiscord('Update Priority', '**Staff Name:**\
n```'..GetPlayerName(_source)..'[SteamID:'..identifier..']```\n**Update Priority to
Player:**\n```'..name..'[SteamID:'..steam..']```\n**Days:**\n```'..days..'```\
n**Power:**\n```'..power..'```', math.random(1000,5000))
end
end)
_Queue.Priority[string_lower(steam)] = tonumber(power)
TriggerClientEvent('esx:showNotification', _source, '~bold~~r~Priority
~r~Succeffully Updated!\n~y~PlayerName: ~w~'..name)
end
end)
RegisterServerEvent('hacker_queue:removepriority')
AddEventHandler('hacker_queue:removepriority', function(steam)
local _source = source
MySQL.Async.fetchAll("SELECT * FROM hacker_priority WHERE SteamID =
@SteamID",{['@SteamID'] = steam}, function(data)
sendToDiscord('Remove Priority', '**Staff Name:**\
n```'..GetPlayerName(_source)..'[SteamID:'..GetPlayerIdentifier(_source)..']```\
n**Remove Priority to Player:**\
n```'..data[1].SteamName..'[SteamID:'..steam..']```', math.random(1000,5000))
end)
MySQL.Async.execute('DELETE FROM hacker_priority WHERE SteamID = @SteamID',
{
['@SteamID'] = steam
},function(change)
if change > 0 then
Queue.RemovePriority(string_lower(steam))
end
end)
end)
function Queue:HexIdToSteamId(hexId)
local cid = math_floor(tonumber(string_sub(hexId, 7), 16))
local steam64 = math_floor(tonumber(string_sub( cid, 2)))
local a = steam64 % 2 == 0 and 0 or 1
local b = math_floor(math_abs(6561197960265728 - steam64 - a) / 2)
local sid = "steam_0:"..a..":"..(a == 1 and b -1 or b)
return sid
end
function Queue:IsSteamRunning(src)
for _, id in ipairs(GetPlayerIdentifiers(src)) do
if string_sub(id, 1, 5) == "steam" then
return true
end
end
return false
end
function Queue:GetPlayerCount()
return _Queue.PlayerCount
end
function Queue:GetSize()
return #_Queue.QueueList
end
function Queue:ConnectingSize()
return #_Queue.Connecting
end
function Queue:GetQueueList()
return _Queue.QueueList
end
function Queue:GetPriorityList()
return _Queue.Priority
end
function Queue:GetPlayerList()
return _Queue.PlayerList
end
function Queue:GetTempPriorityList()
return _Queue.TempPriority
end
function Queue:GetConnectingList()
return _Queue.Connecting
end
function Queue:IsInQueue(ids, rtnTbl, bySource, connecting)
local connList = Queue:GetConnectingList()
local queueList = Queue:GetQueueList()
for genericKey1, genericValue1 in ipairs(connecting and connList or queueList)
do
local inQueue = false
if not bySource then
for genericKey2, genericValue2 in ipairs(genericValue1.ids) do
if inQueue then break end
for genericKey3, genericValue3 in ipairs(ids) do
if genericValue3 == genericValue2 then inQueue = true break end
end
end
else
inQueue = ids == genericValue1.source
end
if inQueue then
if rtnTbl then
return genericKey1, connecting and connList[genericKey1] or
queueList[genericKey1]
end
return true
end
end
return false
end
function Queue:IsPriority(ids)
local prio = false
local tempPower, tempEnd = Queue:HasTempPriority(ids)
local prioList = Queue:GetPriorityList()
for _, id in ipairs(ids) do
id = string_lower(id)
if prioList[id] then prio = prioList[id] break end
if string_sub(id, 1, 5) == "steam" then
local steamid = Queue:HexIdToSteamId(id)
if prioList[steamid] then prio = prioList[steamid] break end
end
end
if tempPower or prio then
if tempPower and prio then
return tempPower > prio and tempPower or prio
else
return tempPower or prio
end
end
return false
end
function Queue:HasTempPriority(ids)
local tmpPrio = Queue:GetTempPriorityList()
for _, id in pairs(ids) do
id = string_lower(id)
if tmpPrio[id] then return tmpPrio[id].power, tmpPrio[id].endTime, id end
if string_sub(id, 1, 5) == "steam" then
local steamid = Queue:HexIdToSteamId(id)
if tmpPrio[steamid] then return tmpPrio[steamid].power,
tmpPrio[steamid].endTime, id end
end
end
return false
end
function Queue:AddToQueue(ids, connectTime, name, src, deferrals)
if Queue:IsInQueue(ids) then return end
local tmp = {
source = src,
ids = ids,
name = name,
priority = Queue:IsPriority(ids) or (src == "debug" and math_random(0,
15)),
timeout = 0,
deferrals = deferrals,
firstconnect = connectTime,
queuetime = function() return (os_time() - connectTime) end
}
local _pos = false
local queueCount = Queue:GetSize() + 1
local queueList = Queue:GetQueueList()
for pos, data in ipairs(queueList) do
if tmp.priority then
if not data.priority then
_pos = pos
else
if tmp.priority > data.priority then
_pos = pos
end
end
if _pos then
break
end
end
end
if not _pos then
_pos = Queue:GetSize() + 1
end
table_insert(queueList, _pos, tmp)
end
function Queue:RemoveFromQueue(ids, bySource, byIndex)
local queueList = Queue:GetQueueList()
if byIndex then
if queueList[byIndex] then
table_remove(queueList, byIndex)
end
return
end
if Queue:IsInQueue(ids, false, bySource) then
local pos, data = Queue:IsInQueue(ids, true, bySource)
table_remove(queueList, pos)
end
end
function Queue:TempSize()
local count = 0
for _pos, data in pairs(Queue:GetQueueList()) do
if Queue:HasTempPriority(data.ids) then count = count +1 end
end
return count > 0 and count or false
end
function Queue:IsInConnecting(ids, bySource, refresh)
local inConnecting, tbl = Queue:IsInQueue(ids, refresh and true or false,
bySource and true or false, true)
if not inConnecting then return false end
if refresh and inConnecting and tbl then
Queue:GetConnectingList()[inConnecting].timeout = 0
end
return true
end
function Queue:RemoveFromConnecting(ids, bySource, byIndex)
local connList = Queue:GetConnectingList()
if byIndex then
if connList[byIndex] then
table_remove(connList, byIndex)
end
return
end
for genericKey1, genericValue1 in ipairs(connList) do
local inConnecting = false
if not bySource then
for genericKey2, genericValue2 in ipairs(genericValue1.ids) do
if inConnecting then break end
for genericKey3, genericValue3 in ipairs(ids) do
if genericValue3 == genericValue2 then inConnecting = true
break end
end
end
else
inConnecting = ids == genericValue1.source
end
if inConnecting then
table_remove(connList, genericKey1)
return true
end
end
return false
end
function Queue:AddToConnecting(ids, ignorePos, autoRemove, done)
local function remove()
if not autoRemove then return end
done(Config.Connect.connecterror)
Queue:RemoveFromConnecting(ids)
Queue:RemoveFromQueue(ids)
end
local connList = Queue:GetConnectingList()
if Queue:ConnectingSize() + Queue:GetPlayerCount() + 1 > Queue.MaxPlayers then
remove() return false end
if ids[1] == "debug" then
table_insert(connList, {source = ids[1], ids = ids, name = ids[1],
firstconnect = ids[1], priority = ids[1], timeout = 0})
return true
end
if Queue:IsInConnecting(ids) then Queue:RemoveFromConnecting(ids) end
local pos, data = Queue:IsInQueue(ids, true)
if not ignorePos and (not pos or pos > 1) then remove() return false end
table_insert(connList, data)
Queue:RemoveFromQueue(ids)
return true
end
function Queue:GetIds(src)
local ids = GetPlayerIdentifiers(src)
local ip = GetPlayerEndpoint(src)
ids = (ids and ids[1]) and ids or (ip and {"ip:" .. ip} or false)
ids = ids ~= nil and ids or false
if ids and #ids > 1 then
for k, id in ipairs(ids) do
if string_sub(id, 1, 3) == "ip:" and not Queue:IsPriority({id}) then
table_remove(ids, k) end
end
end
return ids
end
function Queue:AddPriority(id, power, temp)
if not id then return false end
if type(id) == "table" then
for _id, power in pairs(id) do
if _id and type(_id) == "string" and power and type(power) == "number"
then
Queue:GetPriorityList()[_id] = power
else
return false
end
end
return true
end
power = (power and type(power) == "number") and power or 10
if temp then
local tempPower, tempEnd, tempId = Queue:HasTempPriority({id})
id = tempId or id
Queue:GetTempPriorityList()[string_lower(id)] = {power = power, endTime =
os_time() + temp}
else
Queue:GetPriorityList()[string_lower(id)] = power
end
return true
end
function Queue:RemovePriority(id)
if not id then return false end
id = string_lower(id)
Queue:GetPriorityList()[id] = nil
return true
end
function Queue:UpdatePosData(src, ids, deferrals)
local pos, data = Queue:IsInQueue(ids, true)
data.source = src
data.ids = ids
data.timeout = 0
data.firstconnect = os_time()
data.name = GetPlayerName(src)
data.deferrals = deferrals
end
function Queue:NotFull(firstJoin)
local canJoin = Queue:GetPlayerCount() + Queue:ConnectingSize() <
Queue.MaxPlayers
if firstJoin and canJoin then canJoin = Queue:GetSize() <= 1 end
return canJoin
end
function Queue:SetPos(ids, newPos)
if newPos <= 0 or newPos > Queue:GetSize() then return false end
local pos, data = Queue:IsInQueue(ids, true)
local queueList = Queue:GetQueueList()
table_remove(queueList, pos)
table_insert(queueList, newPos, data)
end
function Queue:CanJoin(src, cb)
local allow = true
for _, data in ipairs(_Queue.JoinCbs) do
local await = true
data.func(src, function(reason)
if reason and type(reason) == "string" then allow = false cb(reason)
end
await = false
end)
while await do Citizen.Wait(0) end
if not allow then return end
end
if allow then cb(false) end
end
function Queue:OnJoin(cb, resource)
if not cb then return end
local tmp = {resource = resource, func = cb}
table_insert(_Queue.JoinCbs, tmp)
end
exports("GetQueueExports", function()
return Queue
end)
local function playerConnect(name, setKickReason, deferrals)
local src = source
local ids = Queue:GetIds(src)
local name = GetPlayerName(src)
local connectTime = os_time()
local connecting = true
deferrals.defer()
Citizen.CreateThread(function()
while connecting do
Citizen.Wait(100)
if not connecting then return end
deferrals.update(Config.Connect.connect)
end
end)
if Config.ConnectLog then
local prio = _Queue.Priority[ids[1]]
if prio == nil then
prio = 0
end
debug('Player: '..GetPlayerName(source)..' Connect With Priority Power:
'..prio)
end
Citizen.Wait(500)
local function done(msg, _deferrals)
connecting = false
local deferrals = _deferrals or deferrals
if msg then deferrals.update(tostring(msg) or "") end
Citizen.Wait(500)
if not msg then
deferrals.done()
--[[ if Config.EnableGrace then Queue:AddPriority(ids[1],
Config.GracePower, Config.GraceTime) end ]]
else
deferrals.done(tostring(msg) or "") CancelEvent()
end
return
end
local function update(msg, _deferrals)
local deferrals = _deferrals or deferrals
connecting = false
deferrals.update(tostring(msg) or "")
end
if not ids then
-- prevent joining
done(Config.Connect.iderr)
CancelEvent()
return
end
if not Queue:IsSteamRunning(src) then
done(Config.Connect.steamerror)
CancelEvent()
return
end
local allow
Queue:CanJoin(src, function(reason)
if reason == nil or allow ~= nil then return end
if reason == false or #_Queue.JoinCbs <= 0 then allow = true return end
if reason then
-- prevent joining
allow = false
done(reason and tostring(reason) or "You were blocked from joining")
Queue:RemoveFromQueue(ids)
Queue:RemoveFromConnecting(ids)
CancelEvent()
return
end
allow = true
end)
while allow == nil do Citizen.Wait(0) end
if not allow then return end
if Config.Whitelist and not Queue:IsPriority(ids) then
done(Config.Connect.whiltelistonly) return end
local rejoined = false
if Queue:IsInConnecting(ids, false, true) then
Queue:RemoveFromConnecting(ids)
if Queue:NotFull() then
-- let them in the server
if not Queue:IsInQueue(ids) then
Queue:AddToQueue(ids, connectTime, name, src, deferrals)
end
local added = Queue:AddToConnecting(ids, true, true, done)
if not added then CancelEvent() return end
done()
return
else
rejoined = true
end
end
if Queue:IsInQueue(ids) then
rejoined = true
Queue:UpdatePosData(src, ids, deferrals)
else
Queue:AddToQueue(ids, connectTime, name, src, deferrals)
if rejoined then
Queue:SetPos(ids, 1)
rejoined = false
end
end
local pos, data = Queue:IsInQueue(ids, true)
if not pos or not data then
done(Config.Connect.error .. " [1]")
Queue:RemoveFromQueue(ids)
Queue:RemoveFromConnecting(ids)
CancelEvent()
return
end
if Queue:NotFull(true) and _Queue.JoinDelay <= GetGameTimer() then
-- let them in the server
local added = Queue:AddToConnecting(ids, true, true, done)
if not added then CancelEvent() return end
done()
return
end
update(string_format(Config.Connect.position .. ((Queue:TempSize() and false)
and " (" .. Queue:TempSize() .. " temp)" or "00:00:00"), pos, Queue:GetSize(), ""))
if rejoined then return end
while true do
Citizen.Wait(500)
local pos, data = Queue:IsInQueue(ids, true)
local function remove(msg)
if data then
if msg then
update(msg, data.deferrals)
end
Queue:RemoveFromQueue(data.source, true)
Queue:RemoveFromConnecting(data.source, true)
else
Queue:RemoveFromQueue(ids)
Queue:RemoveFromConnecting(ids)
end
end
if not data or not data.deferrals or not data.source or not pos then
remove("[Queue] Removed from queue, queue data invalid :(")
return
end
local endPoint = GetPlayerEndpoint(data.source)
if not endPoint then data.timeout = data.timeout + 0.5 else data.timeout =
0 end
if data.timeout >= 90 and os_time() - connectTime > 5 then
remove("[Queue] Removed due to timeout")
return
end
if pos <= 1 and Queue:NotFull() and _Queue.JoinDelay <= GetGameTimer() then
-- let them in the server
local added = Queue:AddToConnecting(ids)
update(Config.Connect.join, data.deferrals)
Citizen.Wait(500)
if not added then
done(Config.Connect.connecterror)
CancelEvent()
return
end
done(nil, data.deferrals)
--[[ if Config.EnableGrace then Queue:AddPriority(ids[1],
Config.GracePower, Config.GraceTime) end ]]
Queue:RemoveFromQueue(ids)
return
end
local seconds = data.queuetime()
local qTime = string_format("%02d", math_floor((seconds % 86400) /
3600)) .. ":" .. string_format("%02d", math_floor((seconds % 3600) / 60)) .. ":" ..
string_format("%02d", math_floor(seconds % 60))
local msg = string_format(Config.Connect.position .. ((Queue:TempSize() and
false) and " (" .. Queue:TempSize() .. " temp)" or ""), pos, Queue:GetSize(),
qTime)
update(msg, data.deferrals)
end
end
AddEventHandler("playerConnecting", playerConnect)
Citizen.CreateThread(function()
local function remove(data, pos, msg)
if data and data.source then
Queue:RemoveFromQueue(data.source, true)
Queue:RemoveFromConnecting(data.source, true)
elseif pos then
table_remove(Queue:GetQueueList(), pos)
end
end
while true do
Citizen.Wait(1000)
local i = 1
while i <= Queue:ConnectingSize() do
local data = Queue:GetConnectingList()[i]
local endPoint = GetPlayerEndpoint(data.source)
data.timeout = data.timeout + 1
if ((data.timeout >= 300 and not endPoint) or data.timeout >= 600) and
data.source ~= "debug" and os_time() - data.firstconnect > 5 then
remove(data)
else
i = i + 1
end
end
for id, data in pairs(Queue:GetTempPriorityList()) do
if os_time() >= data.endTime then
Queue:GetTempPriorityList()[id] = nil
end
end
Queue.MaxPlayers = GetConvarInt("sv_maxclients")
Queue.Debug = GetConvar("sv_debugqueue", "true") == "true" and true or
false
Queue.DisplayQueue = GetConvar("sv_displayqueue", "true") == "true" and
true or false
local qCount = Queue:GetSize()
if Queue.DisplayQueue then
if Queue.InitHostName then
SetConvar("sv_hostname", (qCount > 0 and "[" .. tostring(qCount) ..
"] " or "") .. Queue.InitHostName)
else
Queue.InitHostName = GetConvar("sv_hostname")
Queue.InitHostName = Queue.InitHostName ~= "default FXServer" and
Queue.InitHostName or false
end
end
end
end)
RegisterServerEvent("Queue:playerActivated")
AddEventHandler("Queue:playerActivated", function()
local src = source
local ids = Queue:GetIds(src)
if not Queue:GetPlayerList()[src] then
_Queue.PlayerCount = Queue:GetPlayerCount() + 1
Queue:GetPlayerList()[src] = true
Queue:RemoveFromQueue(ids)
Queue:RemoveFromConnecting(ids)
end
end)
AddEventHandler("playerDropped", function()
local src = source
local ids = Queue:GetIds(src)
if Queue:GetPlayerList()[src] then
_Queue.PlayerCount = Queue:GetPlayerCount() - 1
Queue:GetPlayerList()[src] = nil
Queue:RemoveFromQueue(ids)
Queue:RemoveFromConnecting(ids)
--[[ if Config.EnableGrace then Queue:AddPriority(ids[1],
Config.GracePower, Config.GraceTime) end ]]
end
end)
AddEventHandler("onResourceStop", function(resource)
if Queue.DisplayQueue and Queue.InitHostName and resource ==
GetCurrentResourceName() then SetConvar("sv_hostname", Queue.InitHostName) end
for k, data in ipairs(_Queue.JoinCbs) do
if data.resource == resource then
table_remove(_Queue.JoinCbs, k)
end
end
end)
if Config.DisableHardCap then
AddEventHandler("onResourceStarting", function(resource)
if resource == "hardcap" then CancelEvent() return end
end)
StopResource("hardcap")
end
local testAdds = 0
local commands = {}
commands.addq = function()
Queue:AddToQueue({"steam:00000000"..testAdds}, os_time(), "TestAdd: " ..
testAdds, "debug")
testAdds = testAdds + 1
end
commands.removeq = function(args)
args[1] = tonumber(args[1])
local name = Queue:GetQueueList()[args[1]] and Queue:GetQueueList()
[args[1]].name or nil
Queue:RemoveFromQueue(nil, nil, args[1])
end
commands.printq = function()
for pos, data in ipairs(Queue:GetQueueList()) do
end
end
commands.addc = function()
Queue:AddToConnecting({"debug"})
end
commands.removec = function(args)
args[1] = tonumber(args[1])
local name = Queue:GetConnectingList()[args[1]] and Queue:GetConnectingList()
[args[1]].name or nil
Queue:RemoveFromConnecting(nil, nil, args[1])
end
commands.printc = function()
for pos, data in ipairs(Queue:GetConnectingList()) do
end
end
commands.printl = function()
for k, joined in pairs(Queue:GetPlayerList()) do
end
end
commands.printp = function()
for id, power in pairs(Queue:GetPriorityList()) do
end
end
commands.printcount = function()
end
commands.printtp = function()
for k, data in pairs(Queue:GetTempPriorityList()) do
end
end
commands.removetp = function(args)
if not args[1] then return end
Queue:GetTempPriorityList()[args[1]] = nil
end
commands.setpos = function(args)
if not args[1] or not args[2] then return end
args[1], args[2] = tonumber(args[1]), tonumber(args[2])
local data = Queue:GetQueueList()[args[1]]
Queue:SetPos(data.ids, args[2])
end
commands.setdata = function(args)
if not args[1] or not args[2] or not args[3] then return end
args[1] = tonumber(args[1])
local num = tonumber(args[3])
local data = Queue:GetQueueList()[args[1]]
if args[2] == "queuetime" then
local time = data.queuetime()
local dif = time - num
data.firstconnect = data.firstconnect + dif
data.queuetime = function() return (os_time() - data.firstconnect) end
else
data[args[2]] = num and num or args[3]
end
end
commands.commands = function()
for cmd, func in pairs(commands) do
end
end
AddEventHandler("rconCommand", function(command, args)
if command == "queue" and commands[args[1]] then
command = args[1]
table_remove(args, 1)
commands[command](args)
CancelEvent()
end
end)