Advertisement
rEfCZE

SA-MP: Simple restriction of connection under the same IP address.

Jul 31st, 2018 (edited)
1,480
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.48 KB | None | 0 0
  1. #define     MAX_CONNECTIONS     3
  2.  
  3. public OnIncomingConnection(playerid, ip_address[], port)
  4. {
  5.     new
  6.         count = 1;
  7.  
  8.     for (new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
  9.     {
  10.         if (IsPlayerConnected(i) && strcmp(GetPlayerIP(i), ip_address, false) == 0)
  11.         {
  12.             count ++;
  13.         }
  14.     }
  15.  
  16.     if (count > MAX_CONNECTIONS)
  17.     {
  18.         Kick(playerid);
  19.     }
  20.     return true;
  21. }
  22.  
  23. stock GetPlayerIP(playerid)
  24. {
  25.     new
  26.         str[39 + 1];
  27.  
  28.     GetPlayerIp(playerid, str, sizeof(str));
  29.     return str;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement