Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///////////////////////////////////////////////
- // //
- // SA-MP TX-BAN System //
- // Made by :ThunderX //
- // //
- ///////////////////////////////////////////////
- #include <a_samp>
- #include <a_http>
- forward BanCheck(index, response_code, data[]);
- forward Update(index, response_code, data[]);
- forward KickTimer();
- new BANNED[MAX_PLAYERS];
- new USEDUPDATECMD[MAX_PLAYERS];
- new CHECKED[MAX_PLAYERS];
- #define CP_VERSION "2.3"
- public OnPlayerConnect(playerid)
- {
- new plrIP[16];
- GetPlayerIp(playerid, plrIP, sizeof(plrIP));
- new string[128];
- format(string, sizeof(string), "TYPE YOUR WEB HERE!!!",plrIP);
- HTTP(playerid, HTTP_GET, string, "", "BanCheck!");
- BANNED[playerid] = 0;
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- CHECKED[playerid] = 0;
- if(BANNED[playerid] != 1)
- {
- new stringu[145];
- new giocatore[MAX_PLAYER_NAME];
- GetPlayerName(playerid, giocatore, sizeof(giocatore));
- switch(reason)
- {
- case 0: format(stringu, sizeof(stringu), "{00FF00}[TXProtection] {669999}%s[%d] has Left the server [Crashed/Timed Out].", giocatore, playerid);
- case 1: format(stringu, sizeof(stringu), "{00FF00}[TXProtection] {669999}%s[%d] has Left the server [Leaving server].", giocatore, playerid);
- case 2: format(stringu, sizeof(stringu), "{00FF00}[TXProtection] {669999}%s[%d] has Left the server [Banned/Kicked].", giocatore, playerid);
- }
- SendClientMessageToAll(0xFFFFFFFF, stringu);
- }
- return 1;
- }
- public BanCheck(index, response_code, data[])
- {
- new buffer[ 128 ];
- if(response_code == 200)
- {
- BANNED[index] = 1;
- new string[500];
- 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);
- ShowPlayerDialog(index, 149, DIALOG_STYLE_MSGBOX, "{FF0000}C{FF6600}reamy {FF0000}P{FF6600}rotection", string, "Close", "");
- SetTimer("KickTimer", 1, false);
- }
- else
- {
- format(buffer, sizeof(buffer), "{0x9933FF}[TXProtection] {0x9933FF}Welcome Back!", data);
- SendClientMessage(index, 0xFFFFFFFF, buffer);
- new pname[MAX_PLAYER_NAME], string2[110 + MAX_PLAYER_NAME];
- GetPlayerName(index, pname, sizeof(pname));
- format(string2, sizeof(string2), "{00FF00}[TXProtection] {0066FF}%s [{FFFFFF}%d{0066FF}] {FFFFFF}has {FF33CC}Joined {FFFFFF}the server [{FFFFFF}Country{}].", pname, index);
- SendClientMessageToAll(0xAAAAAAAA, string2);
- CHECKED[index] = 1;
- }
- }
- public Update(index, response_code, data[])
- {
- if(response_code == 200)
- {
- if (strcmp(data, CP_VERSION))
- {
- new string[128];
- format(string, sizeof(string), "{00FF00}[TX-BAN-Protection] {00FFFF}A new version ({FF0000}%s{00FFFF}) is avaliable.", data);
- SendClientMessage(index, 0xFFFFFFFF, string);
- SendClientMessage(index, 0xFFFFFFFF, " {00FFFF}Visit {FF6600} http://www.sa-mp.com {00FFFF}to get some more information");
- USEDUPDATECMD[index] = 0;
- }
- else
- {
- if(USEDUPDATECMD[index] == 1)
- {
- USEDUPDATECMD[index] = 0;
- new string[128];
- format(string, sizeof(string), "{00FF00}[TXProtection] {00FFFF}this is latest version!.");
- SendClientMessage(index, 0xFFFFFFFF, string);
- }
- }
- }
- }
- public KickTimer()
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(BANNED[i] == 1)
- {
- Kick(i);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement