SHARE
TWEET

CheckProxy

KaLu17 Apr 21st, 2014 143 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <a_samp>
  2. #include <a_http>
  3.  
  4. forward BanCheck(index, response_code, data[]);
  5. forward KickTimer();
  6.  
  7. new BANNED[MAX_PLAYERS];
  8. new CHECKED[MAX_PLAYERS];
  9.  
  10.  
  11. //Do not modify
  12. #define CP_VERSION "2.4"
  13.  
  14. public OnPlayerConnect(playerid)
  15. {
  16.         new plrIP[16];
  17.         GetPlayerIp(playerid, plrIP, sizeof(plrIP));
  18.         new string[128];
  19.         format(string, sizeof(string), "creamystuff.tk/creamyprotection/index.php?ip=%s",plrIP);
  20.         HTTP(playerid, HTTP_GET, string, "", "BanCheck");
  21.         BANNED[playerid] = 0;
  22.         return 1;
  23. }
  24.  
  25. public OnPlayerDisconnect(playerid, reason)
  26. {
  27.         CHECKED[playerid] = 0;
  28.         if(BANNED[playerid] != 1)
  29.         {
  30.             new stringu[145];
  31.             new giocatore[MAX_PLAYER_NAME];
  32.         GetPlayerName(playerid, giocatore, sizeof(giocatore));
  33.         switch(reason)
  34.         {
  35.                 case 0: format(stringu, sizeof(stringu), "{00FF00}[CreamyProtection] {FFFFFF}%s[%d] {669999}has Left the server [Crashed/Timed Out].", giocatore, playerid);
  36.                 case 1: format(stringu, sizeof(stringu), "{00FF00}[CreamyProtection] {FFFFFF}%s[%d] {669999}has Left the server [Leaving].", giocatore, playerid);
  37.                 case 2: format(stringu, sizeof(stringu), "{00FF00}[CreamyProtection] {FFFFFF}%s[%d] {669999}has Left the server [Banned/Kicked].", giocatore, playerid);
  38.         }
  39.         SendClientMessageToAll(0xFFFFFFFF, stringu);
  40.         }
  41.         return 1;
  42. }
  43.  
  44. public BanCheck(index, response_code, data[])
  45. {
  46.         new plrIP[16];
  47.         GetPlayerIp(index, plrIP, sizeof(plrIP));
  48.         new buffer[ 128 ];
  49.         if(response_code == 200)
  50.         {
  51.                 if(strfind(data, "Ban Code:01", true) != -1)
  52.                 {
  53.                         new string[500];
  54.                         format(string, sizeof(string), "{00FFFF}You are {00FF00}Banned {00FFFF}from this server!\n\n{FF6600}Reason: {FFFFFF}Proxy Server\n{FF6600}Admin: {FFFFFF}ic3_cr3am]\n{FF6600}IP Address: {FFFFFF}%s\n{FF6600}Ban Code: {FFFFFF}01\n\n{00FFFF}If you feel this was a incorrect ban or would like a second chance\nVisit our forums, {00FF00}www.creamystuff.tk {00FFFF}and apply\nfor a unban, thanks.",plrIP);
  55.                         ShowPlayerDialog(index, 149, DIALOG_STYLE_MSGBOX, "{FF0000}C{FFFFFF}reamy {FF0000}P{FFFFFF}rotection", string, "Close", "");
  56.                         BANNED[index] = 1;
  57.                         SetTimer("KickTimer", 1, false);
  58.                 }
  59.         }
  60.         else
  61.         {
  62.                 format(buffer, sizeof(buffer), "{00FF00}[CreamyProtection] {00FFFF}You are good to play here, thanks for playing fair.", data);
  63.                 SendClientMessage(index, 0xFFFFFFFF, buffer);
  64.                 new pname[MAX_PLAYER_NAME], string2[110 + MAX_PLAYER_NAME];
  65.                 GetPlayerName(index, pname, sizeof(pname));
  66.                 format(string2, sizeof(string2), "{00FF00}[CreamyProtection] {FFFFFF}%s[%d] {669999}has Joined the server.", pname, index);
  67.                 SendClientMessageToAll(0xAAAAAAAA, string2);
  68.                 CHECKED[index] = 1;
  69.         }
  70. }
  71.  
  72. public KickTimer()
  73. {
  74.         for(new i = 0; i < MAX_PLAYERS; i++)
  75.         {
  76.                 if(BANNED[i] == 1)
  77.                 {
  78.                         Kick(i);
  79.                 }
  80.         }
  81. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top