airat0708
Новичок
- Сообщения
- 2
- Реакции
- 0
всем привет. может кто помочь . ошибка при компилировании плагина афк контрол под есд хелпер. прописал в плагине все как писал Скальпель. но ошибка вылазит.
//AMXXPC compile.exe
// by the AMX Mod X Dev Team
//// afk_control.sma
//
// C:\Users\airat\Desktop\amxmodx-1.9.0-git5294-base-windows (1)\addons\amxmodx\scripting\afk_control.sma(233) : error 017: undefined symbol "pPlayer"
//
// 1 Error.
// Could not locate output file C:\Users\airat\Desktop\amxmodx-1.9.0-git5294-base-windows (1)\addons\amxmodx\scripting\compiled\afk_control.amx (compile failed).
//
// Compilation Time: 0,37 sec
// ----------------------------------------
// by the AMX Mod X Dev Team
//// afk_control.sma
//
// C:\Users\airat\Desktop\amxmodx-1.9.0-git5294-base-windows (1)\addons\amxmodx\scripting\afk_control.sma(233) : error 017: undefined symbol "pPlayer"
//
// 1 Error.
// Could not locate output file C:\Users\airat\Desktop\amxmodx-1.9.0-git5294-base-windows (1)\addons\amxmodx\scripting\compiled\afk_control.amx (compile failed).
//
// Compilation Time: 0,37 sec
// ----------------------------------------
#include ecd_helper
#include <amxmodx>
#include <amxmisc>
#include <reapi>
#include <xs>
#define CHAT_PREFIX "^1[^4AFK^1]"
// don't change this unless you know what you do
#define GET_COORDS_DELAY 1.0
enum _:cvars {
MAX_AFK_WARNS,
MAX_SPEC_WARNS,
Float:TIME_AFK_CHECK,
MIN_SPEC_PLAYERS_CHECK,
IMMUNITY_FLAGS,
TRANSFER_BOMB
}
enum coords {
Float:ORIGIN[3],
Float:ANGLES[3]
}
enum warns {
AFK,
SPEC
}
new Float:g_fCoords[MAX_PLAYERS + 1][coords];
new g_iPlayerWarn[MAX_PLAYERS + 1][warns];
new bool:g_IsBot[MAX_PLAYERS + 1];
new g_Cvar[cvars];
new g_pTimeSpecCheck;
public plugin_init()
{
register_plugin("AFK Control ReNew", "1.3", "neygomon");
register_dictionary("afk_control.txt");
RegisterHookChain(RG_CBasePlayer_Spawn, "CBasePlayer_Spawn_Post", true);
RegisterHookChain(RG_CBasePlayer_Killed, "CBasePlayer_Killed_Post", true);
bind_pcvar_num(
create_cvar(
"afk_max_afk_warns",
"3",
.description = fmt("%L", LANG_SERVER, "DESC_MAX_AFK_WARNS"),
.has_min = true,
.min_val = 1.0
),
g_Cvar[MAX_AFK_WARNS]
);
bind_pcvar_num(
create_cvar(
"afk_max_spec_warns",
"2",
.description = fmt("%L", LANG_SERVER, "DESC_MAX_SPEC_WARNS"),
.has_min = true,
.min_val = 1.0
),
g_Cvar[MAX_SPEC_WARNS]
);
bind_pcvar_num(
create_cvar(
"afk_min_spec_players",
"30",
.description = fmt("%L", LANG_SERVER, "DESC_MIN_SPEC_PLRS")
),
g_Cvar[MIN_SPEC_PLAYERS_CHECK]
);
bind_pcvar_num(
create_cvar(
"afk_transfer_bomb",
"1",
.description = fmt("%L", LANG_SERVER, "DESC_TRANSFER_BOMB")
),
g_Cvar[TRANSFER_BOMB]
);
bind_pcvar_float(
create_cvar(
"afk_time_afk_check",
"15.0",
.description = fmt("%L", LANG_SERVER, "DESC_TIME_AFK_CHECK"),
.has_min = true,
.min_val = 5.0
),
g_Cvar[TIME_AFK_CHECK]
);
g_pTimeSpecCheck = create_cvar(
"afk_time_spec_check",
"15.0",
.description = fmt("%L", LANG_SERVER, "DESC_TIME_SPEC_CHECK"),
.has_min = true,
.min_val = 10.0
)
new pCvar = create_cvar(
"afk_immunity_flags",
"a",
.description = fmt("%L", LANG_SERVER, "DESC_IMMUNITY_FLAGS")
);
AutoExecConfig();
hook_cvar_change(pCvar, "hook__cvar_change");
new szFlags[32]; get_pcvar_string(pCvar, szFlags, charsmax(szFlags));
read__flags(szFlags);
}
public OnConfigsExecuted() {
set_task_ex(get_pcvar_float(g_pTimeSpecCheck), "check_spectators", .flags = SetTask_Repeat);
}
public client_putinserver(id)
{
g_IsBot[id] = bool
is_user_hltv(id) || is_user_bot(id));
g_iPlayerWarn[id][SPEC] = 0;
}
public client_disconnected(id)
remove_task(id);
public hook__cvar_change(pCvar, szOldValue[], szNewValue[])
read__flags(szNewValue);
public CBasePlayer_Spawn_Post(const id)
{
if(g_IsBot[id] || !is_user_alive(id) || get_user_flags(id) & g_Cvar[IMMUNITY_FLAGS])
return;
g_iPlayerWarn[id][AFK] = 0;
remove_task(id);
set_task(GET_COORDS_DELAY, "get_coords", id);
}
public get_coords(id) {
if(!is_user_alive(id)) {
return;
}
get_entvar(id, var_origin, g_fCoords[id][ORIGIN]);
get_entvar(id, var_v_angle, g_fCoords[id][ANGLES]);
set_task_ex(g_Cvar[TIME_AFK_CHECK], "check_afk", id, .flags = SetTask_Repeat);
}
public CBasePlayer_Killed_Post(const id)
remove_task(id);
public check_afk(id)
{
if(!is_user_alive(id))
remove_task(id);
else
{
static Float:fOrigin[3], Float:fAngles[3];
get_entvar(id, var_origin, fOrigin);
get_entvar(id, var_v_angle, fAngles);
if(!xs_vec_equal(g_fCoords[id][ORIGIN], fOrigin) || !xs_vec_equal(g_fCoords[id][ANGLES], fAngles))
{
g_iPlayerWarn[id][AFK] = 0;
xs_vec_copy(fOrigin, g_fCoords[id][ORIGIN]);
xs_vec_copy(fAngles, g_fCoords[id][ANGLES]);
}
else if(++g_iPlayerWarn[id][AFK] >= g_Cvar[MAX_AFK_WARNS])
{
user_kill(id, 1);
rg_internal_cmd(id, "jointeam", "6");
rg_send_audio(id, "sound/events/friend_died.wav");
client_print_color(0, id, "%s %L", CHAT_PREFIX, LANG_PLAYER, "MSG_TRANSFER_PLAYER", id);
}
else
{
if(rg_has_item_by_name(id, "weapon_c4"))
{
client_print_color(0, id, "%s %L", CHAT_PREFIX, LANG_PLAYER, "MSG_TRANSFER_BOMB", id);
if(
g_Cvar[TRANSFER_BOMB]
&&
get_playersnum_ex(GetPlayers_ExcludeDead|GetPlayers_MatchTeam, "TERRORIST") > 1
) {
rg_transfer_c4(id, 0);
}
else {
rg_drop_items_by_slot(id, C4_SLOT);
}
}
rg_send_audio(id, "sound/events/tutor_msg.wav");
client_print_color(id, print_team_default, "%s %l", CHAT_PREFIX, "MSG_PLAYER_CHECK_ACTIVITY", g_iPlayerWarn[id][AFK], g_Cvar[MAX_AFK_WARNS]);
}
}
}
public check_spectators()
{
if(get_playersnum() < g_Cvar[MIN_SPEC_PLAYERS_CHECK])
return;
new players[MAX_PLAYERS], pnum;
get_players_ex(players, pnum, GetPlayers_ExcludeBots|GetPlayers_ExcludeHLTV|GetPlayers_ExcludeAlive);
for(new i, id; i < pnum; i++)
{
id = players;
if(get_user_flags(id) & g_Cvar[IMMUNITY_FLAGS])
continue;
if(TEAM_SPECTATOR > get_member(id, m_iTeam) > TEAM_UNASSIGNED)
{
if(
get_member(id, m_iMenu) != Menu_ChooseAppearance
&&
get_member(id, m_iJoiningState) != PICKINGTEAM
)
{
continue
}
}
if(++g_iPlayerWarn[id][SPEC] >= g_Cvar[MAX_SPEC_WARNS])
{
client_print_color(0, id, "%s %L", CHAT_PREFIX, LANG_PLAYER, "MSG_KICK_SPEC_REASON", id);
#if defined rh_drop_client
rh_drop_client(id, fmt("%L", id, "MSG_KICK_PLAYER_REASON"));
#else
server_cmd("kick #%d %L", get_user_userid(id), id, "MSG_KICK_PLAYER_REASON");
#endif
if (ecd_is_scanning(pPlayer)) { continue; } // игрок проходит сканирование, пропускаем
}
}
}
read__flags(str[])
g_Cvar[IMMUNITY_FLAGS] = read_flags(str);
#include <amxmodx>
#include <amxmisc>
#include <reapi>
#include <xs>
#define CHAT_PREFIX "^1[^4AFK^1]"
// don't change this unless you know what you do
#define GET_COORDS_DELAY 1.0
enum _:cvars {
MAX_AFK_WARNS,
MAX_SPEC_WARNS,
Float:TIME_AFK_CHECK,
MIN_SPEC_PLAYERS_CHECK,
IMMUNITY_FLAGS,
TRANSFER_BOMB
}
enum coords {
Float:ORIGIN[3],
Float:ANGLES[3]
}
enum warns {
AFK,
SPEC
}
new Float:g_fCoords[MAX_PLAYERS + 1][coords];
new g_iPlayerWarn[MAX_PLAYERS + 1][warns];
new bool:g_IsBot[MAX_PLAYERS + 1];
new g_Cvar[cvars];
new g_pTimeSpecCheck;
public plugin_init()
{
register_plugin("AFK Control ReNew", "1.3", "neygomon");
register_dictionary("afk_control.txt");
RegisterHookChain(RG_CBasePlayer_Spawn, "CBasePlayer_Spawn_Post", true);
RegisterHookChain(RG_CBasePlayer_Killed, "CBasePlayer_Killed_Post", true);
bind_pcvar_num(
create_cvar(
"afk_max_afk_warns",
"3",
.description = fmt("%L", LANG_SERVER, "DESC_MAX_AFK_WARNS"),
.has_min = true,
.min_val = 1.0
),
g_Cvar[MAX_AFK_WARNS]
);
bind_pcvar_num(
create_cvar(
"afk_max_spec_warns",
"2",
.description = fmt("%L", LANG_SERVER, "DESC_MAX_SPEC_WARNS"),
.has_min = true,
.min_val = 1.0
),
g_Cvar[MAX_SPEC_WARNS]
);
bind_pcvar_num(
create_cvar(
"afk_min_spec_players",
"30",
.description = fmt("%L", LANG_SERVER, "DESC_MIN_SPEC_PLRS")
),
g_Cvar[MIN_SPEC_PLAYERS_CHECK]
);
bind_pcvar_num(
create_cvar(
"afk_transfer_bomb",
"1",
.description = fmt("%L", LANG_SERVER, "DESC_TRANSFER_BOMB")
),
g_Cvar[TRANSFER_BOMB]
);
bind_pcvar_float(
create_cvar(
"afk_time_afk_check",
"15.0",
.description = fmt("%L", LANG_SERVER, "DESC_TIME_AFK_CHECK"),
.has_min = true,
.min_val = 5.0
),
g_Cvar[TIME_AFK_CHECK]
);
g_pTimeSpecCheck = create_cvar(
"afk_time_spec_check",
"15.0",
.description = fmt("%L", LANG_SERVER, "DESC_TIME_SPEC_CHECK"),
.has_min = true,
.min_val = 10.0
)
new pCvar = create_cvar(
"afk_immunity_flags",
"a",
.description = fmt("%L", LANG_SERVER, "DESC_IMMUNITY_FLAGS")
);
AutoExecConfig();
hook_cvar_change(pCvar, "hook__cvar_change");
new szFlags[32]; get_pcvar_string(pCvar, szFlags, charsmax(szFlags));
read__flags(szFlags);
}
public OnConfigsExecuted() {
set_task_ex(get_pcvar_float(g_pTimeSpecCheck), "check_spectators", .flags = SetTask_Repeat);
}
public client_putinserver(id)
{
g_IsBot[id] = bool
g_iPlayerWarn[id][SPEC] = 0;
}
public client_disconnected(id)
remove_task(id);
public hook__cvar_change(pCvar, szOldValue[], szNewValue[])
read__flags(szNewValue);
public CBasePlayer_Spawn_Post(const id)
{
if(g_IsBot[id] || !is_user_alive(id) || get_user_flags(id) & g_Cvar[IMMUNITY_FLAGS])
return;
g_iPlayerWarn[id][AFK] = 0;
remove_task(id);
set_task(GET_COORDS_DELAY, "get_coords", id);
}
public get_coords(id) {
if(!is_user_alive(id)) {
return;
}
get_entvar(id, var_origin, g_fCoords[id][ORIGIN]);
get_entvar(id, var_v_angle, g_fCoords[id][ANGLES]);
set_task_ex(g_Cvar[TIME_AFK_CHECK], "check_afk", id, .flags = SetTask_Repeat);
}
public CBasePlayer_Killed_Post(const id)
remove_task(id);
public check_afk(id)
{
if(!is_user_alive(id))
remove_task(id);
else
{
static Float:fOrigin[3], Float:fAngles[3];
get_entvar(id, var_origin, fOrigin);
get_entvar(id, var_v_angle, fAngles);
if(!xs_vec_equal(g_fCoords[id][ORIGIN], fOrigin) || !xs_vec_equal(g_fCoords[id][ANGLES], fAngles))
{
g_iPlayerWarn[id][AFK] = 0;
xs_vec_copy(fOrigin, g_fCoords[id][ORIGIN]);
xs_vec_copy(fAngles, g_fCoords[id][ANGLES]);
}
else if(++g_iPlayerWarn[id][AFK] >= g_Cvar[MAX_AFK_WARNS])
{
user_kill(id, 1);
rg_internal_cmd(id, "jointeam", "6");
rg_send_audio(id, "sound/events/friend_died.wav");
client_print_color(0, id, "%s %L", CHAT_PREFIX, LANG_PLAYER, "MSG_TRANSFER_PLAYER", id);
}
else
{
if(rg_has_item_by_name(id, "weapon_c4"))
{
client_print_color(0, id, "%s %L", CHAT_PREFIX, LANG_PLAYER, "MSG_TRANSFER_BOMB", id);
if(
g_Cvar[TRANSFER_BOMB]
&&
get_playersnum_ex(GetPlayers_ExcludeDead|GetPlayers_MatchTeam, "TERRORIST") > 1
) {
rg_transfer_c4(id, 0);
}
else {
rg_drop_items_by_slot(id, C4_SLOT);
}
}
rg_send_audio(id, "sound/events/tutor_msg.wav");
client_print_color(id, print_team_default, "%s %l", CHAT_PREFIX, "MSG_PLAYER_CHECK_ACTIVITY", g_iPlayerWarn[id][AFK], g_Cvar[MAX_AFK_WARNS]);
}
}
}
public check_spectators()
{
if(get_playersnum() < g_Cvar[MIN_SPEC_PLAYERS_CHECK])
return;
new players[MAX_PLAYERS], pnum;
get_players_ex(players, pnum, GetPlayers_ExcludeBots|GetPlayers_ExcludeHLTV|GetPlayers_ExcludeAlive);
for(new i, id; i < pnum; i++)
{
id = players;
if(get_user_flags(id) & g_Cvar[IMMUNITY_FLAGS])
continue;
if(TEAM_SPECTATOR > get_member(id, m_iTeam) > TEAM_UNASSIGNED)
{
if(
get_member(id, m_iMenu) != Menu_ChooseAppearance
&&
get_member(id, m_iJoiningState) != PICKINGTEAM
)
{
continue
}
}
if(++g_iPlayerWarn[id][SPEC] >= g_Cvar[MAX_SPEC_WARNS])
{
client_print_color(0, id, "%s %L", CHAT_PREFIX, LANG_PLAYER, "MSG_KICK_SPEC_REASON", id);
#if defined rh_drop_client
rh_drop_client(id, fmt("%L", id, "MSG_KICK_PLAYER_REASON"));
#else
server_cmd("kick #%d %L", get_user_userid(id), id, "MSG_KICK_PLAYER_REASON");
#endif
if (ecd_is_scanning(pPlayer)) { continue; } // игрок проходит сканирование, пропускаем
}
}
}
read__flags(str[])
g_Cvar[IMMUNITY_FLAGS] = read_flags(str);