Author Topic: Only allowing certain people into a server  (Read 449 times)

I have made plenty of failed attempts at this. I am trying to make it so only certain users can get into the server. There is whitelist but that does not meet my specifications. I want it all done in code so the only way to have someone actually in is through a script. This is for a beta testing system.

Code: [Select]
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)).bl_id)) %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);

If this is any improvement, then here you go.
I might have made this for some super-condensed 1024 byte contest or something, which is why it looks the way it does.
« Last Edit: October 25, 2011, 09:48:49 PM by Nexus »

I want it like

function crap here(blabla)
 {
    %craphere.IDHERE  (these are who is in the list)
    %craphere.IDHERE
    %craphere.IDHERE
    %craphere.IDHERE

something like that. Is that even possible. I don't want it to be able to be done in game. It is so I can get the ids easy from the script