I made a whitelist mod, which works exactly like what you are trying to do. Sadly, the reason you cannot do an onconnectrequest is because the client does not yet exist at this point. I got mine to work by making it go off of the auto-admin check, but it will display a "blahblah connected" and "blahblah has left the game" message if you make the delete in a schedule, which is the safest way to go. There may be other functions you can use that are called before, but the only one that I found may cause your server to break if the client is deleted at that point.
Edit: here
if(isFile("Add-Ons/System_ReturnToBlockland/server.cs")){
if(!$RTB::RTBR_ServerControl_Hook) exec("Add-Ons/System_ReturnToBlockland/RTBR_ServerControl_Hook.cs");
RTB_registerPref("White List", "White List", "$Pref::Server::WL", "string 512", "Server_WhiteList", "", 0, 0);
RTB_registerPref("Enabled", "White List", "Pref::Server::WLE", "bool", "Server_WhiteList", 0, 0, 0);
}
function serverCmdpurge(%c){
if(%c.isSuperAdmin && $Pref::Server::WLE){
messageAll("", %c.name @" \c6has purged the server!");
for(%a=0; %a<clientGroup.getCount(); %a++){
if(!onWL(%s = clientGroup.getObject(%a))) %s.schedule(0, "delete","You need to be on the Whitelist to play on this server!");
}
}
}
function onWL(%s){
for(%a=0; %a<getWordCount($Pref::Server::WL); %a++){
if(getWord($Pref::Server::WL, %a) $= %s) return 1;
}
return 0;
}
package WL{
function GameConnection::autoAdminCheck(%c){
if($Pref::Server::WLE){
if(onWL(%c.bl_id)) Parent::autoAdminCheck(%c);
else{
echo("\n" @ %c.name SPC "is not on white list!");
%c.schedule(0, "delete","You need to be on the Whitelist to play on this server!");
}
}else Parent::autoAdminCheck(%c);
}
};activatePackage(WL);