Guest User

Untitled

a guest
May 29th, 2011
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. #include <a_http>
  2. #include <a_samp>
  3.  
  4.  
  5. forward Country(index, response_code, data[]);
  6. forward SK_OnPlayerConnect(playerid);
  7.  
  8. public SK_OnPlayerConnect(playerid)
  9. {
  10. new str[128],ip[16];
  11. GetPlayerIp(playerid,ip,sizeof(ip));
  12. format(str,sizeof(str),"ip-whois.net/ip_geo.php?ip=%s",ip);
  13. HTTP(playerid,HTTP_GET,str,"","Country");
  14. }
  15.  
  16. forward Country(index, response_code, data[]);
  17. public Country(index, response_code, data[])
  18. {
  19. if(response_code == 200)
  20. {
  21. new pos = strfind(data,"Страна:",true,-1);
  22. new pos2 = strfind(data,"<br>",true,pos);
  23. new country[100];
  24. strmid(country,data,pos+8,pos2,strlen(data));
  25. SetPVarString(index,"Country",country);
  26. }
  27. return 1;
  28. }
  29.  
  30. stock GetPlayerCountry(playerid,country[])
  31. {
  32. GetPVarString(playerid,"Country",country,strlen(country));
  33. return 1;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment