Guest User

Untitled

a guest
Oct 1st, 2023
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.73 KB | None | 0 0
  1. void gsc_player_getip(scr_entref_t id)
  2. {
  3.     if (id.entnum >= MAX_CLIENTS)
  4.     {
  5.         stackError("gsc_player_getip() entity %i is not a player", id.entnum);
  6.         stackPushUndefined();
  7.         return;
  8.     }
  9.  
  10.     client_t *client = &svs.clients[id.entnum];
  11.  
  12.     char tmp[16];
  13.     snprintf(tmp, sizeof(tmp), "%d.%d.%d.%d", client->netchan.remoteAddress.ip[0], client->netchan.remoteAddress.ip[1], client->netchan.remoteAddress.ip[2], client->netchan.remoteAddress.ip[3]);
  14.  
  15.     //dvar_t    *ip;
  16.     char localip[16] = "127.0.0.1";
  17.     //ip = Dvar_RegisterString( "net_ip", "localhost", DVAR_LATCH );
  18.    
  19.     if (strcmp(localip, tmp) == 0)
  20.     {
  21.         extern char proxy_realip[MAX_CLIENTS][16];
  22.         snprintf(tmp, sizeof(tmp), "%s", proxy_realip[id.entnum]);
  23.     }
  24.     stackPushString(tmp);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment