Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.58 KB | None | 0 0
  1. function IpAlias(player)
  2. {
  3.     local ip = player.IP;
  4.     local q = QuerySQL(aDB,"SELECT iip,inick FROM ipalias WHERE iip LIKE '"+ip+"'");
  5.     if( GetSQLColumnData(q,0) == null )
  6.     {
  7.         local query = format("UPDATE ipalias SET inick='"+player.Name+"',iip='"+ip+"'");
  8.         QuerySQL(query);
  9.     }
  10.     else
  11.     {
  12.         local i = 0;
  13.         while ( i < GetSQLColumnCount(q) )
  14.         {
  15.             if ( GetSQLColumnCount ( q, 1 ) != player.Name )
  16.             {
  17.                 local query = format("INSERT INTO ipalias (inick,iip) VALUES ('%s','%s')",player.Name,ip.tostring());
  18.                 break;
  19.             }
  20.             local q = GetSQLNextRow(q);
  21.             i++;
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement