Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Formatright © 2009, ConnorMcLeod
- AutoBhop Detector is free software;
- you can redistribute it and/or modify it under the terms of the
- GNU General Public License as published by the Free Software Foundation.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with AutoBhop Detector; if not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
- */
- #include <amxmodx>
- #include <amxmisc>
- #include <fakemeta>
- #include <hamsandwich>
- // pour mon serveur ça
- //#define BRE_SERVER
- #define VERSION "1.1.0"
- #define MAX_PLAYERS 32
- new g_iSayText
- new g_szLogBanFile[128], g_szLogFile[128]
- #if defined BRE_SERVER
- #define MIN_PERFBHOPS_FORCE_UFB 300
- native ufb_force_user(index)
- native is_steamid_cheater(steamid[])
- native set_steamid_cheater(steamid[])
- #define TIME_OFFSET 0
- new const VoogruMagicNumber[] = "76561197960265728"
- #endif
- new Trie:g_tNextCvar
- new g_pCvarBanTime, g_pCvarSite
- enum {
- NoAmxBan,
- AmxBans,
- AmxBansNew
- }
- #define MAX_CMD_LENGTH 32
- new Trie:g_tKzhAliases, Trie:g_tKzhAliases2, Trie:g_tKzhAliases3
- new g_iAmxBans, amxbans_use_newbancmd
- public plugin_init()
- {
- register_plugin("Kz Police", VERSION, "ConnorMcLeod")
- new pCvar = register_cvar("KzPolice", VERSION, FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY)
- set_pcvar_string(pCvar, VERSION)
- g_pCvarBanTime = register_cvar("kz_hack_bantime", "0")
- #if defined BRE_SERVER
- g_pCvarSite = register_cvar("kz_police_website", "http://fontaine2bre.free.fr")
- #else
- g_pCvarSite = register_cvar("kz_police_website", "our website")
- #endif
- // RegisterHam(Ham_Player_PreThink, "player", "Ham__CBasePlayer_PreThink__Post", 1)
- // register_concmd("kz_display_jumps", "ConsoleCommand_DisplayJumps", ADMIN_BAN)
- // register_clcmd("kz_check_players", "ClientCommand_CheckPlayers", ADMIN_BAN)
- g_iSayText = get_user_msgid("SayText")
- get_localinfo("amxx_logs", g_szLogFile, charsmax(g_szLogFile))
- add(g_szLogFile, charsmax(g_szLogFile), "/BhopHackChecker")
- if( !dir_exists(g_szLogFile) )
- {
- mkdir(g_szLogFile)
- }
- new szDate[16]
- #if defined BRE_SERVER
- format_time(szDate, charsmax(szDate), "%b%Y", get_systime(TIME_OFFSET))
- #else
- get_time("%b%Y", szDate, charsmax(szDate))
- #endif
- formatex(g_szLogBanFile, charsmax(g_szLogBanFile), "%s/Banned_%s.log", g_szLogFile, szDate)
- format(g_szLogFile, charsmax(g_szLogFile), "%s/Detection_%s.log", g_szLogFile, szDate)
- if( !file_exists(g_szLogBanFile) )
- {
- #if defined BRE_SERVER
- format_time(szDate, charsmax(szDate), "%B %Y", get_systime(TIME_OFFSET))
- #else
- get_time("%B %Y", szDate, charsmax(szDate))
- #endif
- new fp = fopen(g_szLogBanFile, "at")
- fprintf(fp, "%s^n^n", szDate)
- fclose(fp)
- }
- new const szPrefixesList[][] = {
- "kzh_bhop",
- "zhy_bhop",
- "kyk_bhop",
- "kxk_bhop",
- "xhz_bhop",
- "yhz_bhop",
- "v0n_bhop",
- "xyz_bhop",
- "kid_bhop",
- "fpt_bhop",
- "fuh_bhop",
- "omg_bhop",
- "voo_bhop",
- "xHack_bhop",
- "xKz_bhop",
- "xkz_bhop",
- "001_bhop",
- "002_bhop",
- "Trk_bhop",
- "m3c_bhop",
- "m4c_bhop",
- "zhyk_bhop",
- "xcfgbhop"
- }
- g_tNextCvar = TrieCreate()
- for(new i; i<sizeof(szPrefixesList)-1; i++)
- {
- TrieSetString(g_tNextCvar, szPrefixesList[i], szPrefixesList[i+1])
- }
- new szKzhAliases[][] = {"sw.str", "sw23.str", "slowmo", "ramp"}
- new szKzhAliases2[][] = {"left", "right"}
- new szKzhAliases3[][] = {"autoduck", "autojump", "autojump_units", "bhop", "bhop_standup", "cam", "fixedpitch", "fixedyaw", "noflash", "nosmoke", "speed", "speed_method", "later", "yawspeed", "loopx"}
- g_tKzhAliases = TrieCreate()
- for(new i; i<sizeof(szKzhAliases); i++)
- {
- TrieSetCell(g_tKzhAliases, szKzhAliases[i], 1)
- }
- g_tKzhAliases2 = TrieCreate()
- for(new i; i<sizeof(szKzhAliases2); i++)
- {
- TrieSetCell(g_tKzhAliases2, szKzhAliases2[i], 1)
- }
- g_tKzhAliases3 = TrieCreate()
- for(new i; i<sizeof(szKzhAliases3); i++)
- {
- TrieSetCell(g_tKzhAliases3, szKzhAliases3[i], 1)
- }
- }
- public plugin_cfg()
- {
- if( is_plugin_loaded ( "AMXBans" ) != -1 )
- {
- g_iAmxBans = AmxBans
- }
- else if( is_plugin_loaded ( "AMXBans Core" ) != -1 )
- {
- g_iAmxBans = AmxBansNew
- amxbans_use_newbancmd = get_cvar_pointer("amxbans_use_newbancmd")
- }
- }
- public client_putinserver( id )
- {
- remove_task(id)
- if( !is_user_bot(id) && !is_user_hltv(id) )
- {
- set_task(0.1, "Task_CheckCheatCvar", id)
- }
- }
- public Task_CheckCheatCvar(id)
- {
- if( is_user_connected(id) )
- {
- query_client_cvar(id, "kzh_bhop", "ClientCvarResult")
- }
- }
- public ClientCvarResult(id, const szCvar[], const szValue[])
- {
- if( is_user_connected(id) )
- {
- if( szValue[0] != 'B' )
- {
- new szName[32], szAuthid[32], szReason[14]
- if( equal(szCvar, "kzh", 3) )
- {
- szReason = "KZHack"
- }
- else
- {
- szReason = "KZHack Custom"
- }
- get_user_name(id, szName, charsmax(szName))
- get_user_authid(id, szAuthid, charsmax(szAuthid))
- #if defined BRE_SERVER
- new szCommunityId[sizeof VoogruMagicNumber]
- steamIDToCommunityID(szAuthid, szCommunityId)
- LogBan("[url=http://steamcommunity.com/profiles/%s][color=#FF0000]%s[/color][/url] [color=#FFA500]%s[/color] (%s)", szCommunityId, szName, szAuthid, szReason)
- //AddSteamId( szAuthid )
- set_steamid_cheater( szAuthid )
- #else
- LogBan("%s %s (%s)", szName, szAuthid, szReason)
- #endif
- if( g_iAmxBans )
- {
- if( g_iAmxBans == AmxBans || !get_pcvar_num(amxbans_use_newbancmd) )
- {
- server_cmd("amx_ban %d ^"%s^" ^"%s^"", get_pcvar_num(g_pCvarBanTime), szAuthid, szReason)
- }
- else
- {
- server_cmd("amx_ban ^"%s^" %d ^"%s^"", szAuthid, get_pcvar_num(g_pCvarBanTime), szReason)
- }
- }
- else
- {
- new szSite[128]
- get_pcvar_string(g_pCvarSite, szSite, charsmax(szSite))
- server_cmd("amx_ban ^"%s^" %d ^"%s, you can complain at %s^"", szAuthid, get_pcvar_num(g_pCvarBanTime), szReason, szSite)
- }
- ColorChat(0, "^3%s ^4has been banned for ^3%s ^4!!", szName, szReason)
- }
- new szNextCvar[9]
- if( TrieGetString(g_tNextCvar, szCvar, szNextCvar, charsmax(szNextCvar)) )
- {
- query_client_cvar(id, szNextCvar, "ClientCvarResult")
- }
- }
- }
- ColorChat(id, fmt[], any:...)
- {
- new szMsg[192]
- szMsg[0] = 0x04
- vformat(szMsg[1], charsmax(szMsg)-1, fmt, 3)
- message_begin(id ? MSG_ONE : MSG_ALL, g_iSayText, .player=id)
- {
- write_byte(id ? id : 1)
- write_string(szMsg)
- }
- message_end()
- }
- LogBan(const fmt[], any:...)
- {
- new szLog[224], szDate[32], szMapName[32]
- vformat(szLog, charsmax(szLog), fmt, 2)
- #if defined BRE_SERVER
- format_time(szDate, charsmax(szDate), "%c", get_systime(TIME_OFFSET))
- #else
- get_time("%c", szDate, charsmax(szDate))
- #endif
- get_mapname(szMapName, charsmax(szMapName))
- new fp = fopen(g_szLogBanFile, "at")
- fprintf(fp, "%s : %s^n%s^n^n", szDate, szMapName, szLog)
- fclose(fp)
- }
- #if defined BRE_SERVER
- steamIDToCommunityID(steamID[],communityID[sizeof VoogruMagicNumber])
- {
- const leftMaxLen = 8
- const rightMaxLen = 20
- new left[leftMaxLen];
- new right[rightMaxLen];
- strtok(steamID, left, leftMaxLen-1, right, rightMaxLen-1, ':')
- strtok(right, left, leftMaxLen-1, right, rightMaxLen-1, ':')
- new iServer = str_to_num(left);
- new iAuthID = str_to_num(right);
- const lastIndex = charsmax(VoogruMagicNumber) - 1
- copy(communityID,charsmax(VoogruMagicNumber),VoogruMagicNumber)
- new toAdd = iAuthID * 2 + iServer;
- new toAddString[sizeof VoogruMagicNumber]
- num_to_str(toAdd,toAddString,charsmax(VoogruMagicNumber));
- new addLastIndex = strlen(toAddString) - 1;
- for(new i=0;i<=addLastIndex;i++)
- {
- new num = toAddString[addLastIndex - i] - 48;
- new j=lastIndex - i;
- do
- {
- new num2 = communityID[j] - 48;
- new sum = num + num2;
- communityID[j] = (sum % 10) + 48;
- num = sum / 10;
- j--;
- }
- while(num);
- }
- }
- #endif
- public client_command( id )
- {
- static szCommand[MAX_CMD_LENGTH], iLen
- iLen = read_argv(0, szCommand, charsmax(szCommand))
- strtolower(szCommand)
- if( szCommand[0] == '+' || szCommand[0] == '-' )
- {
- new iUnderScore = contain(szCommand, "_")
- if( iUnderScore != -1 )
- // if( iLen > 5 && szCommand[4] == '_' )
- {
- if( TrieKeyExists(g_tKzhAliases2, szCommand[iUnderScore]) )
- // if( TrieKeyExists(g_tKzhAliases2, szCommand[5]) )
- {
- BanIdKzhCustom(id, szCommand)
- }
- }
- else if( TrieKeyExists(g_tKzhAliases, szCommand[1]) )
- {
- BanIdKzhCustom(id, szCommand)
- }
- }
- else if( iLen > 4 && TrieKeyExists(g_tKzhAliases3, szCommand[4]) )
- {
- BanIdKzhCustom(id, szCommand)
- }
- }
- BanIdKzhCustom(const id, const szCommand[])
- {
- new szName[32], szAuthid[32]
- get_user_name(id, szName, charsmax(szName))
- get_user_authid(id, szAuthid, charsmax(szAuthid))
- #if defined BRE_SERVER
- new szCommunityId[sizeof VoogruMagicNumber]
- steamIDToCommunityID(szAuthid, szCommunityId)
- LogBan("[url=http://steamcommunity.com/profiles/%s][color=#FF0000]%s[/color][/url] [color=#FFA500]%s[/color] (Kz Hack Command/Cvar : <%s>)", szCommunityId, szName, szAuthid, szCommand)
- set_steamid_cheater( szAuthid )
- #else
- LogBan("%s %s (Kz Hack Custom)", szName, szAuthid)
- #endif
- if( g_iAmxBans )
- {
- if( g_iAmxBans == AmxBans || !get_pcvar_num(amxbans_use_newbancmd) )
- {
- server_cmd("amx_ban %d ^"%s^" ^"Kz Hack Command/Cvar : <%s>^"", get_pcvar_num(g_pCvarBanTime), szAuthid, szCommand)
- }
- else
- {
- server_cmd("amx_ban ^"%s^" %d ^"Kz Hack Command/Cvar : <%s>^"", szAuthid, get_pcvar_num(g_pCvarBanTime), szCommand)
- }
- }
- else
- {
- new szSite[128]
- get_pcvar_string(g_pCvarSite, szSite, charsmax(szSite))
- server_cmd("amx_ban ^"%s^" %d ^"Kz Hack Command/Cvar : <%s>, you can complain at %s^"", szAuthid, get_pcvar_num(g_pCvarBanTime), szCommand, szSite)
- }
- ColorChat(0, "^3%s ^4has been banned for ^3Kz Hack Custom ^4!!", szName)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement