Advertisement
Guest User

TX-BAN

a guest
Oct 4th, 2014
542
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.70 KB | None | 0 0
  1. ///////////////////////////////////////////////
  2. //                                           //
  3. //      SA-MP TX-BAN System                  //
  4. //      Made by :ThunderX                    //
  5. //                                           //
  6. ///////////////////////////////////////////////
  7.  
  8. #include <a_samp>
  9. #include <a_http>
  10.  
  11. forward BanCheck(index, response_code, data[]);
  12. forward Update(index, response_code, data[]);
  13. forward KickTimer();
  14.  
  15. new BANNED[MAX_PLAYERS];
  16. new USEDUPDATECMD[MAX_PLAYERS];
  17. new CHECKED[MAX_PLAYERS];
  18.  
  19. #define CP_VERSION "2.3"
  20.  
  21. public OnPlayerConnect(playerid)
  22. {
  23.     new plrIP[16];
  24.     GetPlayerIp(playerid, plrIP, sizeof(plrIP));
  25.     new string[128];
  26.     format(string, sizeof(string), "TYPE YOUR WEB HERE!!!",plrIP);
  27.     HTTP(playerid, HTTP_GET, string, "", "BanCheck!");
  28.     BANNED[playerid] = 0;
  29.     return 1;
  30. }
  31.  
  32. public OnPlayerDisconnect(playerid, reason)
  33. {
  34.     CHECKED[playerid] = 0;
  35.     if(BANNED[playerid] != 1)
  36.     {
  37.         new stringu[145];
  38.         new giocatore[MAX_PLAYER_NAME];
  39.         GetPlayerName(playerid, giocatore, sizeof(giocatore));
  40.         switch(reason)
  41.         {
  42.             case 0: format(stringu, sizeof(stringu), "{00FF00}[TXProtection] {669999}%s[%d] has Left the server [Crashed/Timed Out].", giocatore, playerid);
  43.             case 1: format(stringu, sizeof(stringu), "{00FF00}[TXProtection] {669999}%s[%d] has Left the server [Leaving server].", giocatore, playerid);
  44.             case 2: format(stringu, sizeof(stringu), "{00FF00}[TXProtection] {669999}%s[%d] has Left the server [Banned/Kicked].", giocatore, playerid);
  45.         }
  46.         SendClientMessageToAll(0xFFFFFFFF, stringu);
  47.     }
  48.     return 1;
  49. }
  50.  
  51. public BanCheck(index, response_code, data[])
  52. {
  53.     new buffer[ 128 ];
  54.     if(response_code == 200)
  55.     {
  56.         BANNED[index] = 1;
  57.         new string[500];
  58.         format(string, sizeof(string), "{00FFFF}You are {0xFF0000}Banned {0xFF0000}from this server!\n\n%s\n\n{00FFFF}If you feel this was a incorrect ban or would like to get a second chance\nVisit our forums, {00FF00}YOUR WEB HERE{00FFFF}and apply\nfor a unban, thanks TX.", data);
  59.         ShowPlayerDialog(index, 149, DIALOG_STYLE_MSGBOX, "{FF0000}C{FF6600}reamy {FF0000}P{FF6600}rotection", string, "Close", "");
  60.         SetTimer("KickTimer", 1, false);
  61.  
  62.     }
  63.     else
  64.     {
  65.         format(buffer, sizeof(buffer), "{0x9933FF}[TXProtection] {0x9933FF}Welcome Back!", data);
  66.         SendClientMessage(index, 0xFFFFFFFF, buffer);
  67.         new pname[MAX_PLAYER_NAME], string2[110 + MAX_PLAYER_NAME];
  68.         GetPlayerName(index, pname, sizeof(pname));
  69.         format(string2, sizeof(string2), "{00FF00}[TXProtection] {0066FF}%s [{FFFFFF}%d{0066FF}] {FFFFFF}has {FF33CC}Joined {FFFFFF}the server [{FFFFFF}Country{}].", pname, index);
  70.         SendClientMessageToAll(0xAAAAAAAA, string2);
  71.         CHECKED[index] = 1;
  72.     }
  73. }
  74.  
  75. public Update(index, response_code, data[])
  76. {
  77.     if(response_code == 200)
  78.     {
  79.         if (strcmp(data, CP_VERSION))
  80.         {
  81.             new string[128];
  82.             format(string, sizeof(string), "{00FF00}[TX-BAN-Protection] {00FFFF}A new version ({FF0000}%s{00FFFF}) is avaliable.", data);
  83.             SendClientMessage(index, 0xFFFFFFFF, string);
  84.             SendClientMessage(index, 0xFFFFFFFF, "                               {00FFFF}Visit {FF6600} http://www.sa-mp.com {00FFFF}to get some more information");
  85.             USEDUPDATECMD[index] = 0;
  86.         }
  87.         else
  88.         {
  89.             if(USEDUPDATECMD[index] == 1)
  90.             {
  91.                 USEDUPDATECMD[index] = 0;
  92.                 new string[128];
  93.                 format(string, sizeof(string), "{00FF00}[TXProtection] {00FFFF}this is latest version!.");
  94.                 SendClientMessage(index, 0xFFFFFFFF, string);
  95.             }
  96.         }
  97.     }
  98. }
  99.  
  100. public KickTimer()
  101. {
  102.     for(new i = 0; i < MAX_PLAYERS; i++)
  103.     {
  104.         if(BANNED[i] == 1)
  105.         {
  106.             Kick(i);
  107.         }
  108.     }
  109. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement