Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <a_http>
- forward BanCheck(index, response_code, data[]);
- forward KickTimer();
- new BANNED[MAX_PLAYERS];
- new CHECKED[MAX_PLAYERS];
- //Do not modify
- #define CP_VERSION "2.4"
- public OnPlayerConnect(playerid)
- {
- new plrIP[16];
- GetPlayerIp(playerid, plrIP, sizeof(plrIP));
- new string[128];
- format(string, sizeof(string), "creamystuff.tk/creamyprotection/index.php?ip=%s",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}[CreamyProtection] {FFFFFF}%s[%d] {669999}has Left the server [Crashed/Timed Out].", giocatore, playerid);
- case 1: format(stringu, sizeof(stringu), "{00FF00}[CreamyProtection] {FFFFFF}%s[%d] {669999}has Left the server [Leaving].", giocatore, playerid);
- case 2: format(stringu, sizeof(stringu), "{00FF00}[CreamyProtection] {FFFFFF}%s[%d] {669999}has Left the server [Banned/Kicked].", giocatore, playerid);
- }
- SendClientMessageToAll(0xFFFFFFFF, stringu);
- }
- return 1;
- }
- public BanCheck(index, response_code, data[])
- {
- new plrIP[16];
- GetPlayerIp(index, plrIP, sizeof(plrIP));
- new buffer[ 128 ];
- if(response_code == 200)
- {
- if(strfind(data, "Ban Code:01", true) != -1)
- {
- new string[500];
- 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);
- ShowPlayerDialog(index, 149, DIALOG_STYLE_MSGBOX, "{FF0000}C{FFFFFF}reamy {FF0000}P{FFFFFF}rotection", string, "Close", "");
- BANNED[index] = 1;
- SetTimer("KickTimer", 1, false);
- }
- }
- else
- {
- format(buffer, sizeof(buffer), "{00FF00}[CreamyProtection] {00FFFF}You are good to play here, thanks for playing fair.", 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}[CreamyProtection] {FFFFFF}%s[%d] {669999}has Joined the server.", pname, index);
- SendClientMessageToAll(0xAAAAAAAA, string2);
- CHECKED[index] = 1;
- }
- }
- 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