Created
December 27, 2015 20:11
-
-
Save seroff/5a28dcebae75cf7828e4 to your computer and use it in GitHub Desktop.
AMX Plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <amxmodx> | |
#include <amxmisc> | |
#include <fakemeta> | |
#include <hamsandwich> | |
#include <colorchat> | |
new Perfect_Jump[33],g_iJumpCount[33],g_iDuckCount[33],GroundFrame[33],War_Bhop[33]; | |
public plugin_init() | |
{ | |
register_plugin("Anti-Bhop","1.8","Seroff"); | |
register_cvar("Check_Bhop", "1") | |
register_forward(FM_PlayerPreThink, "FM_PlayerPreThink_Pre"); | |
RegisterHam(Ham_Player_Jump, "player", "CPlayer__Jump_Post", .Post = true); | |
} | |
public CPlayer__Jump_Post(id) | |
{ | |
if(!is_user_alive(id) || ~pev(id, pev_flags) & FL_ONGROUND || pev(id, pev_oldbuttons) & IN_JUMP) return HAM_IGNORED; | |
static Float:flLastJumpTime[33];//,Float:Gametime;Gametime = get_gametime(); | |
if(get_gametime() - flLastJumpTime[id] < 0.5) | |
{ | |
Perfect_Jump[id] = 0; | |
if(War_Bhop[id] >= 3 && War_Bhop[id] <= 5) | |
War_Bhop[id] -= 1; | |
} | |
flLastJumpTime[id] = get_gametime(); | |
return HAM_IGNORED; | |
} | |
public FM_PlayerPreThink_Pre(id,uc_handle,seed,admin) | |
{ | |
if(is_user_alive(id) && is_user_connected(id) && get_cvar_num("Check_Bhop_New")) | |
{ | |
new szName[32],szIP[32],players[32], pnum; | |
get_user_name(id, szName, charsmax(szName)); | |
get_user_ip(id, szIP, charsmax(szIP)); | |
get_players(players, pnum, "ch"); | |
static buttons,oldbutton,bool:on_ground; | |
buttons = pev(id, pev_button); | |
oldbutton = pev(id, pev_oldbuttons); | |
on_ground = bool:(pev(id, pev_flags) & FL_ONGROUND); | |
if(buttons & IN_JUMP && !(oldbutton & IN_JUMP)) | |
g_iJumpCount[id] += 1; | |
if(buttons & IN_DUCK && !(oldbutton & IN_DUCK)) | |
g_iDuckCount[id] += 1; | |
if(on_ground) | |
GroundFrame[id] += 1; | |
else if(GroundFrame[id]) | |
{ | |
if((GroundFrame[id] >= 1 && GroundFrame[id] <= 5) | |
&& (g_iJumpCount[id] >= 1 && g_iJumpCount[id] <= 5 | |
|| g_iJumpCount[id] >= 16)) | |
{ | |
Perfect_Jump[id] += 1; | |
if(Perfect_Jump[id] >= 3) //6 | |
{ | |
Perfect_Jump[id] = 0; | |
War_Bhop[id] += 1; | |
if(War_Bhop[id] >= 6) | |
{ | |
user_kill(id,1); | |
War_Bhop[id] = 0; | |
server_cmd("amx_ban 0 %s ^"Auto Bhop Detected^"",szIP); | |
ColorChat(0,NORMAL,"^3[Анти-Чит]^1Игрок ^4%s ^1Использует ^1[^4Auto Bhop^1]",szName); | |
log_to_file("addons/amxmodx/logs/Anti-Bhop.log", "Игрок %s использует Auto Bhop",szName); | |
} | |
if(War_Bhop[id] >= 1 && War_Bhop[id] <= 5) | |
{ | |
for(new i = 0; i < pnum; i++) | |
{ | |
admin = players[i]; | |
if(get_user_flags(admin) & ADMIN_BAN) | |
{ | |
ColorChat(admin,NORMAL,"^3[Анти-Чит]^1Игрок ^4%s ^1Использует ^1[^4Auto Bhop %d Warning^1]",szName,War_Bhop[id]); | |
} | |
} | |
} | |
} | |
} | |
else | |
{ | |
Perfect_Jump[id] = 0; | |
if(War_Bhop[id] >= 3 && War_Bhop[id] <= 5) | |
War_Bhop[id] -= 1; | |
} | |
GroundFrame[id] = 0; | |
g_iJumpCount[id] = 0; | |
g_iDuckCount[id] = 0; | |
} | |
} | |
return FMRES_IGNORED; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment