GM:CheckPassword
boolean, string GM:CheckPassword( string steamID64, string ipAddress, string svPassword, string clPassword, string name )
Description
Called when a non local player connects to allow the Lua system to check the password.
The default behaviour in the base gamemodes emulates what would normally happen. If sv_password is set and its value matches the password passed in by the client - then they are allowed to join. If it isn't set it lets them in too.
Arguments
1 string steamID64
The 64bit Steam ID of the joining player, use util.SteamIDFrom64 to convert it to a
STEAM_0:
one.Returns
Example
A user access whitelist to the server.
Available pre-defined messages can be found in ../sourceengine/resource/gameui_english.txt
files or here.
Suggested messages are #GameUI_ConnectionFailed
and #GameUI_ServerRejectLANRestrict
.
local allowed = {
[ "76561198012345678" ] = true, -- Me
[ "76561198123456789" ] = true, -- Friend #1
[ "76561198234567890" ] = true, -- Friend #2
}
hook.Add( "CheckPassword", "access_whitelist", function( steamID64 )
if not allowed[ steamID64 ] then
return false, "#GameUI_ServerRejectLANRestrict"
end
end )