Results 1 to 10 of 28

Thread: [Q3 FIX] Q3 fake clients fix

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Private First Class RobsoN's Avatar
    Join Date
    Jan 2013
    Location
    /home/cod2/
    Posts
    230
    Thanks
    119
    Thanked 95 Times in 64 Posts

    [Q3 FIX] Q3 fake clients fix

    Hello, I want to share my Q3fill fix.
    Script will kick player which tries to connect to the server when other player on server has same IP address.
    The code is not diffucult but it can help to prevent annoying server haters ^^.

    NOTICE: Requires libcod!

    PHP Code:
    notifyConnecting()
    {
        
    self endon("disconnect");

        
    waittillframeend;

        if(
    isDefined(self))
        {
            
    level notify("connecting",self);
            
    setQ3Fix(); //Add this line
        
    }
        
        
    }
    setQ3Fix()
    {
        if(!
    isDefined(level.q3_fix))
            
    level.q3_fix = [];
            
        
    my_ip getIP(self);
        
        if(
    isDefined(level.q3_fix[my_ip]) && !self.data["bot"])
        {
            
    self setClientCvar("com_errorTitle""Error"); //Maybe somehow system will fail (it should'nt but we should always assume that can happens) and a real client can be kicked.
            
    self setClientCvar("com_errorMessage""IP duplicate detected"); //So let him know, what went wrong.
            
    self.kicked true;
            
    println("Warning: Kicking client with IP duplicate: "+my_ip);
            
    kick(self getEntityNumber());
            return 
    true;
        }
        
        if(!
    self.data["bot"])
            
    level.q3_fix[my_ip] = true;
            
        return 
    false;
    }
    getIP(client

        return 
    closer(430client getEntityNumber()); 
    }
    println(msg)
    {
        
    closer(200msg "\n");
    }
    Callback_PlayerDisconnect()
    {
      if(!
    isDefined(self.kicked))
          
    level.q3_fix[getIP(self)] = undefined;
      [...]

    Results:

    PHP Code:
    Going from CS_FREE to CS_CONNECTED for  (num 0 guid 0)
    Sending heartbeat to cod2master.activision.com
    Client 3 connecting with 50 challenge ping from SOMEIP
    :SOMEPORT
    Going from CS_FREE to CS_CONNECTED 
    for  (num 1 guid 0)
    WarningKicking client with IP duplicateSOMEIP
    WARNING
    Non-localized Game Message string is not allowed to have letters in itMust be changed over to a localized string"^4*^7 t0nj3WO345oa ^7Ha^9s ^7Disc^9onnected ^7Fr^9om ^4*^7eXtremE^2~^9ZOMBIES^7"
    1EXE_PLAYERKICKED 
    You can see self.data["bot"] which is boolean in my case. You should define your own variable to know if connecting entity is a bot (to prevent testclient kicking).
    Also you can add a line which adds kicked IP into a logfile. Then you can easily add it manually into firewall (or do whatever you need).

    If you got any questions or objections to my code please let me know below

    Edit#1: I forget to add array undefining when a real player disconnects
    Last edited by RobsoN; 14th January 2014 at 18:11.
    "Don't worry if your code doesn't work correctly - if everything worked, you would not work" ~Mosher's right

  2. The Following 3 Users Say Thank You to RobsoN For This Useful Post:

    kung foo man (15th January 2014),Rocky (14th January 2014),smect@ (15th January 2014)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •