General > Developers Corner
CheckPassword hook for reserve slots
Eccid:
Last night my server was full, and because of the way ulx handles the slots (i use mode 2) people would join in, and then be kicked; which was a problem. It was hard to join on reserve slots because when someone was joining without access, they still took up the slot until they got in and got kicked, and if they need to download the map or resources from the server they could be using the slot for a while. I tried a bunch of different ways to do this this morning and failed miserably. Do you think you guys could add this funtionality? It would be great if they were just blocked before entering. Here's the last attempt I made, maybe you guys can fix what I did wrong. It's the slots.lua file.
(For use with mode 2 of reserve slots)
After much deliberation, my issue was solved. If you want people to be blocked from joining your server if they don't have access to the reserve slots, replace your slots.lua with this one.
JamminR:
I'm pretty sure players will still take up map/model/whatever file download slots before Lua ever sees them.
Even if you get your code working, they'd most likely be kicked before having the chance to enter a password.
I don't think this function actually starts 'before' the Lua engine, like the Source sv_password hardcoded checks do.
Eccid:
It works like gatekeeper, it blocks them from joining when returned false.
http://gmodwiki.net/Lua/Hooks/Base/CheckPassword
JamminR:
Eccid, I read that wiki before posting.
It's an sv_password "emulator".
Gatekeeper runs before Lua does. (its some type of server hard coded dll or exe)
The Sv_password runs before lua does. (It's part of the source server hard code gmod is built on)
That command, which is part of G-lua, will only run after lua has started.
Which, unless Gm13 changed things (and some of my dev friends here will correct me and I'll gladly accept I'm incorrect), Lua starts right before the player spawns.
Meaning, people will still be able to connect to your server, start downloads, fill a slot for a while, before Lua starts and checks with that hook.
It's still a cool idea, but, won't protect you from the same reason you don't like the fact they connect/get kicked.
LostAlien:
CheckPassword hook is run at the same time as gatekeeper's hook is
Navigation
[0] Message Index
[#] Next page
Go to full version