Advertisement
Whitetigerswt

GeoIP Sqlite sa-mp example script

Jan 10th, 2012
3,277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.34 KB | None | 0 0
  1. #include <a_samp>
  2. #include <geolocation>
  3.  
  4. public OnFilterScriptInit() {
  5.     /*new ip[90]; ip = "";
  6.     new country[256], isp[256], city[256];
  7.  
  8.     new ticks = tickcount();
  9.     GetIPCountry(ip, country);
  10.     printf("Countrys took %d ms", tickcount()-ticks);
  11.    
  12.     ticks = tickcount();
  13.     GetIPISP(ip, isp);
  14.     printf("ISP took %d ms", tickcount()-ticks);
  15.    
  16.     ticks = tickcount();
  17.     GetIPCity(ip, city);
  18.     printf("City took %d ms", tickcount()-ticks);
  19.    
  20.     printf("Result: %s, %s, %s", country, isp, city);
  21.    
  22.     GetPlayerCountry(0, country, sizeof(country));
  23.     printf(country);*/
  24.    
  25.     // ^ this stuff is for testing
  26.    
  27.     return 1;
  28. }
  29.  
  30. public OnPlayerConnect(playerid) {
  31.     new country[256], city[256], isp[256];
  32.    
  33.     new ticks = tickcount();
  34.     GetPlayerCountry(playerid, country, sizeof(country));
  35.     printf("Countrys took %d ms", tickcount()-ticks);
  36.    
  37.     ticks = tickcount();
  38.     GetPlayerISP(playerid, isp, sizeof(isp));
  39.     printf("ISP took %d ms", tickcount()-ticks);
  40.    
  41.     ticks = tickcount();
  42.     GetPlayerCity(playerid, city, sizeof(city));
  43.     printf("City took %d ms", tickcount()-ticks);
  44.    
  45.     new str[256];
  46.     new name[MAX_PLAYER_NAME];
  47.     GetPlayerName(playerid, name, sizeof(name));
  48.     format(str, sizeof(str), "%s: {FF3300}%s {FFFFFF}| {1975FF}%s {33CC00}| %s", name, country, isp, city);
  49.     SendClientMessageToAll(-1, str);
  50.    
  51.     return 1;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement