Kick when jon

I was wondering if I could make it so if the player isn’t admin it kicks them right when they press the join server button, like how when the player is banned from a server. I tried this but it wait’s till they are sending client info:
[LUA]hook.Add(“PlayerInitialSpawn”, “banjoin”, function(ply)
if !ply:IsAdmin() then
ply:Kick("")
end
end)[/LUA]

Earliest hook to get the player object would be http://wiki.garrysmod.com/page/GM/PlayerAuthed but if you want to kick someone immediately you can use http://wiki.garrysmod.com/page/GM/CheckPassword or http://wiki.garrysmod.com/page/GM/PlayerConnect if you have the admin’s steamid/name/ip.

The earlier way is to use gameevent.Listen(“player_connct”) and do

[lua]
hook.Add(“player_connect”, “kickThem”, function(data)
game.ConsoleCommand(“kickid “…data.userid…” Bye”);
end);
[/lua]

This would be called as soon as they connect.

He only wants to kick players who are not admins though.

Depending on the admin mod, usually they’d have something where the admins are stored in a table?

So no way to make it like the banid when it kicks them right when the press join. The reason why I wanted this was to make my own banning method, So if the player is banned kick them when the press the join button. Thank you for your help though guys, I appreciate it.

In your ban method just make a table of banned SteamIDs and see if the table contains data.networkid from player_connect.