NockyCZ / CS2-ReservedSlots

CS2 plugin for Reservation slots
37 stars 1 forks source link

[Request] For DiscordUtilities version, a 4th method (kick before connect). #8

Open NotJustin opened 2 months ago

NotJustin commented 2 months ago

In CSGO, players used to be able to connect through console to a server even when it is full. The sourcemod reserved slots plugin took advantage of this, to allow a player to connect through console even when the server is at max capacity, and if they have reserved slot, it would kick someone else.

This functionality was very nice, because it correctly showed when a server is full, but also still allowed reserved players to join and kicking someone out. It feels bad for players to join a server that shows as not full, and then be kicked because the remaining available slots are reserved-only.

I understand that players can no longer join a server through console when it is full, so that functionality is no longer possible.

However, with the DiscordUtilities version of this plugin, it is possible to have a button on discord that a player with the reserved flag can press.

On button press, the plugin checks if the server is full. If it is not full, it will simply connect the player to the server.

If it is full, then verify that the discord user who pressed the button has linked their discord to their steamid (through the ManageRolesAndPermissions module). Also verify that the player has any role which has reserved slot permission.

If the player is a reserved player, generate a random password. Set the sv_password to be that random password. Kick someone from the server. Open the link that causes the player to connect to the server. This link now must also include the generated password (idk how you do this for your redirect link, but in console all I have to do is connect <ip>;password <password>. After the player connects, set the server password to be empty string "". This is how you remove the password from the server in CS2 (I tested this with empty string. Apparently in CSGO it used to be sv_password 0 but when I tested this, it literally set the password to be "0"). If the reserved player does not connect to the server after a certain amount of time, automatically set the sv_password to be empty string "".

I believe this is a foolproof way to implement "kick before connect" that disallows anyone else but the person who presses the discord connect button from joining the server.

Magic8Ballin commented 2 months ago

Yes amazing. This functionality would create a great experience for the players in our community that have a reserved slot.

+1 vote

NockyCZ commented 2 months ago

And where should be the button to connect to the server using the reserved slot?

NotJustin commented 2 months ago

And where should be the button to connect to the server using the reserved slot?

I'm open to other ideas, but here's an idea. Let me know what you think.

For @Magic8Ballin & I's purpose, we would want it to replace the Join Server button that is part of the Server Status module.

If the server is not full, the button will act as it normally does.

If the server is full, the bot will send an "ephemeral message" as a reply.

If the user does not have reserved slot permissions, the message will have a (configurable?) reply telling them that the server is full. If the user has reserved slot permissions, the message will also have a (configurable?) reply describing what is happening.

eg:

The server is currently full. You have reserved slot permissions. We have kicked someone from the server and temporarily reserved a slot for you for the next N seconds. A link has automatically been opened that will connect you to the server. If it did not open automatically, click here. Alternatively, you can copy and paste the following in your CS2 console to connect to the server. connect <ip>;sv_password <password>

N is the amount of time we wait for the player to connect before clearing sv_password.

NockyCZ commented 2 months ago

Maybe i will add it in the future