ConnectQueue - A Server Queue System

ConnectQueue:

ConnectQueue is a queue system that makes use of the deferral features in FiveM. I’m too lazy to write anything here, so take a look at the readme on github. I might whip up a good example demonstrating what you can do with this resource in a couple days.

Download:

The readme has all the info you need

https://github.com/Nick78111/ConnectQueue

Screenshot

Old Version and Testing Branch
28 Likes

I can’t test it now, but huge work !
Big hug :slight_smile:

2 Likes

Awesome, i love it ! Thank’s sir !

Wow thanks for sharing this with the community

Update v1.1.0

Added a little update that adds a sort of safety net. I have seen on other queue scripts that players can sometimes join at random and completely bypass the queue, I don't know if it's because their script is bad, or if it's something wrong on FiveM's part. This will kick players who join that didn't properly wait in queue and aren't greenlit.

Note: If you restart the resource, it will kick all online players for not being greenlit, I will fix this soon.

2 Likes

FXServer (starting from the alpha update later today: if you’re on the FiveM Discord e-mail pr@fivem.net your nickname and you’ll be added to the group that gets prereleases) will include some enhancements that’ll allow this to work a bit better:

AddEventHandler('playerConnecting', function(name, setCallback, deferrals)
	-- mark this connection as deferred
	deferrals.defer()

	-- save source
	local s = source

	for i = 1, 20 do
		-- of course deferrals can be saved in a local too, just make sure it gets cleared when done!
		-- update just sends a status message to the client, that'll show instead of 'Connecting'
		deferrals.update('hey, wait ' .. tostring(20 - i) .. ' seconds')
		Wait(1000)
	end

	-- accept the client, or reject the connection by passing a reason to `done`
	deferrals.done()
end)

Citizen.CreateThread(function()
	local initHostName = GetConvar('sv_hostname')

	while true do
		Wait(1000)

		-- can for example be used to show a semi-live pending queue count
		-- keep in mind that this will only update on a heartbeat
		SetConvar('sv_hostname', '[' .. tostring(#GetPlayers()) .. '] ' .. initHostName)
	end
end)
3 Likes

Update V 1.1.2

Fixed a syntax error which may have broke the whole thing in certain situations D=

Also working on something new for when fx-server comes out.

Quick edit: added the ability to change when it starts placing players in the queue, take a look at the config.

3 Likes

Update V 1.1.3

Was able to iron out some bugs with the help of Ykkris. There seems to be an issue with the green lighting system so in this update, it will currently be disabled by default, if you do enable it, I am 99% sure you will run into errors with players being kicked when they join.
2 Likes

Nice script !
I have a probleme, i set the “PlaceInQueueAt” at false, but the people are joining the Queue since we are 20 on the server… So we are kind of stuck at 20…

Agree. Same problem with connections

1 Like

Honestly don’t think I’ll make any more updates for this. With FXServer’s deferral system, this will be obsolete.

No? Deferrals still need a script to implement queue logic, like yours, but adapted. :stuck_out_tongue:

1 Like

I meant this script itself will be obsolete because I have made another from scratch with deferrals, and I don’t plan on doing anything with this one anymore, so this one will be pointless when FXS is released. New one isn’t completely finished yet though.

Dynamic queue ! :hugs:
This is plan to be cool !

will it be released?

You can any tips on fixing this queue system? Seems after so long the queue system bugs out, if i have it set to 32,. after a while it starts degrading and putting people in a queue at say 15 and stuff? :confused:

This still works right?

Soon? need fx please)

@Nick78111 great work, how long till the FX version mate? Eager to get my hands on this

there’s an untested version at https://github.com/Nick78111/ConnectQueue for fxs but it’s not known if it actually works

3 Likes