Advertisement
Guest User

MODIFIED IP LIMIT CODE FOR OGAR BY /u/Q79X

a guest
Jan 12th, 2016
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // This modified version doesn't permanently ban users! This just limits USERS BY IP!!!
  2. // (Also note that this cannot be modified so go http://bit.ly/ogarIPLimit for extra details / updates)
  3.  
  4. // Original Script by /u/AgaryServer on Reddit
  5. // Modified Script by /u/Q79X on Reddit
  6. // Please Put " this.ipCounts= []; " inside the function GameServer (~ Line 27) or it will break your server (You Will NOT be HAPPY)
  7.  
  8. // ALWAYS REMEMBER TO BACKUP FILES INCASE YOU DID SOMETHING HORRIBLY WRONG
  9.  
  10. // PLACE ↓ IP LIMIT CODE ↓ ~ Line 185 / AFTER THE "// -----/Client authenticity check code -----" LINE
  11.  
  12. // ----------- Client IP limiting -----------
  13.         // Check if we're past the limit for this IP
  14.         if(this.ipCounts[ws._socket.remoteAddress] > 5) {
  15.             ws.close();
  16.             this.ipCounts[ws._socket.remoteAddress]--;
  17.             return;
  18.         }
  19.         // Increment the count for this IP
  20.         if(this.ipCounts[ws._socket.remoteAddress]) {
  21.             this.ipCounts[ws._socket.remoteAddress]++;
  22.         } else {
  23.             this.ipCounts[ws._socket.remoteAddress] = 1;
  24.         }
  25. // -----------/Client IP limiting --------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement