- Ошибка
-
Desktop\scripting\include\anticheat/ac_bhop.inl(459) : error 035: argument type mismatch (argument 3)
Desktop\scripting\include\anticheat/ac_bhop.inl(460 -- 462) : error 088: number of arguments does not
- Компилятор
- Локальный
- Amx Mod X
- 1.9.0
- Исходный код
-
/* Here you can edit bhop detection settings */
#define BHOP_SESSION 100
#define BUNNYJUMP_MAX_SPEED_FACTOR 1.2
//#define ACT_HOP 6
// Ground Equal [g]
#define MAX_GE_BHOPS_IAR 19
#define MAX_GE_BHOPS_PERCENT 72.0
// Perfect Bhops [p]
#define MAX_PERFECTBHOPS_IAR 19
#define MAX_PERFECTBHOPS_SESSION_PERCENT 72.0
// Ideally Distributed Bhops [d]
#define MAX_DISTR_BHOPS_PERCENT 93.0
#define MAX_BHOP_WARNINGS 3
// Jump Commands IAR (+jump spam) [s]
#define MAX_JUMP_CMDS_IAR 200
// Jump Command Ratio [c]
#define MIN_JUMP_CMDS_RATIO 2.5
/* Here you stop */
/*
*
*/
/* Total Bhops */
new g_iBhops[MAX_PLAYERS_ARR];
/* Ground Equal
* ARRAY - FOG
* 0 - 1
* 1 - 2
* 2 - 3, 4, 5
*/
new g_iBhopsFOG[MAX_PLAYERS_ARR][3];
new Float:g_flGE_BhopsPercent[MAX_PLAYERS_ARR][3];
new g_iGE_BhopsIAR[MAX_PLAYERS_ARR][3];
new g_iGE_BhopsWarns[MAX_PLAYERS_ARR];
/* Perfect Bhops */
new g_iPerfectBhops[MAX_PLAYERS_ARR];
new Float:g_flPerfectBhopsPercent[MAX_PLAYERS_ARR];
new g_iPerfectBhopsIAR[MAX_PLAYERS_ARR];
new g_iPerfectBhopsWarns[MAX_PLAYERS_ARR];
/* Ideally Distributed Bhops */
new g_bDistrBhopCheck;
new g_iDistrBhopFrames[MAX_PLAYERS_ARR];
new g_iDistrBhops[MAX_PLAYERS_ARR];
new Float:g_flDistrBhopsPercent[MAX_PLAYERS_ARR];
new g_iDistrBhopsWarns[MAX_PLAYERS_ARR];
/*
* Ground Bhops Warnings
* Perfect Bhops Warnings
* Ideally distributed bhops Warnings
*/
new g_iBhopWarns[MAX_PLAYERS_ARR];
/* Jump Commands IAR (+jump spam) */
new g_iJumpCmdsIAR[MAX_PLAYERS_ARR];
new g_iMaxJumpCmdsIAR[MAX_PLAYERS_ARR];
/* Jump Commands Ratio */
new g_iJumpCmds[MAX_PLAYERS_ARR];
new Float:g_flJumpCmdsRatio[MAX_PLAYERS_ARR];
new s_Name[32], s_Player[10], s_Data[6], i_Access, i_Callback; // MENUUUUU
ac_bhop_init()
{
//register_clcmd("ac_bhop_stats", "ClCmdBhopStats");
register_clcmd("bhop_menu", "Bhop_menu"); //MENUUUUUUUUUU
register_clcmd("bhopstats_menu", "ClCmdBhopStats");
}
public Bhop_menu(id)
{
new BH_Menu = menu_create("\yAnti Cheat Helper^n\dGet bhop stats ", "bhmenu_handler");
new s_Players[32], i_Num, i_Player;
get_players(s_Players, i_Num);
for (new i; i < i_Num; i++) // Цикл по всем игрокам
{
i_Player = s_Players[i]; // Сохраняем текущего игрока в i_Player
get_user_name(i_Player, s_Name, charsmax(s_Name)); // Получаем имя и ID игрока
num_to_str(i_Player, s_Player, charsmax(s_Player)); // Получаем имя и ID игрока
menu_additem(BH_Menu, s_Name, s_Player, 0); // Добавляем опцию по данному игроку
}
menu_display(id, BH_Menu, 0); // Мы сформировали меню из игроков, присутствующих на сервере, теперь выводим его
}
public bhmenu_handler(id, bhmenu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(bhmenu);
return PLUGIN_HANDLED;
}
new i_Player = str_to_num(s_Data); // Получаем ID игрока, который был выбран в меню
menu_item_getinfo(bhmenu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback);
// Проверяем, если игрок живой
if (is_user_connected(i_Player))
// Устанавливаем его здоровье в 100 HP
ClCmdBhopStats(id);
menu_destroy(bhmenu);
return PLUGIN_HANDLED;
}
ac_bhop_disconnect(id)
{
g_iBhops[id] = 0;
for (new i = 0; i < 3; i++)
{
g_iBhopsFOG[id][i] = 0;
g_flGE_BhopsPercent[id][i] = 0.0;
g_iGE_BhopsIAR[id][i] = 0;
}
g_iGE_BhopsWarns[id] = 0;
g_iPerfectBhops[id] = 0;
g_flPerfectBhopsPercent[id] = 0.0;
g_iPerfectBhopsIAR[id] = 0;
g_iPerfectBhopsWarns[id] = 0;
clr_bit(g_bDistrBhopCheck, id);
g_iDistrBhopFrames[id] = 0;
g_iDistrBhops[id] = 0;
g_flDistrBhopsPercent[id] = 0.0;
g_iDistrBhopsWarns[id] = 0;
g_iBhopWarns[id] = 0;
g_iJumpCmdsIAR[id] = 0;
g_iMaxJumpCmdsIAR[id] = 0;
g_iJumpCmds[id] = 0;
g_flJumpCmdsRatio[id] = 0.0;
}
ac_bhop_PlayerPreThink(id)
{
static Float:vVelocity[3], Float:flSpeed, Float:flOldSpeed[MAX_PLAYERS_ARR], Float:flMaxSpeed, Float:flMaxPreStrafe;
pev(id, pev_velocity, vVelocity);
vVelocity[2] = 0.0;
flSpeed = vector_length(vVelocity);
pev(id, pev_maxspeed, flMaxSpeed);
flMaxPreStrafe = flMaxSpeed * BUNNYJUMP_MAX_SPEED_FACTOR;
static iGroundFrames[MAX_PLAYERS_ARR], iOldGroundFrames[MAX_PLAYERS_ARR];
if (g_iFlags[id] & FL_ONGROUND)
{
iGroundFrames[id]++;
if (g_iButtons[id] & IN_JUMP && ~g_iOldButtons[id] & IN_JUMP)
iOldGroundFrames[id] = iGroundFrames[id];
if (iGroundFrames[id] <= 5 && g_iButtons[id] & IN_JUMP && ~g_iOldButtons[id] & IN_JUMP)
{
g_iBhops[id]++;
switch (iGroundFrames[id])
{
case 1:
{
g_iBhopsFOG[id][0]++;
g_iGE_BhopsIAR[id][0]++;
if (g_iGE_BhopsIAR[id][0] >= MAX_GE_BHOPS_IAR)
{
g_iGE_BhopsWarns[id]++;
g_iBhopWarns[id]++;
if (g_iBhopWarns[id] >= MAX_BHOP_WARNINGS)
{
PunishPlayer(id, "BhopHack");
return;
}
g_iGE_BhopsIAR[id][0] = 0;
}
if (g_iGE_BhopsIAR[id][1])
g_iGE_BhopsIAR[id][1] = 0;
if (g_iGE_BhopsIAR[id][2])
g_iGE_BhopsIAR[id][2] = 0;
}
case 2:
{
g_iBhopsFOG[id][1]++;
g_iGE_BhopsIAR[id][1]++;
if (g_iGE_BhopsIAR[id][1] >= MAX_GE_BHOPS_IAR)
{
g_iGE_BhopsWarns[id]++;
g_iBhopWarns[id]++;
if (g_iBhopWarns[id] >= MAX_BHOP_WARNINGS)
{
PunishPlayer(id, "BhopHack");
return;
}
g_iGE_BhopsIAR[id][1] = 0;
}
if (g_iGE_BhopsIAR[id][0])
g_iGE_BhopsIAR[id][0] = 0;
if (g_iGE_BhopsIAR[id][2])
g_iGE_BhopsIAR[id][2] = 0;
}
case 3, 4, 5:
{
g_iBhopsFOG[id][2]++;
g_iGE_BhopsIAR[id][2]++;
if (g_iGE_BhopsIAR[id][2] >= MAX_GE_BHOPS_IAR)
{
g_iGE_BhopsWarns[id]++;
g_iBhopWarns[id]++;
if (g_iBhopWarns[id] >= MAX_BHOP_WARNINGS)
{
PunishPlayer(id, "BhopHack");
return;
}
g_iGE_BhopsIAR[id][2] = 0;
}
if (g_iGE_BhopsIAR[id][0])
g_iGE_BhopsIAR[id][0] = 0;
if (g_iGE_BhopsIAR[id][1])
g_iGE_BhopsIAR[id][1] = 0;
}
}
for (new i = 0; i < 3; i++)
g_flGE_BhopsPercent[id][i] = float(g_iBhopsFOG[id][i]) / float(g_iBhops[id]) * 100.0;
if (!get_bit(g_bDistrBhopCheck, id))
set_bit(g_bDistrBhopCheck, id);
if (flSpeed < flMaxPreStrafe && (iGroundFrames[id] == 1 || iGroundFrames[id] >= 2 && flOldSpeed[id] > flMaxPreStrafe))
{
g_iPerfectBhops[id]++;
g_iPerfectBhopsIAR[id]++;
if (g_iPerfectBhopsIAR[id] % MAX_PERFECTBHOPS_IAR == 0)
{
g_iPerfectBhopsWarns[id]++;
g_iBhopWarns[id]++;
if (g_iBhopWarns[id] >= MAX_BHOP_WARNINGS)
{
PunishPlayer(id, "BhopHack");
return;
}
}
}
else
{
if (g_iPerfectBhopsIAR[id])
g_iPerfectBhopsIAR[id] = 0;
}
g_flPerfectBhopsPercent[id] = float(g_iPerfectBhops[id]) / float(g_iBhops[id]) * 100.0;
g_flDistrBhopsPercent[id] = float(g_iDistrBhops[id]) / float(g_iBhops[id]) * 100.0;
g_flJumpCmdsRatio[id] = float(g_iJumpCmds[id]) / float(g_iBhops[id]);
if (g_iBhops[id] >= BHOP_SESSION)
{
for (new i = 0; i < 3; i++)
{
if (g_flGE_BhopsPercent[id][i] >= MAX_GE_BHOPS_PERCENT)
{
g_iGE_BhopsWarns[id]++;
g_iBhopWarns[id]++;
if (g_iBhopWarns[id] >= MAX_BHOP_WARNINGS)
{
PunishPlayer(id, "BhopHack");
return;
}
}
}
if (g_flPerfectBhopsPercent[id] >= MAX_PERFECTBHOPS_SESSION_PERCENT)
{
g_iPerfectBhopsWarns[id]++;
g_iBhopWarns[id]++;
if (g_iBhopWarns[id] >= MAX_BHOP_WARNINGS)
{
PunishPlayer(id, "BhopHack");
return;
}
}
if (g_flDistrBhopsPercent[id] >= MAX_DISTR_BHOPS_PERCENT)
{
g_iDistrBhopsWarns[id]++;
g_iBhopWarns[id]++;
if (g_iBhopWarns[id] >= MAX_BHOP_WARNINGS)
{
PunishPlayer(id, "BhopHack");
return;
}
}
if (!g_iBhopsFOG[id][2])
{
if (g_flDistrBhopsPercent[id] <= 20.0 && g_flJumpCmdsRatio[id] >= 4.5)//dc
g_iBhopWarns[id]++;
if (g_flJumpCmdsRatio[id] <= MIN_JUMP_CMDS_RATIO)//c
{
PunishPlayer(id, "BhopHack");
return;
}
}
for (new i = 0; i < 3; i++)
{
g_iBhopsFOG[id][i] = 0;
g_flGE_BhopsPercent[id][i] = 0.0;
g_iGE_BhopsIAR[id][i] = 0;
}
g_flPerfectBhopsPercent[id] = 0.0;
if (g_iPerfectBhops[id])
g_iPerfectBhops[id] = 0;
g_flDistrBhopsPercent[id] = 0.0;
g_iDistrBhops[id] = 0;
g_iJumpCmds[id] = 0;
g_flJumpCmdsRatio[id] = 0.0;
g_iMaxJumpCmdsIAR[id] = 0;
g_iBhops[id] = 0;
}
}
}
else
{
if (iGroundFrames[id])
iGroundFrames[id] = 0;
}
static iFramesWithoutJumpCmds[MAX_PLAYERS_ARR];
if (g_iButtons[id] & IN_JUMP && ~g_iOldButtons[id] & IN_JUMP)
{
if (iFramesWithoutJumpCmds[id])
iFramesWithoutJumpCmds[id] = 0;
g_iJumpCmdsIAR[id]++;
if (g_iJumpCmdsIAR[id] > g_iMaxJumpCmdsIAR[id])
g_iMaxJumpCmdsIAR[id] = g_iJumpCmdsIAR[id];
if (g_iJumpCmdsIAR[id] >= MAX_JUMP_CMDS_IAR)
{
PunishPlayer(id, "BhopHack");
return;
}
if (iOldGroundFrames[id] && iOldGroundFrames[id] <= 5)
g_iJumpCmds[id]++;
}
else
{
iFramesWithoutJumpCmds[id]++;
if (iFramesWithoutJumpCmds[id] >= 5)
{
if (g_iJumpCmdsIAR[id])
g_iJumpCmdsIAR[id] = 0;
}
}
if (iFramesWithoutJumpCmds[id] <= 1)
{
g_iDistrBhopFrames[id]++;
if (iOldGroundFrames[id] && iOldGroundFrames[id] <= 5 && get_bit(g_bDistrBhopCheck, id) && g_iDistrBhopFrames[id] >= 8)
{
g_iDistrBhops[id]++;
clr_bit(g_bDistrBhopCheck, id);
g_iDistrBhopFrames[id] = 0;
}
}
else
{
if (g_iDistrBhopFrames[id])
g_iDistrBhopFrames[id] = 0;
}
flOldSpeed[id] = flSpeed;
}
public ClCmdBhopStats(id)
{
if (~get_user_flags(id) & ADMIN_ACCESS)
{
client_print(id, print_console, "You have no access to that command");
return PLUGIN_HANDLED;
}
new szArg[32];
read_argv(1, szArg, charsmax(szArg));
if (szArg[0] == EOS)
return PLUGIN_HANDLED;
new iPlayer = cmd_target(id, szArg, CMDTARGET_ALLOW_SELF | CMDTARGET_OBEY_IMMUNITY | CMDTARGET_NO_BOTS);
if (!iPlayer)
return PLUGIN_HANDLED;
new szName[32];
get_user_name(iPlayer, szName, MAX_NAME_LENGTH - 1);
new szAuthID[32];
get_user_authid(iPlayer, szAuthID, charsmax(szAuthID));
new szIP[21];
get_user_ip(id, szIP, charsmax(szIP), 1);
new bhstats_Menu = menu_create("\yBhop statistics ^n\d%s (%s | %s)", "bhstatsmenu_handler", szName, szAuthID, szIP);
menu_additem(bhstats_Menu, "\wRefresh\d^n^nBhops: %d^nFOG 1: %d|%d|%.2f%% ^nFOG 2:%d|%d|%.2f%% ^nFOG 3: %d|%d|%.2f%% ^nGE_BHopWarns: %d ^nPerfect Bhops: %d|%.2f%%|%d ^nIdeally Distr. Bhops: %d|%.2f%%|%d ^nTotal Bhop Warnings: %d ^nJump Cmds. Ratio: %.2f ^nMax Jump Cmds. IAR: %d", "1", 0,
g_iBhops[iPlayer],
g_iBhopsFOG[iPlayer][0], g_iGE_BhopsIAR[iPlayer][0], g_flGE_BhopsPercent[iPlayer][0],
g_iBhopsFOG[iPlayer][1], g_iGE_BhopsIAR[iPlayer][1], g_flGE_BhopsPercent[iPlayer][1],
g_iBhopsFOG[iPlayer][2], g_iGE_BhopsIAR[iPlayer][2], g_flGE_BhopsPercent[iPlayer][2],
g_iGE_BhopsWarns[iPlayer],
g_iPerfectBhops[iPlayer], g_flPerfectBhopsPercent[iPlayer], g_iPerfectBhopsWarns[iPlayer],
g_iDistrBhops[iPlayer], g_flDistrBhopsPercent[iPlayer], g_iDistrBhopsWarns[iPlayer],
g_iBhopWarns[iPlayer],
g_flJumpCmdsRatio[iPlayer],
g_iMaxJumpCmdsIAR[iPlayer]);
// Устанавливаем свойства меню
menu_setprop(bhstats_Menu, MPROP_EXIT, MEXIT_ALL);
// Отображение меню игроку
menu_display(id, bhstats_Menu, 0);
client_print(id, print_console, "~ BHOP STATS ~");
client_print(id, print_console, "Player: %s | %s | %s", szName, szAuthID, szIP);
client_print(id, print_console, "~");
client_print(id, print_console, "Bhops: %d", g_iBhops[iPlayer]);
client_print(id, print_console, "~");
client_print(id, print_console, "FOG: %d|%d|%.2f%% | %d|%d|%.2f%% | %d|%d|%.2f%% | %d",
g_iBhopsFOG[iPlayer][0], g_iGE_BhopsIAR[iPlayer][0], g_flGE_BhopsPercent[iPlayer][0],
g_iBhopsFOG[iPlayer][1], g_iGE_BhopsIAR[iPlayer][1], g_flGE_BhopsPercent[iPlayer][1],
g_iBhopsFOG[iPlayer][2], g_iGE_BhopsIAR[iPlayer][2], g_flGE_BhopsPercent[iPlayer][2],
g_iGE_BhopsWarns[iPlayer]);
client_print(id, print_console, "~");
client_print(id, print_console, "Perfect Bhops: %d|%.2f%%|%d",
g_iPerfectBhops[iPlayer], g_flPerfectBhopsPercent[iPlayer], g_iPerfectBhopsWarns[iPlayer]);
client_print(id, print_console, "~");
client_print(id, print_console, "Ideally Distr. Bhops: %d|%.2f%%|%d", g_iDistrBhops[iPlayer], g_flDistrBhopsPercent[iPlayer], g_iDistrBhopsWarns[iPlayer]);
client_print(id, print_console, "~");
client_print(id, print_console, "Total Bhop Warnings: %d", g_iBhopWarns[iPlayer]);
client_print(id, print_console, "~");
client_print(id, print_console, "Jump Cmds. Ratio: %.2f", g_flJumpCmdsRatio[iPlayer]);
client_print(id, print_console, "~");
client_print(id, print_console, "Max Jump Cmds. IAR: %d", g_iMaxJumpCmdsIAR[iPlayer]);
client_print(id, print_console, "~ BHOP STATS ~");
return PLUGIN_HANDLED;
}
// Создадим теперь функцию обработки действий меню
public bhstatsmenu_handler(id, menu, item)
{
// Если игрок нажал выход из меню
if (item == MENU_EXIT)
{
// Уничтожение меню
menu_destroy(menu);
return PLUGIN_HANDLED;
}
// Теперь создадим переменные, необходимые для получения информации о меню и нажатой опции
new s_Data[6], s_Name[64], i_Access, i_Callback;
// Получаем информацию об опции
menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback);
// Если посмотреть раньше на использовании menu_additem, то можно увидеть, что мы посылали некоторую информацию
// В данном случае вся информация - целочисленная
new i_Key = str_to_num(s_Data);
// Теперь найдем, какая именно опция была использована
switch(i_Key)
{
case 1:
{
ClCmdBhopStats(id);
// Уничтожение меню
menu_destroy(menu);
return PLUGIN_HANDLED;
}
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}
Хотел сделать вывод статистики bhop в меню. Не получается скомпилировать.
Код - инклуд
вложение - основной плагин
Код - инклуд
вложение - основной плагин
В этой теме было размещено решение! Перейти к решению.
Вложения
-
12.1 KB Просмотры: 205