Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_http>
- #include <a_samp>
- forward Country(index, response_code, data[]);
- forward SK_OnPlayerConnect(playerid);
- public SK_OnPlayerConnect(playerid)
- {
- new str[128],ip[16];
- GetPlayerIp(playerid,ip,sizeof(ip));
- format(str,sizeof(str),"ip-whois.net/ip_geo.php?ip=%s",ip);
- HTTP(playerid,HTTP_GET,str,"","Country");
- }
- forward Country(index, response_code, data[]);
- public Country(index, response_code, data[])
- {
- if(response_code == 200)
- {
- new pos = strfind(data,"Страна:",true,-1);
- new pos2 = strfind(data,"<br>",true,pos);
- new country[100];
- strmid(country,data,pos+8,pos2,strlen(data));
- SetPVarString(index,"Country",country);
- }
- return 1;
- }
- stock GetPlayerCountry(playerid,country[])
- {
- GetPVarString(playerid,"Country",country,strlen(country));
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment