Участник
Пользователь
- Сообщения
- 101
- Реакции
- 18
- Ошибка
-
L 04/19/2024 - 16:57:45: [AMXX] Displaying debug trace (plugin "awp_limiter.amxx", version "1.4.0")
L 04/19/2024 - 16:57:45: [AMXX] Run time error 10: native error (native "TrieSetCell")
L 04/19/2024 - 16:57:45: [AMXX] [0] awp_limiter.sma::client_disconnected (line 331)
L 04/19/2024 - 16:57:45: Invalid map handle provided (0)
- ОС
- Linux
- Amx Mod X
-
AMX Mod X 1.9.0.5294 (http://www.amxmodx.org)
Authors:
David "BAILOPAN" Anderson, Pavol "PM OnoTo" Marko
Felix "SniperBeamer" Geyer, Jonny "Got His Gun" Bergstrom
Lukasz "SidLuke" Wlasinski, Christian "Basic-Master" Hammacher
Borja "faluco" Ferrer, Scott "DS" Ehlert
Compiled: Dec 3 2021 15:54:56
Built from: https://github.com/alliedmodders/amxmodx/commit/363871a
Build ID: 5294:363871a
Core mode: JIT+ASM32
- Билд
-
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.13.0.813-dev-mpatch
Build date: 15:28:10 Mar 13 2024 (3623)
Build from: https://github.com/dreamstalker/rehlds/commit/05f4a27
- ReGamedll
-
ReGameDLL version: 5.26.0.668-dev
Build date: 19:02:48 Dec 31 2023
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/d3c0ec8
- Версия Metamod
-
Metamod-r v1.3.0.138, API (5:13)
Metamod-r build: 11:50:32 Nov 28 2023
Metamod-r from: https://github.com/theAsmodai/metamod-r/commit/5179c25
- Список метамодулей
-
Currently loaded plugins:
description stat pend file vers src load unload
[ 1] Reunion RUN - reunion_mm_i386.so v0.1.92d ini Start Never
[ 2] Ultimate Unprecacher RUN - unprecacher_i386.so vBeta 2.5.3 ini Chlvl Chlvl
[ 3] AMX Mod X RUN - amxmodx_mm_i386.so v1.9.0.5294 ini Start ANY
[ 4] Revoice RUN - revoice_plus_mm.so v2.0.5 ini ANY Never
[ 5] HitBox Fix RUN - hitbox_fix_mm_i386.so v1.1.5 ini Start ANY
[ 6] ReSemiclip RUN - resemiclip_mm_i386.so v2.4.3 ini Chlvl ANY
[ 7] Rechecker RUN - rechecker_mm_i386.so v2.7 ini Chlvl ANY
[ 8] ReSRDetector RUN - resrdetector_mm_i386.so v0.1.0 ini Chlvl ANY
[ 9] SafeNameAndChat RUN - SafeNameAndChat.so v1.2 Beta 3 ini ANY ANY
[10] WHBlocker RUN - whblocker_mm_i386.so v1.5.697 ini Chlvl ANY
[11] ReAuthCheck RUN - reauthcheck_mm_i386.so v0.1.6 ini Start Never
[12] Accuracy Fix (ACS) RUN - accuracyfix_mm.so v1.0.7a ini ANY ANY
[13] MySQL RUN - mysql_amxx_i386.so v1.9.0.5294 pl3 ANY ANY
[14] ReAimDetector RUN - reaimdetector_amxx_i386.so v0.2.2 pl3 ANY Never
[15] Hide Cvars RUN - hidecvars_amxx_i386.so v1.0 pl3 ANY ANY
[16] AuthEmu RUN - authemu_amxx_i386.so v5.2.12.431 pl3 ANY Never
[17] FakeMeta RUN - fakemeta_amxx_i386.so v1.9.0.5294 pl3 ANY ANY
[18] IPHub Client RUN - iphubclient_amxx_i386.so v1.0.1 pl3 ANY Never
[19] GeoIP RUN - geoip_amxx_i386.so v1.9.0.5294 pl3 ANY ANY
[20] Engine RUN - engine_amxx_i386.so v1.9.0.5294 pl3 ANY ANY
[21] ReAPI RUN - reapi_amxx_i386.so v5.24.0.300-dev pl3 ANY Never
[22] Amxx Easy Http RUN - easy_http_amxx_i386.so v1.3.0 pl3 ANY ANY
[23] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.9.0.5294 pl3 ANY ANY
[24] CStrike RUN - cstrike_amxx_i386.so v1.9.0.5294 pl3 ANY ANY
[25] Fun RUN - fun_amxx_i386.so v1.9.0.5294 pl3 ANY ANY
[26] SQLite RUN - sqlite_amxx_i386.so v1.9.0.5294 pl3 ANY ANY
26 plugins, 26 running
- Список плагинов
-
Currently loaded plugins:
name version author file status
[ 1] AMXBans: Core Gm 1.6 Larte Team amxbans_core.am running
[ 2] AMXBans: Main Gm 1.6 Larte Team amxbans_main.am debug
[ 3] FreshBans 1.4.8b kanagava fresh_bans_148- running
[ 4] Bypass Guard 1.0.9 mx?! bypass_guard.am running
[ 5] [BG] Provider: IPHub-C 1.3 mx?! bg_provider_iph running
[ 6] [BG] Supervisor 0.4 mx?! bg_supervisor.a running
[ 7] [BG] Provider: GeoIP 0.3 mx?! bg_provider_geo running
[ 8] ReAimDetector API 0.2.2 ReHLDS Team reaimdetector.a running
[ 9] [190] Vanga Detector 23.07.29 SKAJIbnEJIb & Pr vanga_detector. running
[ 10] Vac Ban Status 0.0.1 Albertio vac_ban_status. running
[ 11] Ping Checker 26.0.1 RC1 h1k3 ping_checker.am running
[ 12] AuthEmu API 1.0 Dev-MS Team authemu.amxx running
[ 13] [ReAPI] AdminFreeLook 1.0 ReHLDS Team adminfreelook.a running
[ 14] Yet Another Voteban 1.8 AndrewZ/voed yet_another_vot running
[ 15] ReChecker Logging 1.0 custom rc_logging.amxx running
[ 16] Music Connection 1.0.1 Jumper Music_Connectio running
[ 17] AWP Limiter 1.4.0 Nordic Warrior awp_limiter.amx debug
[ 18] AWPL: Disabled maps 1.0.0 Nordic Warrior awp_limiter_dis running
[ 19] Weapon Model Replacer 0.1 Vaqtincha WeaponModelRepl running
[ 20] GameCMS_API 5.6.3 zhorzh78 gamecms_api_5.6 running
[ 21] GameCMS_Registration 1.5 nb zhorzh78 gamecms_registr running
[ 22] Players Menu 22.11.15 SKAJIbnEJIb & AM admincmd_rbs.am running
[ 23] CSStatsX SQL 0.7.4+2 serfreeman1337 csstatsx_sql.am running
[ 24] Rank Menu 1.1 h1k3 rankmenu.amxx running
[ 25] CSXSQL: Onlinetime Awa 0.2 serfreeman1337 csstatsx_playti running
[ 26] AES: StatsX 0.5+1 serfreeman1337 aes_statsx_cstr running
[ 27] Blinding Time 0.0.1 Albertio blinding_time.a running
[ 28] Slots Reservation 1.9.0.5294 AMXX Dev Team adminslots.amxx running
[ 29] AFK Control ReNew 1.2(a) neygomon afk_control.amx running
[ 30] Team Balance Control 1.3.9 gyxoBka TeamBalanceCont running
[ 31] [190] Ultimate Models 21.03.23 SKAJIbnEJIb ultimate_models running
[ 32] Kills Counter 0.3 serfreeman1337 kills_counter.a running
[ 33] Spectator Bots 2.1 SISA spectator_bots. running
[ 34] Menus Front-End 1.9.0.5294 AMXX Dev Team menufront.amxx running
[ 35] Commands Menu 20.06.06 SKAJIbnEJIb & AM cmdmenu_rbs.amx running
[ 36] Maps Menu 1.9.0.5294 AMXX Dev Team mapsmenu.amxx running
[ 37] Plugin Menu 1.9.0.5294 AMXX Dev Team pluginmenu.amxx running
[ 38] Reklama 20.05.2020 mx?! reklama.amxx running
[ 39] Admin Chat 1.9.0.5294 AMXX Dev Team adminchat.amxx running
[ 40] Scrolling Message 1.9.0.5294 AMXX Dev Team scrollmsg.amxx running
[ 41] Info. Messages 1.9.0.5294 AMXX Dev Team imessage.amxx running
[ 42] Chat Manager 1.1.2-16 Mistrick chatmanager.amx running
[ 43] Chat Manager: Addon 0.0.4-70 Mistrick chatmanager_add running
[ 44] FocusOnVotemap 1.2.1 Boec[SpecOPs] focus_on_votema running
[ 45] Pause Plugins 1.9.0.5294 AMXX Dev Team pausecfg.amxx running
[ 46] Stats Configuration 1.9.0.5294 AMXX Dev Team statscfg.amxx running
[ 47] StatsX 1.9.0.5294 AMXX Dev Team statsx.amxx running
[ 48] CS Stats Logging 1.9.0.5294 AMXX Dev Team stats_logging.a running
[ 49] RoundStart Speed 0.1 Vaqtincha set_speed_round running
[ 50] ADV. QUAKE SOUNDS (ENA 8.0 HATTRICK (HTTRCK AQS.amxx running
[ 51] New Dance Menu 2.4 b0t. NewDanceMenu.am running
[ 52] Parachute Lite [ReAPI] 11.0 Leo_[BH] parachute_lite. running
[ 53] Reset Score 1.0 Silenttt resetscore.amxx running
[ 54] [190] Piss RBS 20.06.06 SKAJIbnEJIb & KR piss_rbs.amxx running
[ 55] [ReAPI] Ghost after de 0.0.2 steelzzz ghost.amxx running
[ 56] unknown unknown unknown Server-Side_Smo running
[ 57] Explode Effects Remove 0.3 Vaqtincha granede_explode running
[ 58] Switch To Knife On Spa 0.2 Vaqtincha SwitchToKnifeOn running
[ 59] Grenade Info Sounds 0.1 Vaqtincha grenade_info_so running
[ 60] Grenade Animation 3rd 1.0 Prefers to be An grenade_animati running
[ 61] Advanced Kill Assists 1.5 Xelson next21_kill_ass running
[ 62] [ReAPI] Grenade Trile 1.2 Base Code: Fatih reapi_grenade_t running
[ 63] C4 GIBS 1.0 Garey c4_gibs.amxx running
[ 64] SPLESHING ON THE WATER 1.5 MayroN | KRoTaL splashing_on_th running
[ 65] [GeoIP] Connect Info 1.0.0 Nordic Warrior geoip_connect_i running
[ 66] Demo Recorder 2.4.1 F@nt0M demo_recorder.a running
[ 67] Simple Damager 2.1.0 fl0wer simple_damager. running
[ 68] Hud_info 2.1 h1k3 hud_info.amxx running
[ 69] [ReAPI] Advanced Team 0.1.0 Vaqtincha AdvancedTeamCho running
[ 70] Advanced Experience Sy 0.5.9 [REA serfreeman1337/s aes_main.amxx running
[ 71] AES: CStrike Addon 0.5.9 [REA serfreeman1337/s aes_exp_cstrike running
[ 72] AES: Informer 0.5.9 [REA serfreeman1337/s aes_informer.am running
[ 73] AES: Bonus System 0.5.9 Vega serfreeman1337/s aes_bonus_syste running
[ 74] AES: Bonus CSTRIKE 0.5.9.1 [R serfreeman1337/s aes_bonus_cstri running
[ 75] ChatAdditions: Core v1.9.4 Sergey Shorokhov ChatAdditions_C debug
[ 76] ChatAdditions: CSBans v1.9.4 Sergey Shorokhov CA_Storage_CSBa debug
[ 77] CA: Anti Flood v1.9.4 Nordic Warrior CA_AntiFlood.am debug
[ 78] CA: Mute v1.9.4 Sergey Shorokhov CA_Mute.amxx debug
[ 79] CA Addon: Death mute v1.9.4 Sergey Shorokhov CA_Addon_DeathM debug
[ 80] CA Addon: Rank restric v1.9.4 steelzzz CA_Addon_RankRe debug
[ 81] CA: VoteGAG 1.0.1-alph Sergey Shorokhov CA_Addon_VoteGa debug
[ 82] CA Addon: Request UnGA v1.9.4 steelzzz CA_Addon_Reques debug
[ 83] CA: Gag v1.9.4 Sergey Shorokhov CA_Gag.amxx debug
[ 84] [WIP] Revive Die Playe 3.1.87 Emma Jule rt_core.amxx debug
[ 85] RT: Misc 3.1.87 Emma Jule rt_misc.amxx debug
[ 86] RT: Effects 3.1.87 Emma Jule rt_effects.amxx debug
[ 87] RT: Bonuses 3.1.87 Emma Jule rt_bonuses.amxx debug
[ 88] RT: Restrictions 3.1.87 Emma Jule rt_restrictions debug
[ 89] RT: Respawn Features 3.1.87 Emma Jule rt_respawn_feat debug
[ 90] RT: Models support 3.1.87 Emma Jule rt_model_suppor debug
[ 91] RT: Mined Enemies Mode 3.1.87 Emma Jule rt_mined_enemie debug
[ 92] AMXBans: Screens Gm 1.6 Larte Team amxbans_ssban.a running
[ 93] Map Manager: Core 3.2.1 Mistrick map_manager_cor running
[ 94] Map Manager: Scheduler 0.2.1 Mistrick map_manager_sch running
[ 95] Map Manager: Rtv 0.1.5 Mistrick map_manager_rtv running
[ 96] Map Manager: Nominatio 0.3.5 Mistrick map_manager_nom running
[ 97] Map Manager: BlockList 0.0.4 Mistrick map_manager_blo running
[ 98] Map Manager: Online so 0.0.4 Mistrick map_manager_onl running
[ 99] Map Manager: Effects 0.1.3 Mistrick map_manager_eff running
[100] Map Manager: Informer 0.0.5 Mistrick map_manager_inf running
[101] Map Manager: Sounds 0.0.3 Mistrick map_manager_sou running
[102] Map Manager: Online ch 1.0.3 Sergey Shorokhov map_manager_onl running
[103] Map Manager: GUI 0.0.7 Mistrick map_manager_gui running
103 plugins, 103 running
- Автор плагина
- АвторNordic Warrior
- Версия плагина
- 1.3.0. Beta
- Исходный код
-
#include <amxmodx>
#include <amxmisc>
#include <reapi>
#include <awp_limiter_n>
new const PLUGIN_VERSION[] = "1.3.0 Beta";
#pragma semicolon 1
// Based on code by: Kaido Ren, Garey
#define FOREACHPLAYER(%0,%1,%2,%3) new __players[MAX_PLAYERS], %0, %1; \
%1 *= 1; \
get_players_ex(__players, %0, %2, %3); \
for (new i, %1 = __players[i]; i < %0; %1 = __players[++i])
#define GetCvarDesc(%0) fmt("%L", LANG_SERVER, %0)
#if !defined MAX_MAPNAME_LENGTH
const MAX_MAPNAME_LENGTH = 32;
#endif
const TASKID__CHECK_ONLINE = 10200;
enum _:Cvars
{
PLUGIN_CHAT_PREFIX[32],
MIN_PLAYERS,
MAX_AWP,
LIMIT_TYPE,
PERCENT_PLAYERS,
IMMNUNITY_FLAG[2],
IMMUNITY_TYPE[3],
SKIP_BOTS,
SKIP_SPECTATORS,
MESSAGE_ALLOWED_AWP,
ROUND_INFINITE,
GIVE_COMPENSATION
};
new g_pCvarValue[Cvars];
enum _:API_FORWARDS
{
LOW_ONLINE_MODE_START,
LOW_ONLINE_MODE_STOP,
TRIED_TO_GET_AWP,
AWP_TAKEN_FROM_PLAYER,
GIVE_COMPENSATION_FW,
SHOULD_WORK_ON_MAP
};
new g_iForwardsPointers[API_FORWARDS];
new g_iReturn;
new bool:g_bIsLowOnline = true;
new g_iAWPAmount[TeamName];
new HookChain:g_iHookChain_RoundEnd;
new HookChain:g_iHookChain_PlayerSpawn;
new g_bitImmunityFlags;
new g_iNumAllowedAWP;
new g_iOnlinePlayers;
new bool:IsUserBot[MAX_PLAYERS + 1];
/* <== DEBUG ==> */
new bool:g_bIsDebugActive;
new g_szLogPach[MAX_RESOURCE_PATH_LENGTH];
/* <====> */
public plugin_init()
{
register_plugin("AWP Limiter", PLUGIN_VERSION, "Nordic Warrior");
register_dictionary("awp_limiter_n.txt");
RegisterHookChain(RG_CSGameRules_CanHavePlayerItem, "RG_CSGameRules_CanHavePlayerItem_pre", .post = false);
RegisterHookChain(RG_CBasePlayer_HasRestrictItem, "RG_CBasePlayer_HasRestrictItem_pre", .post = false);
RegisterHookChain(RG_CBasePlayer_AddPlayerItem, "RG_CBasePlayer_AddPlayerItem_post", .post = true);
RegisterHookChain(RG_CSGameRules_RestartRound, "RG_RestartRound_post", .post = true);
RegisterHookChain(RG_CBasePlayer_RemovePlayerItem, "RG_CBasePlayer_RemovePlayerItem_post", .post = true);
g_iHookChain_RoundEnd = RegisterHookChain(RG_RoundEnd, "RG_RoundEnd_post", .post = true);
g_iHookChain_PlayerSpawn = RegisterHookChain(RG_CBasePlayer_Spawn, "RG_CBasePlayer_Spawn_post", .post = true);
DisableHookChain(g_iHookChain_PlayerSpawn);
CreateCvars();
AutoExecConfig(.name = "AWPLimiter");
CreateAPIForwards();
new szMapName[MAX_MAPNAME_LENGTH];
rh_get_mapname(szMapName, charsmax(szMapName), MNT_TRUE);
if(IsAwpMap(szMapName))
{
log_amx("Map <%s> is an AWP map (by name). Plugin was stopped.", szMapName);
pause("ad");
return;
}
ExecuteForward(g_iForwardsPointers[SHOULD_WORK_ON_MAP], g_iReturn, szMapName);
if(g_iReturn == AWPL_BREAK)
{
log_amx("Plugin shouldn't work on map <%s> because of API.", szMapName);
pause("ad");
return;
}
/* <== DEBUG ==> */
g_bIsDebugActive = bool:(plugin_flags() & AMX_FLAG_DEBUG);
if(g_bIsDebugActive)
{
new szLogsDir[MAX_RESOURCE_PATH_LENGTH];
get_localinfo("amxx_logs", szLogsDir, charsmax(szLogsDir));
add(szLogsDir, charsmax(szLogsDir), "/awpl_debug");
if(!dir_exists(szLogsDir))
mkdir(szLogsDir);
new iYear, iMonth, iDay;
date(iYear, iMonth, iDay);
formatex(g_szLogPach, charsmax(g_szLogPach), "%s/awpl__%i-%02i-%02i.log", szLogsDir, iYear, iMonth, iDay);
log_to_file(g_szLogPach, "================================================================");
debug_log(__LINE__, "Plugin initializated. Map: %s.", szMapName);
}
/* <====> */
// Fix https://github.com/alliedmodders/amxmodx/issues/728#issue-450682936
// Credits: wopox1337 (https://github.com/ChatAdditions/ChatAdditions_AMXX/commit/47c682051f2d1697a4b3d476f4f3cdd3eb1f6be7)
set_task(6.274, "_OnConfigsExecuted");
}
public _OnConfigsExecuted()
{
if(g_pCvarValue[ROUND_INFINITE] > 0)
{
DisableHookChain(g_iHookChain_RoundEnd);
if(!task_exists(TASKID__CHECK_ONLINE))
{
set_task_ex(float(g_pCvarValue[ROUND_INFINITE]), "CheckOnline", TASKID__CHECK_ONLINE, .flags = SetTask_Repeat);
}
debug_log(__LINE__, "Infinite round. Task for check online started.");
}
else if(g_pCvarValue[ROUND_INFINITE] == -1)
{
DisableHookChain(g_iHookChain_RoundEnd);
EnableHookChain(g_iHookChain_PlayerSpawn);
debug_log(__LINE__, "Infinite round. Player Spawn hook enabled.");
}
g_bitImmunityFlags = read_flags(g_pCvarValue[IMMNUNITY_FLAG]);
register_cvar("AWPLimiter_version", PLUGIN_VERSION, FCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED);
}
public RG_CSGameRules_CanHavePlayerItem_pre(const id, const item)
{
if(get_member(item, m_iId) != WEAPON_AWP)
return;
debug_log(__LINE__, "<CanHavePlayerItem> called. Player: <%n>", id);
if(g_bitImmunityFlags && get_user_flags(id) & g_bitImmunityFlags)
{
debug_log(__LINE__, "Player has immunity. Skipped.");
return;
}
new AwpRestrictionType:iReason;
if(!PlayerCanTakeAWP(id, iReason))
{
ExecuteForward(g_iForwardsPointers[TRIED_TO_GET_AWP], g_iReturn, id, OTHER, iReason);
if(g_iReturn == AWPL_BREAK)
{
debug_log(__LINE__, "AWP is allowed by API.");
return;
}
debug_log(__LINE__, "Player can't take AWP because of %s.", iReason == LOW_ONLINE ? "low online" : "it's too much in team");
SendReasonToPlayer(id, iReason);
SetHookChainReturn(ATYPE_INTEGER, false);
}
}
public RG_CBasePlayer_HasRestrictItem_pre(const id, ItemID:item, ItemRestType:type)
{
if(item != ITEM_AWP)
return;
if(user_has_awp(id))
return;
debug_log(__LINE__, "<HasRestrictItem> called. Player: <%n>, Type: %i.", id, type);
if(g_bitImmunityFlags && get_user_flags(id) & g_bitImmunityFlags)
{
debug_log(__LINE__, "Player has immunity. Skipped.");
return;
}
if(type == ITEM_TYPE_EQUIPPED)
{
new szMapName[MAX_MAPNAME_LENGTH];
rh_get_mapname(szMapName, charsmax(szMapName), MNT_TRUE);
log_amx("Map <%s> is an AWP map (by equip). Plugin was stopped.", szMapName);
pause("ad");
return;
}
new AwpRestrictionType:iReason;
if(!PlayerCanTakeAWP(id, iReason))
{
ExecuteForward(g_iForwardsPointers[TRIED_TO_GET_AWP], g_iReturn, id, type == ITEM_TYPE_BUYING ? BUY : TOUCH, iReason);
if(g_iReturn == AWPL_BREAK)
{
debug_log(__LINE__, "AWP is allowed by API.");
return;
}
SetHookChainReturn(ATYPE_BOOL, true);
if(type == ITEM_TYPE_TOUCHED)
{
static Float:flGameTime; flGameTime = get_gametime();
static Float:flNextMessageTime;
if(flGameTime >= flNextMessageTime)
{
SendReasonToPlayer(id, iReason);
debug_log(__LINE__, "Player can't take AWP because of %s.", iReason == LOW_ONLINE ? "low online" : "it's too much in team");
flNextMessageTime = flGameTime + 1.0;
}
return;
}
SendReasonToPlayer(id, iReason);
debug_log(__LINE__, "Player can't take AWP because of %s.", iReason == LOW_ONLINE ? "low online" : "it's too much in team");
}
}
bool:PlayerCanTakeAWP(const id, &AwpRestrictionType:iReason = AWP_ALLOWED)
{
if(g_bIsLowOnline)
{
iReason = LOW_ONLINE;
return false;
}
new TeamName:iPlayerTeam = get_member(id, m_iTeam);
if(!IsTeamCanTakeAWP(iPlayerTeam))
{
iReason = TOO_MANY_AWP_ON_TEAM;
return false;
}
return true;
}
bool:IsTeamCanTakeAWP(const TeamName:iTeam)
{
switch(g_pCvarValue[LIMIT_TYPE])
{
case 1:
{
if(g_iAWPAmount[iTeam] >= g_pCvarValue[MAX_AWP])
{
return false;
}
}
case 2:
{
if(g_iAWPAmount[iTeam] >= g_iNumAllowedAWP)
{
return false;
}
}
}
return true;
}
SendReasonToPlayer(id, AwpRestrictionType:iReason)
{
SetGlobalTransTarget(id);
switch(iReason)
{
case LOW_ONLINE: client_print_color(id, print_team_red, "%s %l %s", g_pCvarValue[PLUGIN_CHAT_PREFIX], "CHAT_LOW_ONLINE", g_pCvarValue[MIN_PLAYERS], g_pCvarValue[SKIP_SPECTATORS] ? fmt("%l", "CHAT_WITHOUT_SPECTATORS") : "");
case TOO_MANY_AWP_ON_TEAM: client_print_color(id, print_team_red, "%s %l", g_pCvarValue[PLUGIN_CHAT_PREFIX], "CHAT_TOO_MANY_AWP_PER_TEAM", g_pCvarValue[LIMIT_TYPE] == 1 ? g_pCvarValue[MAX_AWP] : g_iNumAllowedAWP);
}
}
public RG_CBasePlayer_AddPlayerItem_post(const id, const pItem)
{
if(g_bIsLowOnline)
return;
if(get_member(pItem, m_iId) != WEAPON_AWP)
return;
debug_log(__LINE__, "<AddPlayerItem> called. Player: <%n>", id);
if(g_pCvarValue[SKIP_BOTS] && IsUserBot[id])
{
debug_log(__LINE__, "Player is bot. Skipped.");
return;
}
new TeamName:iUserTeam = get_member(id, m_iTeam);
g_iAWPAmount[iUserTeam]++;
debug_log(__LINE__, "(+) Now it's [ %i ] AWP in %i team", g_iAWPAmount[iUserTeam], iUserTeam);
}
public client_disconnected(id)
{
if(!is_user_connected(id))
return;
if(!user_has_awp(id))
return;
debug_log(__LINE__, "<client_disconnected> called. Player: <%n>", id);
if(IsUserBot[id])
{
IsUserBot[id] = false;
if(g_pCvarValue[SKIP_BOTS])
{
debug_log(__LINE__, "Player is bot. Skipped.");
return;
}
}
new TeamName:iUserTeam = get_member(id, m_iTeam);
g_iAWPAmount[iUserTeam]--;
debug_log(__LINE__, "(-) Now it's [ %i ] AWP in %i team", g_iAWPAmount[iUserTeam], iUserTeam);
}
public RG_CBasePlayer_RemovePlayerItem_post(const id, const pItem)
{
if(g_bIsLowOnline)
return;
if(get_member(pItem, m_iId) != WEAPON_AWP)
return;
debug_log(__LINE__, "<RemovePlayerItem> called. Player: <%n>", id);
if(g_pCvarValue[SKIP_BOTS] && IsUserBot[id])
{
debug_log(__LINE__, "Player is bot. Skipped.");
return;
}
new TeamName:iUserTeam = get_member(id, m_iTeam);
g_iAWPAmount[iUserTeam]--;
debug_log(__LINE__, "(-) Now it's [ %i ] AWP in %i team", g_iAWPAmount[iUserTeam], iUserTeam);
}
public client_putinserver(id)
{
if(is_user_bot(id))
{
IsUserBot[id] = true;
}
}
public RG_RestartRound_post()
{
arrayset(g_iAWPAmount[TEAM_UNASSIGNED], 0, sizeof g_iAWPAmount);
debug_log(__LINE__, "--> New round has started. <--");
if(g_bIsLowOnline)
{
debug_log(__LINE__, "Low online mode is now active. AWP count is skipped.");
return;
}
FOREACHPLAYER(iPlayers, id, g_pCvarValue[SKIP_BOTS] ? (GetPlayers_ExcludeBots|GetPlayers_ExcludeHLTV|GetPlayers_ExcludeDead) : (GetPlayers_ExcludeHLTV|GetPlayers_ExcludeDead), "")
{
if(user_has_awp(id))
{
g_iAWPAmount[get_member(id, m_iTeam)]++;
}
}
debug_log(__LINE__, "Now it's [ %i ] AWP in CT team & [ %i ] AWP in TE team.", g_iAWPAmount[TEAM_CT], g_iAWPAmount[TEAM_TERRORIST]);
}
public RG_CBasePlayer_Spawn_post(const id)
{
if(!is_user_alive(id))
return;
CheckOnline();
}
public RG_RoundEnd_post(WinStatus:status, ScenarioEventEndRound:event, Float:tmDelay)
{
debug_log(__LINE__, "--> Round is ended. <--");
CheckOnline();
}
public CheckOnline()
{
GetOnlinePlayers();
debug_log(__LINE__, "<CheckOnline> called. Online players: [ %i ].%s", g_iOnlinePlayers, g_pCvarValue[SKIP_SPECTATORS] ? " Spectators skipped." : "");
if(!g_iOnlinePlayers)
{
g_bIsLowOnline = true;
return;
}
if(g_iOnlinePlayers < g_pCvarValue[MIN_PLAYERS])
{
if(!g_bIsLowOnline)
{
SetLowOnlineMode();
}
return;
}
else
{
if(g_bIsLowOnline)
{
UnsetLowOnlineMode();
}
}
CheckTeamLimit();
}
GetOnlinePlayers()
{
new iNumCT = get_playersnum_ex(g_pCvarValue[SKIP_BOTS] ? (GetPlayers_ExcludeBots|GetPlayers_ExcludeHLTV|GetPlayers_MatchTeam) : (GetPlayers_ExcludeHLTV|GetPlayers_MatchTeam), "CT");
new iNumTE = get_playersnum_ex(g_pCvarValue[SKIP_BOTS] ? (GetPlayers_ExcludeBots|GetPlayers_ExcludeHLTV|GetPlayers_MatchTeam) : (GetPlayers_ExcludeHLTV|GetPlayers_MatchTeam), "TERRORIST");
g_iOnlinePlayers = iNumCT + iNumTE;
if(!g_pCvarValue[SKIP_SPECTATORS])
{
g_iOnlinePlayers += get_playersnum_ex(GetPlayers_ExcludeBots|GetPlayers_ExcludeHLTV|GetPlayers_MatchTeam, "SPECTATOR");
}
}
SetLowOnlineMode()
{
ExecuteForward(g_iForwardsPointers[LOW_ONLINE_MODE_START], g_iReturn);
if(g_iReturn == AWPL_BREAK)
{
debug_log(__LINE__, "Low online mode can't start because of API.");
CheckTeamLimit();
return;
}
g_bIsLowOnline = true;
TakeAllAwps();
debug_log(__LINE__, "Low online mode has started.");
}
UnsetLowOnlineMode()
{
ExecuteForward(g_iForwardsPointers[LOW_ONLINE_MODE_STOP], g_iReturn);
if(g_iReturn == AWPL_BREAK)
{
debug_log(__LINE__, "Low online mode can't stop because of API.");
return;
}
g_bIsLowOnline = false;
if(g_pCvarValue[MESSAGE_ALLOWED_AWP])
{
client_print_color(0, print_team_blue, "%s %l", g_pCvarValue[PLUGIN_CHAT_PREFIX], "CHAT_AWP_BECAME_AVALIABLE");
}
debug_log(__LINE__, "Low online mode has stopped.");
}
CheckTeamLimit()
{
switch(g_pCvarValue[LIMIT_TYPE])
{
case 1: debug_log(__LINE__, "Limit type: 1. Max AWP per team: %i", g_pCvarValue[MAX_AWP]);
case 2:
{
g_iNumAllowedAWP = floatround(g_iOnlinePlayers * (g_pCvarValue[PERCENT_PLAYERS] / 100.0), floatround_floor);
debug_log(__LINE__, "Limit type: 2. Cvar percent: %i, calculated num of max AWP per team: %i", g_pCvarValue[PERCENT_PLAYERS], g_iNumAllowedAWP);
if(g_iNumAllowedAWP < 1)
{
g_iNumAllowedAWP = 1;
debug_log(__LINE__, "The AWP limit is less than one, so it was set to 1.", g_pCvarValue[PERCENT_PLAYERS], g_iNumAllowedAWP);
}
if(g_iAWPAmount[TEAM_TERRORIST] > g_iNumAllowedAWP)
{
TakeAwpsFromTeam(TEAM_TERRORIST);
}
if(g_iAWPAmount[TEAM_CT] > g_iNumAllowedAWP)
{
TakeAwpsFromTeam(TEAM_CT);
}
}
}
}
TakeAllAwps()
{
new TeamName:iUserTeam;
FOREACHPLAYER(iPlayers, id, g_pCvarValue[SKIP_BOTS] ? (GetPlayers_ExcludeBots|GetPlayers_ExcludeHLTV|GetPlayers_ExcludeDead) : (GetPlayers_ExcludeHLTV|GetPlayers_ExcludeDead), "")
{
if(user_has_awp(id))
{
ExecuteForward(g_iForwardsPointers[AWP_TAKEN_FROM_PLAYER], g_iReturn, id, LOW_ONLINE);
if(g_iReturn == AWPL_BREAK)
{
debug_log(__LINE__, "AWP is not taken from player because of API.");
continue;
}
rg_remove_item(id, "weapon_awp");
iUserTeam = get_member(id, m_iTeam);
g_iAWPAmount[iUserTeam]--;
client_print_color(id, print_team_red, "%s %l %l", g_pCvarValue[PLUGIN_CHAT_PREFIX], "CHAT_AWP_TAKEN_AWAY", "CHAT_REASON_LOW_ONLINE");
GiveCompensation(id);
debug_log(__LINE__, "(-) Now it's [ %i ] AWP in %i team", g_iAWPAmount[iUserTeam], iUserTeam);
}
}
}
TakeAwpsFromTeam(TeamName:iTeam)
{
debug_log(__LINE__, "<TakeAwpsFromTeam> called for %i team.", iTeam);
FOREACHPLAYER(iPlayers, id, g_pCvarValue[SKIP_BOTS] ? (GetPlayers_ExcludeBots|GetPlayers_ExcludeHLTV|GetPlayers_ExcludeDead|GetPlayers_MatchTeam) : (GetPlayers_ExcludeHLTV|GetPlayers_ExcludeDead|GetPlayers_MatchTeam), iTeam == TEAM_TERRORIST ? "TERRORIST" : "CT")
{
if(user_has_awp(id))
{
ExecuteForward(g_iForwardsPointers[AWP_TAKEN_FROM_PLAYER], g_iReturn, id, TOO_MANY_AWP_ON_TEAM);
if(g_iReturn == AWPL_BREAK)
{
debug_log(__LINE__, "AWP is not taken from player because of API.");
continue;
}
rg_remove_item(id, "weapon_awp");
client_print_color(id, print_team_red, "%s %l %l", g_pCvarValue[PLUGIN_CHAT_PREFIX], "CHAT_AWP_TAKEN_AWAY", "CHAT_REASON_TOO_MANY_AWP_PER_TEAM");
GiveCompensation(id);
if(g_iAWPAmount[iTeam] <= g_iNumAllowedAWP)
break;
}
}
}
GiveCompensation(const id)
{
if(!g_pCvarValue[GIVE_COMPENSATION])
return;
ExecuteForward(g_iForwardsPointers[GIVE_COMPENSATION_FW], g_iReturn, id);
if(g_iReturn == AWPL_BREAK)
return;
switch(g_pCvarValue[GIVE_COMPENSATION])
{
case -1:
{
if(random_num(0, 1))
{
rg_give_item(id, "weapon_ak47");
rg_set_user_bpammo(id, WEAPON_AK47, 90);
}
else
{
rg_give_item(id, "weapon_m4a1");
rg_set_user_bpammo(id, WEAPON_M4A1, 90);
}
client_print_color(id, print_team_blue, "%s %l", g_pCvarValue[PLUGIN_CHAT_PREFIX], "CHAT_COMPENSATION_RIFLE");
}
default:
{
rg_add_account(id, g_pCvarValue[GIVE_COMPENSATION]);
client_print_color(id, print_team_blue, "%s %l", g_pCvarValue[PLUGIN_CHAT_PREFIX], "CHAT_COMPENSATION_MONEY", g_pCvarValue[GIVE_COMPENSATION]);
}
}
}
CreateCvars()
{
new pCvar;
bind_pcvar_string(create_cvar("awpl_chat_prefix", "^3[^4AWP^3]",
.description = "Plugin prefix."),
g_pCvarValue[PLUGIN_CHAT_PREFIX], charsmax(g_pCvarValue[PLUGIN_CHAT_PREFIX]));
bind_pcvar_num(create_cvar("awpl_min_players", "10",
.description = GetCvarDesc("CVAR_MIN_PLAYERS")),
g_pCvarValue[MIN_PLAYERS]);
bind_pcvar_num(create_cvar("awpl_limit_type", "1",
.description = GetCvarDesc("CVAR_LIMIT_TYPE"),
.has_min = true, .min_val = 1.0,
.has_max = true, .max_val = 2.0),
g_pCvarValue[LIMIT_TYPE]);
bind_pcvar_num(create_cvar("awpl_max_awp", "2",
.description = GetCvarDesc("CVAR_MAX_AWP"),
.has_min = true, .min_val = 1.0),
g_pCvarValue[MAX_AWP]);
bind_pcvar_num(create_cvar("awpl_percent_players", "10",
.description = GetCvarDesc("CVAR_PERCENT_PLAYERS")),
g_pCvarValue[PERCENT_PLAYERS]);
bind_pcvar_string(pCvar = create_cvar("awpl_immunity_flag", "a",
.description = GetCvarDesc("CVAR_IMMUNITY_FLAG")),
g_pCvarValue[IMMNUNITY_FLAG], charsmax(g_pCvarValue[IMMNUNITY_FLAG]));
hook_cvar_change(pCvar, "OnChangeCvar_Immunity");
// bind_pcvar_string(create_cvar("awpl_immunity_type", "abc",
// .description = "Иммунитет от запрета:^na — Покупки AWP^nb — Поднятия с земли^nc — Взятия в различных меню"),
// g_pCvarValue[IMMUNITY_TYPE], charsmax(g_pCvarValue[IMMUNITY_TYPE]));
bind_pcvar_num(create_cvar("awpl_skip_bots", "0",
.description = GetCvarDesc("CVAR_SKIP_BOTS"),
.has_min = true, .min_val = 0.0,
.has_max = true, .max_val = 1.0),
g_pCvarValue[SKIP_BOTS]);
bind_pcvar_num(create_cvar("awpl_skip_spectators", "1",
.description = GetCvarDesc("CVAR_SKIP_SPECTATORS"),
.has_min = true, .min_val = 0.0,
.has_max = true, .max_val = 1.0),
g_pCvarValue[SKIP_SPECTATORS]);
bind_pcvar_num(create_cvar("awpl_message_allow_awp", "1",
.description = GetCvarDesc("CVAR_MESSAGE_AWLLOW_AWP"),
.has_min = true, .min_val = 0.0,
.has_max = true, .max_val = 1.0),
g_pCvarValue[MESSAGE_ALLOWED_AWP]);
bind_pcvar_num(pCvar = create_cvar("awpl_round_infinite", "0",
.description = GetCvarDesc("CVAR_ROUND_INFINITE"),
.has_min = true, .min_val = -1.0),
g_pCvarValue[ROUND_INFINITE]);
hook_cvar_change(pCvar, "OnChangeCvar_RoundInfinite");
bind_pcvar_num(create_cvar("awpl_give_compensation", "-1",
.description = GetCvarDesc("CVAR_GIVE_COMPENSATION"),
.has_min = true, .min_val = -1.0),
g_pCvarValue[GIVE_COMPENSATION]);
}
public OnChangeCvar_RoundInfinite(pCvar, const szOldValue[], const szNewValue[])
{
debug_log(__LINE__, "Cvar <awpl_round_infinite> changed. Old: %s. New: %s", szOldValue, szNewValue);
new iNewValue = str_to_num(szNewValue);
if(iNewValue > 0)
{
DisableHookChain(g_iHookChain_RoundEnd);
DisableHookChain(g_iHookChain_PlayerSpawn);
if(!task_exists(TASKID__CHECK_ONLINE))
{
set_task_ex(float(g_pCvarValue[ROUND_INFINITE]), "CheckOnline", TASKID__CHECK_ONLINE, .flags = SetTask_Repeat);
}
else
{
change_task(TASKID__CHECK_ONLINE, float(iNewValue));
}
CheckOnline();
}
else if(iNewValue == -1)
{
DisableHookChain(g_iHookChain_RoundEnd);
remove_task(TASKID__CHECK_ONLINE);
EnableHookChain(g_iHookChain_PlayerSpawn);
}
else
{
EnableHookChain(g_iHookChain_RoundEnd);
DisableHookChain(g_iHookChain_PlayerSpawn);
remove_task(TASKID__CHECK_ONLINE);
}
}
public OnChangeCvar_Immunity(pCvar, const szOldValue[], const szNewValue[])
{
debug_log(__LINE__, "Cvar <awpl_immunity_flag> changed. Old: %s. New: %s", szOldValue, szNewValue);
g_bitImmunityFlags = read_flags(szNewValue);
}
IsAwpMap(const szMapName[])
{
if(equali(szMapName, "awp_", 4))
{
return true;
}
return false;
}
CreateAPIForwards()
{
g_iForwardsPointers[LOW_ONLINE_MODE_START] = CreateMultiForward("awpl_low_online_start", ET_STOP);
g_iForwardsPointers[LOW_ONLINE_MODE_STOP] = CreateMultiForward("awpl_low_online_stop", ET_STOP);
g_iForwardsPointers[TRIED_TO_GET_AWP] = CreateMultiForward("awpl_player_tried_to_get_awp", ET_STOP, FP_CELL, FP_CELL, FP_CELL);
g_iForwardsPointers[AWP_TAKEN_FROM_PLAYER] = CreateMultiForward("awpl_awp_taken_from_player", ET_STOP, FP_CELL, FP_CELL);
g_iForwardsPointers[GIVE_COMPENSATION_FW] = CreateMultiForward("awpl_give_compensation", ET_STOP, FP_CELL);
g_iForwardsPointers[SHOULD_WORK_ON_MAP] = CreateMultiForward("awpl_plugin_should_work_on_this_map", ET_STOP, FP_STRING);
}
public plugin_natives()
{
register_native("awpl_is_low_online", "native_awpl_is_low_online");
register_native("awpl_set_low_online", "native_awpl_set_low_online");
register_native("awpl_can_team_take_awp", "native_awpl_can_team_take_awp");
register_native("awpl_can_player_take_awp", "native_awpl_can_player_take_awp");
}
public native_awpl_is_low_online(iPlugin, iParams)
{
return g_bIsLowOnline;
}
public native_awpl_set_low_online(iPlugin, iParams)
{
new bool:bSet = bool:get_param(1);
GetOnlinePlayers();
if(bSet)
{
debug_log(__LINE__, "Low online mode is set via native.");
SetLowOnlineMode();
}
else
{
debug_log(__LINE__, "Low online mode is unset via native.");
UnsetLowOnlineMode();
CheckTeamLimit();
}
}
public native_awpl_can_team_take_awp(iPlugin, iParams)
{
new TeamName:iTeam = TeamName:get_param(1);
return IsTeamCanTakeAWP(iTeam);
}
public native_awpl_can_player_take_awp(iPlugin, iParams)
{
enum { index = 1, reason };
new id = get_param(index);
new AwpRestrictionType:iReason;
new bool:bCanTakeAWP = PlayerCanTakeAWP(id, iReason);
set_param_byref(reason, any:iReason);
return bCanTakeAWP;
}
public plugin_end()
{
if(g_bIsDebugActive)
{
log_to_file(g_szLogPach, "================================================================^n");
}
}
stock bool:user_has_awp(const id)
{
return rg_has_item_by_name(id, "weapon_awp");
}
/* <== DEBUG ==> */
debug_log(const iLine, const szText[], any:...)
{
if(!g_bIsDebugActive)
return;
static szLogText[512];
vformat(szLogText, charsmax(szLogText), szText, 3);
format(szLogText, charsmax(szLogText), "[AWPL DEBUG] %s | LINE: %i", szLogText, iLine);
log_to_file(g_szLogPach, szLogText);
}
/* <====> */
Всем привет! Плагин работал работал, на карте aim_headshot просто взял и начал спамить ошибками. На других вроде пока не видел