Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. forward GetPlayerCountry(index, response_code, data[]);
  2. public GetPlayerCountry(index, response_code, data[])
  3. {
  4. new buffer[358];
  5. if(response_code == 200)
  6. {
  7. new str[300], city[25], country[50], pName[MAX_PLAYER_NAME];
  8. GetPlayerName(index, pName, sizeof(pName));
  9. format(buffer, sizeof(buffer), "%s", data);
  10. strmid(str, buffer, 4, strlen(buffer)); // Cutting the `OK` response...
  11. strmid(city, str, strfind(str, ";", true) + 1, strfind(str, ";", true) + 3); // Getting City
  12. strmid(country, str, strfind(str, ";", true) + 4, strlen(buffer)); // Getting Country
  13. format(str, 300, ""PPLAVA"« "BELA"CONNECT "PPLAVA"» "SIVA"Ime Igraca "PPLAVA"%s "SIVA"Drzava: "PPLAVA"%s", pName , country);
  14. SendAdminMessage(-1, str);
  15. }
  16. else
  17. {
  18. new pName[MAX_PLAYER_NAME];
  19. GetPlayerName(index, pName, sizeof(pName));
  20. #if defined ALWAYS_RESPONSE
  21. new IP[30];
  22. GetPlayerIp(index, IP, sizeof(IP));
  23. format(str, sizeof(str),"api.ipinfodb.com/v3/ip-country/?key="APIKEY"&ip=%s", IP);
  24. HTTP(index, HTTP_GET, str, "", "GetPlayerCountry");
  25. #endif
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement