Blockland Forums > Modification Help

Script_MultipleClientBlock kicks everyone.

Pages: (1/3) > >>

ScratchTehEPICSpaceDude:


--- Code: ---package BlockDuplicates
{
    function GameConnection::autoAdminCheck(%client)
    {
        for(%i = 0; %i < clientGroup.getCount(); %i++)
        {
            if(clientGroup.getObject(%i).bl_id $= %client.bl_id)
            {
                %client.delete("No duplicates allowed");
                return;
            }
        }
        parent::autoAdminCheck(%client);
    }
 };
 activatePackage(BlockDuplicates);

--- End code ---

Someone made this for me to kick multiple clients, but it kicks everyone. How do I make it so I only bans 1 duplicate?

Headcrab Zombie:

Because you're comparing the client with itself.
Try something like this


--- Code: ---package BlockDuplicates
{
function GameConnection::autoAdminCheck(%this)
{
for(%i = 0; %i < clientGroup.getCount(); %i++)
{
%client = clientGroup.getObject(%i);
if(%cliet.bl_id == %this.bl_id && %client != %this)
{
%this.delete("No duplicates allowed");
return;
}
}
parent::autoAdminCheck(%client);
}
};
activatePackage(BlockDuplicates);
--- End code ---


Ipquarx:

I made one of these that blocks them as they request to connect, therefore preventing the connected messages, it also has a exception system. Should I get it for you?

Nexus:


--- Quote from: Ipquarx on May 20, 2012, 04:58:51 PM ---I made one of these that blocks them as they request to connect, therefore preventing the connected messages, it also has a exception system. Should I get it for you?

--- End quote ---

You could even block them by name instead of ID because names are unique to individual clients, so you don't need to wait until the admin check (this will also help with LAN server compatibility).  Hit them right at the connect request because you can.

Brian Smithers:


package blah
{
    function GameConnection::onConnectRequest(%this, %addr, %lan, %name, %pre, %suf, %rtb)
    {
       for(%i=0;%i<ClientGroup.getCount();%i++)
       {
          %cname = ClientGroup.getObject(%i).name;
          if(%name == %cname)
             %k = true;
       }
       if(%k)
          return "No Multiclienting";
       else
           return Parent::onConnectRequest(%this, %addr, %lan, %name, %pre, %suf, %rtb);
    }
};activatepackage(blah);

knock them out right at the start.

Pages: (1/3) > >>

Go to full version