Jefhxbxnxnxhshxz

Correção fs anti próx / vpn

Jan 16th, 2023 (edited)
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. #include a_samp
  2. #include streamer
  3. #include a_http
  4.  
  5.  
  6. // Topo do script
  7. #define MAX_COUNTRY_NAME 64
  8.  
  9. new STRX[1000];
  10.  
  11.  
  12. public OnPlayerConnect(playerid) {
  13. if(strcmp("127.0.0.1", GetPlayerIPEx(playerid), true) != 0) {
  14. format(STRX, 128, "ip-api.com/json/%s", GetPlayerIPEx(playerid));
  15. HTTP(playerid, HTTP_GET, STRX, "", "HTTP_Connect");
  16. }
  17. return 1;
  18. }
  19.  
  20. forward HTTP_Connect(playerid, response_codec, data[]);
  21. public HTTP_Connect(playerid, response_codec, data[]) {
  22. if(response_codec != 200) {
  23. SetPVarString(playerid, "Pais", "Desconhecido"), SetPVarString(playerid, "Estado", "Desconhecido"), SetPVarString(playerid, "Cidade", "Desconhecida");
  24. return 1;
  25. }
  26.  
  27. new string[128], pos;
  28. if(strfind(data, "Reserved", true) == -1 && strlen(data) >= 15) {
  29. if((pos = strfind(data, "\"country\":")) != -1)
  30. {
  31. pos += 11;
  32. strmid(string, data, pos, strfind(data, "\"", true, pos));
  33. SetPVarString(playerid, "Pais", string);
  34. }
  35. if((pos = strfind(data, "\"regionName\":")) != -1)
  36. {
  37. pos += 14;
  38. strmid(string, data, pos, strfind(data, "\"", true, pos));
  39. SetPVarString(playerid, "Estado", string);
  40. }
  41. if((pos = strfind(data, "\"city\":")) != -1)
  42. {
  43. pos += 8;
  44. strmid(string, data, pos, strfind(data, "\"", true, pos));
  45. SetPVarString(playerid, "Cidade", string);
  46. }
  47. }
  48.  
  49. GetPVarString(playerid, "Pais", string, MAX_COUNTRY_NAME);
  50. if(strfind(string, "Brazil", true) == -1 && strfind(string, "Portugal", true) == -1 && strfind(string, "France", true) == -1 && strfind(string, "Desconhecido", true) == -1)
  51. {
  52. SendClientMessage(playerid, 0xFF0000AA, "A entrada de seu IP nao e permitida.");
  53. SetTimerEx("kick2F",1000, 0, "i", playerid);
  54. }
  55. return 0;
  56. }
  57.  
  58. forward kick2F(playerid);
  59. public kick2F(playerid)
  60. {
  61. Kick(playerid);
  62. return 1;
  63. }
  64.  
  65.  
  66. stock GetPlayerRegion(playerid)
  67. {
  68. new string[MAX_COUNTRY_NAME];
  69. GetPVarString(playerid, "Estado", string, MAX_COUNTRY_NAME);
  70. return string;
  71. }
  72. stock GetPlayerCountry(playerid)
  73. {
  74. new string[MAX_COUNTRY_NAME];
  75. GetPVarString(playerid, "Pais", string, MAX_COUNTRY_NAME);
  76. return string;
  77. }
  78. stock GetPlayerIPEx(playerid) {
  79. static IP[20];
  80. GetPlayerIp(playerid, IP, sizeof(IP));
  81. return IP;
  82. }
  83.  
  84.  
  85.  
Advertisement
Add Comment
Please, Sign In to add comment