Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kick when reserved slots #109

Closed
flydvorkin opened this issue Sep 10, 2017 · 2 comments
Closed

Kick when reserved slots #109

flydvorkin opened this issue Sep 10, 2017 · 2 comments

Comments

@flydvorkin
Copy link

flydvorkin commented Sep 10, 2017

Steps to reproduce

  1. Many tryes non-priveleged players to log on to server when reserved slots only if available
    causes low server performance.

Expected behavior

Need kick connected player when initial connect stage.

To resolve this - add hook for example:
hook.Add( "CheckPassword", "EXAMPLENAME", function( steamid64, ip, sv_password, cl_password, cl_name )
...
local SteamID = util.SteamIDFrom64(steamid64)
local access = false
if ULib.ucl.users[ sid ] then
local group = ULib.ucl.users[ SteamID ].group
while group do -- While group is not nil
local groupInfo = ULib.ucl.groups[ group ]
if not groupInfo then break end
if table.HasValue( groupInfo.allow, "ulx reservedslots" ) then
access = true
break
end
if groupInfo.allow[ "ulx reservedslots" ] then
access = true
break
end
group = ULib.ucl.groupInheritsFrom( group )
end
end
...
if access == false then
if cur + slots >= max then
return false, ( "[ULX] Reserved slot, sorry!" )
end
end
...
end )

@flydvorkin
Copy link
Author

Check this code:
https://pastebin.com/Dg7ehvPx
This is work fine

@Nayruden
Copy link
Member

Duplicate of #8

@Nayruden Nayruden marked this as a duplicate of #8 Sep 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants