Алексей1000
Пользователь
- Регистрация
- 24 Июн 2017
- Сообщения
- 12
- Симпатии
- 0
- Пол
- Мужской
Не подскажете почему когда ставлю плагин awp_off падает серв раз в сутки с ошибкой в debug
CRASH: Fri Mar 2 20:29:12 MSK 2018
Start Line: ./hlds_linux -debug -game cstrike -master -pingboost 1 -sys_ticrate 500 -secure +ip 83.222.115.50 +port 27055 +map de_dust2_2x2 -maxplayers 21 +rcon_password +sv_password -pidfile hlds.25825.pid
[New LWP 25852]
[New LWP 3873]
[New LWP 3872]
[New LWP 25857]
[New LWP 25855]
[New LWP 31566]
[New LWP 3875]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `./hlds_linux -debug -game cstrike -master -pingboost 1 -sys_ticrate 500 -secure'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0xf33c4af8 in CAWP::AWPFire (this=0x8ee82e8, flSpread=<optimized out>, fUseAutoAim=<optimized out>, flCycleTime=1.45000005) at ../cstrike/dlls/wpn_shared/wpn_awp.cpp:225
[Current thread is 1 (Thread 0xf73c5480 (LWP 25852))]
#0 0xf33c4af8 in CAWP::AWPFire (this=0x8ee82e8, flSpread=<optimized out>, fUseAutoAim=<optimized out>, flCycleTime=1.45000005) at ../cstrike/dlls/wpn_shared/wpn_awp.cpp:225
#1 0x3a83126f in ?? ()
#2 0xf3dcc9f8 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
vecAiming = <optimized out>
vecSrc = {x = -741.910522, y = 237.03125, z = 546.737427}
flag = <optimized out>
From To Syms Read Shared Object Library
0xf7658914 0xf769ec78 Yes ./libstdc++.so.6
0xf7604a30 0xf7605921 Yes (*) /lib32/libdl.so.2
0xf75eb8c0 0xf75f8ec1 Yes /lib32/libpthread.so.0
0xf74477f0 0xf757449f Yes (*) /lib32/libc.so.6
0xf73df6e0 0xf7416c8b Yes (*) /lib32/libm.so.6
0xf76eb860 0xf7704f3d Yes (*) /lib/ld-linux.so.2
0xf73c7e04 0xf73d7490 Yes ./libgcc_s.so.1
0xf6eab490 0xf6f2f24c Yes /home/27055/engine_i486.so
0xf6e515c0 0xf6e5bd74 Yes (*) ./libsteam_api.so
0xf6e47840 0xf6e4adfc Yes (*) /lib32/librt.so.1
0xf6e2ea00 0xf6e3b1b8 Yes /home/27055/filesystem_stdio.so
0xf5f25e80 0xf6a0d040 Yes (*) /cs/hlds_6153/steamclient.so
0xf5da0670 0xf5e16020 Yes (*) /cs/hlds_6153/crashhandler.so
0xf3568b70 0xf357e984 Yes /home/27055/./cstrike/addons/metamod/dlls/metamod.so
0xf332b370 0xf344f370 Yes /home/27055/cstrike/dlls/cs.so
0xf31eca00 0xf324c768 Yes (*) /home/27055/cstrike/addons/amxmodx/dlls/amxmodx.so
0xf760ed90 0xf760fd08 Yes (*) cstrike/addons/amxmodx/modules/sockets_amxx_i386.so
0xf31ccd70 0xf31d0b3c Yes (*) cstrike/addons/amxmodx/modules/adminfreelook_amxx_i386.so
Yes (*) cstrike/addons/amxmodx/modules/aimespfix_amxx_i386.so
0xf2f13110 0xf2f3e650 Yes (*) /home/27055/cstrike/addons/dproto/dlls/dproto.so
0xf2cf28c0 0xf2ea0571 Yes (*) /home/27055/cstrike/addons/vtc/dlls/vtc.so
0xf2c885e0 0xf2c8bc38 Yes (*) /home/27055/cstrike/addons/semiclip/dlls/semiclip.so
0xf2bcfc90 0xf2beb8d0 Yes (*) /home/27055/cstrike/addons/whblocker/dlls/whblocker.so
0xf2b55d50 0xf2b5c658 Yes (*) cstrike/addons/amxmodx/modules/csx_amxx_i386.so
0xf2b1fc50 0xf2b4c4a8 Yes (*) cstrike/addons/amxmodx/modules/fakemeta_amxx_i386.so
0xf295b490 0xf29eb228 Yes (*) cstrike/addons/amxmodx/modules/mysql_amxx_i386.so
0xf28950d0 0xf28a0478 Yes (*) cstrike/addons/amxmodx/modules/engine_amxx_i386.so
0xf284cc20 0xf28838c4 Yes (*) cstrike/addons/amxmodx/modules/okapi_amxx_i386.so
0xf27d59d0 0xf27fe618 Yes (*) cstrike/addons/amxmodx/modules/orpheu_amxx_i386.so
0xf2736870 0xf27620b8 Yes (*) cstrike/addons/amxmodx/modules/hamsandwich_amxx_i386.so
0xf2720220 0xf27269d8 Yes (*) cstrike/addons/amxmodx/modules/cstrike_amxx_i386.so
0xf2535350 0xf253dfc8 Yes (*) cstrike/addons/amxmodx/modules/regex_amxx_i386.so
0xf252ac10 0xf252dc98 Yes (*) cstrike/addons/amxmodx/modules/fun_amxx_i386.so
0xf251f490 0xf2526d78 Yes (*) cstrike/addons/amxmodx/modules/nvault_amxx_i386.so
0xf2900a80 0xf29068f0 Yes (*) /lib32/libnss_files.so.2
0xf0230e80 0xf0d18040 Yes (*) ./steamclient.so
0xefb60670 0xefbd6020 Yes (*) ./crashhandler.so
(*): Shared library is missing debugging information.
Stack level 0, frame at 0xff878fd4:
eip = 0xf33c4af8 in CAWP::AWPFire (../cstrike/dlls/wpn_shared/wpn_awp.cpp:225); saved eip = 0x3a83126f
called by frame at 0xff878fd8
source language c++.
Arglist at 0xff878f20, args: this=0x8ee82e8, flSpread=<optimized out>, fUseAutoAim=<optimized out>, flCycleTime=1.45000005
Locals at 0xff878f20, Previous frame's sp is 0xff878fd4
Saved registers:
ebx at 0xff878fc0, ebp at 0xff878fcc, esi at 0xff878fc4, edi at 0xff878fc8, eip at 0xff878fd0
End of crash report
----------------------------------------------
вот код awp_off
Start Line: ./hlds_linux -debug -game cstrike -master -pingboost 1 -sys_ticrate 500 -secure +ip 83.222.115.50 +port 27055 +map de_dust2_2x2 -maxplayers 21 +rcon_password +sv_password -pidfile hlds.25825.pid
[New LWP 25852]
[New LWP 3873]
[New LWP 3872]
[New LWP 25857]
[New LWP 25855]
[New LWP 31566]
[New LWP 3875]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `./hlds_linux -debug -game cstrike -master -pingboost 1 -sys_ticrate 500 -secure'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0xf33c4af8 in CAWP::AWPFire (this=0x8ee82e8, flSpread=<optimized out>, fUseAutoAim=<optimized out>, flCycleTime=1.45000005) at ../cstrike/dlls/wpn_shared/wpn_awp.cpp:225
[Current thread is 1 (Thread 0xf73c5480 (LWP 25852))]
#0 0xf33c4af8 in CAWP::AWPFire (this=0x8ee82e8, flSpread=<optimized out>, fUseAutoAim=<optimized out>, flCycleTime=1.45000005) at ../cstrike/dlls/wpn_shared/wpn_awp.cpp:225
#1 0x3a83126f in ?? ()
#2 0xf3dcc9f8 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
vecAiming = <optimized out>
vecSrc = {x = -741.910522, y = 237.03125, z = 546.737427}
flag = <optimized out>
From To Syms Read Shared Object Library
0xf7658914 0xf769ec78 Yes ./libstdc++.so.6
0xf7604a30 0xf7605921 Yes (*) /lib32/libdl.so.2
0xf75eb8c0 0xf75f8ec1 Yes /lib32/libpthread.so.0
0xf74477f0 0xf757449f Yes (*) /lib32/libc.so.6
0xf73df6e0 0xf7416c8b Yes (*) /lib32/libm.so.6
0xf76eb860 0xf7704f3d Yes (*) /lib/ld-linux.so.2
0xf73c7e04 0xf73d7490 Yes ./libgcc_s.so.1
0xf6eab490 0xf6f2f24c Yes /home/27055/engine_i486.so
0xf6e515c0 0xf6e5bd74 Yes (*) ./libsteam_api.so
0xf6e47840 0xf6e4adfc Yes (*) /lib32/librt.so.1
0xf6e2ea00 0xf6e3b1b8 Yes /home/27055/filesystem_stdio.so
0xf5f25e80 0xf6a0d040 Yes (*) /cs/hlds_6153/steamclient.so
0xf5da0670 0xf5e16020 Yes (*) /cs/hlds_6153/crashhandler.so
0xf3568b70 0xf357e984 Yes /home/27055/./cstrike/addons/metamod/dlls/metamod.so
0xf332b370 0xf344f370 Yes /home/27055/cstrike/dlls/cs.so
0xf31eca00 0xf324c768 Yes (*) /home/27055/cstrike/addons/amxmodx/dlls/amxmodx.so
0xf760ed90 0xf760fd08 Yes (*) cstrike/addons/amxmodx/modules/sockets_amxx_i386.so
0xf31ccd70 0xf31d0b3c Yes (*) cstrike/addons/amxmodx/modules/adminfreelook_amxx_i386.so
Yes (*) cstrike/addons/amxmodx/modules/aimespfix_amxx_i386.so
0xf2f13110 0xf2f3e650 Yes (*) /home/27055/cstrike/addons/dproto/dlls/dproto.so
0xf2cf28c0 0xf2ea0571 Yes (*) /home/27055/cstrike/addons/vtc/dlls/vtc.so
0xf2c885e0 0xf2c8bc38 Yes (*) /home/27055/cstrike/addons/semiclip/dlls/semiclip.so
0xf2bcfc90 0xf2beb8d0 Yes (*) /home/27055/cstrike/addons/whblocker/dlls/whblocker.so
0xf2b55d50 0xf2b5c658 Yes (*) cstrike/addons/amxmodx/modules/csx_amxx_i386.so
0xf2b1fc50 0xf2b4c4a8 Yes (*) cstrike/addons/amxmodx/modules/fakemeta_amxx_i386.so
0xf295b490 0xf29eb228 Yes (*) cstrike/addons/amxmodx/modules/mysql_amxx_i386.so
0xf28950d0 0xf28a0478 Yes (*) cstrike/addons/amxmodx/modules/engine_amxx_i386.so
0xf284cc20 0xf28838c4 Yes (*) cstrike/addons/amxmodx/modules/okapi_amxx_i386.so
0xf27d59d0 0xf27fe618 Yes (*) cstrike/addons/amxmodx/modules/orpheu_amxx_i386.so
0xf2736870 0xf27620b8 Yes (*) cstrike/addons/amxmodx/modules/hamsandwich_amxx_i386.so
0xf2720220 0xf27269d8 Yes (*) cstrike/addons/amxmodx/modules/cstrike_amxx_i386.so
0xf2535350 0xf253dfc8 Yes (*) cstrike/addons/amxmodx/modules/regex_amxx_i386.so
0xf252ac10 0xf252dc98 Yes (*) cstrike/addons/amxmodx/modules/fun_amxx_i386.so
0xf251f490 0xf2526d78 Yes (*) cstrike/addons/amxmodx/modules/nvault_amxx_i386.so
0xf2900a80 0xf29068f0 Yes (*) /lib32/libnss_files.so.2
0xf0230e80 0xf0d18040 Yes (*) ./steamclient.so
0xefb60670 0xefbd6020 Yes (*) ./crashhandler.so
(*): Shared library is missing debugging information.
Stack level 0, frame at 0xff878fd4:
eip = 0xf33c4af8 in CAWP::AWPFire (../cstrike/dlls/wpn_shared/wpn_awp.cpp:225); saved eip = 0x3a83126f
called by frame at 0xff878fd8
source language c++.
Arglist at 0xff878f20, args: this=0x8ee82e8, flSpread=<optimized out>, fUseAutoAim=<optimized out>, flCycleTime=1.45000005
Locals at 0xff878f20, Previous frame's sp is 0xff878fd4
Saved registers:
ebx at 0xff878fc0, ebp at 0xff878fcc, esi at 0xff878fc4, edi at 0xff878fc8, eip at 0xff878fd0
End of crash report
----------------------------------------------
вот код awp_off
#include < amxmodx >
#include < hamsandwich >
#include < fakemeta_util >
#if AMXX_VERSION_NUM < 183
#include < colorchat >
#define MAX_PLAYERS 32
#endif
//■■■■■■■■■■■■■■■■■■■■■■■ CONFIG START ■■■■■■■■■■■■■■■■■■■■■■■//
#define ALLPLAYERS
/*
Закоментируйте, чтобы для проверки на онлайн брались только люди(ботов и хлтв считать не будет).
Пример:
Допустим на сервере 5 ботов и 2 человека 1 хлтв.
Дефайн закоментирован: Посчитает, что на сервере 2 из Максимально возможных игроков.
Дефайн раскоментирован: Посчитает, что на сервере 8 игроков из Максимально возможных игроков (5 ботов + 2 человека + 1 хлтв).
Отбирать авп будет ТОЛЬКО У ЛЮДЕЙ в любом случае.
*/
// ^4 - зелёный | ^3 - цвет тимы (КТ - синий | Т - красный | SPEC - серый) | ^1 - жёлтый
#define MSG_PREFIX "^3[^4AWP^3]"
#define MSG_LOWONLINE "У вас^4 отобрано^3 AWP. Причина:^4 низкий онлайн."
#define MSG_LIMIT "У вас^4 отобрано^3 AWP. Причина:^4 превышен лимит."
#define FLAG ADMIN_BAN //Флаг для иммунитета от лимита
#define RETURN_MONEY //Возвращать деньги при отборе авп в конце раунда из-за низкого онлайна? (Закоментируйте, если не хотите, чтобы возвращало деньги)
#if defined RETURN_MONEY
#define MONEY_AWP 4750 //Сколько денег возвращать?
new g_MoneyMsgID;
#endif
//#define PERCENT_PLAYERS
/*
Разкоменитруйте, если хотите чтобы лимит зависил от процента игроков [I am chetko ob'yasnyat']
Например: Онлайн = 10, Процент в кваре(awp_limit_max) = 20
10/100*20 = 2 авп на тиму (2 у терров и 2 у кт)
*/
//■■■■■■■■■■■■■■■■■■■■■■■■ CONFIG END ■■■■■■■■■■■■■■■■■■■■■■■■//
const iMoney = 115;
const iMenu = 205;
const iTeam = 114;
const idRifleMenu = 6;
const idNoMenu = 0;
const OFFSET_LINUX_WEAPONS = 4;
const OFFSET_WEAPONID = 43;
#define get_menuid(%0) get_pdata_int(%0, iMenu)
#define fm_get_user_team(%0) ETEAMS:get_pdata_int(%0, iTeam)
#define fm_get_weaponid(%0) get_pdata_int(%0, OFFSET_WEAPONID, OFFSET_LINUX_WEAPONS)
#define fm_get_user_money(%0) get_pdata_int(%0 , iMoney)
#define IsPlayer(%0) (0 < %0 < 33)
enum ETEAMS {
TEAM_TERRORIST = 1,
TEAM_CT,
TEAM_SPECTATOR
};
enum ECVARS {
CVAR_ONLINE = 0,
CVAR_LIMIT_AWP_STATUS,
CVAR_LIMIT_MAX_AWP,
CVAR_LIMIT_IMMUN,
CVAR_BUYTIME
};
enum {
AWP_NONE = 0,
AWP_BUY,
AWP_PICK_UP
};
new gBuy = true;
new sAwp[ETEAMS: TEAM_SPECTATOR], gCount, gCvar[ECVARS], gAwp[MAX_PLAYERS + 1], ETEAMS: gTeam[MAX_PLAYERS + 1];
#if defined PERCENT_PLAYERS
new gLimit;
#endif
public plugin_init(){
register_plugin("AWPoff", "1.6", "PAffAEJIkA :3");
new mapname[32];
get_mapname(mapname, charsmax(mapname));
new maps[][] = { "awp", "aim", "35hp", "$" };
for(new i; i < sizeof maps; i++){
if(containi(mapname, maps) != -1){
pause("ad");
return;
}
}
register_logevent("EventRoundStart", 2, "1=Round_Start");
register_logevent("EventRoundEnd", 2, "1=Round_End");
register_logevent("EventRestartRound", 2, "1&Restart_Round_");
register_menucmd(register_menuid("BuyRifle", true), (1<<4|1<<5), "BuyRifle_Handle");
register_clcmd("menuselect", "MenuSelect");
register_clcmd("awp", "AwpBuy");
register_clcmd("magnum", "AwpBuy");
RegisterHam(Ham_AddPlayerItem, "player", "AddItem");
RegisterHam(Ham_RemovePlayerItem, "player", "RemoveItem");
RegisterHam(Ham_Spawn, "player", "SpawnPlayer", true);
#if defined RETURN_MONEY
g_MoneyMsgID = get_user_msgid("Money");
#endif
gCvar[CVAR_ONLINE] = register_cvar("awp_players_low", "11"); //Если онлайн ниже указнного в кваре, в конце раунда у всех отберет авп, и запретит ее. (Что бы отключить поставьте 0) [стандартно: при онлайне меньше 8]
gCvar[CVAR_LIMIT_AWP_STATUS] = register_cvar("awp_limit", "1"); //Включить|Выключить лимит авп [Стандартно: включен]
gCvar[CVAR_LIMIT_MAX_AWP] = register_cvar("awp_limit_max", "1"); //Сколько АВП разрешено при лимите [Стандартно по 2 авп на команду] | Если раскоментирован PERCENT_PLAYERS, то сюда вписывать нужный процент
gCvar[CVAR_LIMIT_IMMUN] = register_cvar("awp_limit_immun", "1"); //Включить|Выключить иммунитет от лимита(Людей с флагом не учитывает вообще) [Стандартно включен]
gCvar[CVAR_BUYTIME] = get_cvar_pointer("mp_buytime");
}
public client_disconnect(id) if(IsPlayer(id)) minus_awp(id);
public EventRestartRound(){
sAwp[TEAM_CT] = 0;
sAwp[TEAM_TERRORIST] = 0;
arrayset(gAwp, AWP_NONE, sizeof gAwp);
}
public EventRoundStart(){
gBuy = true;
set_task(get_pcvar_float(gCvar[CVAR_BUYTIME]) * 60.0, "off_buy", 333);
}
public off_buy()
gBuy = false;
public EventRoundEnd(){
new players[32];
#if defined ALLPLAYERS
get_players(players, gCount);
#else
get_players(players, gCount, "ch");
#endif
#if defined PERCENT_PLAYERS
const MAX_PERCENT = 100;
gLimit = gCount * get_pcvar_num(gCvar[CVAR_LIMIT_MAX_AWP]) / MAX_PERCENT;
#endif
if(gCount >= get_pcvar_num(gCvar[CVAR_ONLINE]))
return PLUGIN_CONTINUE;
for(new i = 0, id; i < gCount; i ++){
id = players;
#if defined ALLPLAYERS
if(!is_user_valid(id))
continue;
#endif
if(gAwp[id] == AWP_NONE)
continue;
fm_strip_user_gun(id, CSW_AWP);
#if defined RETURN_MONEY
if(gAwp[id] == AWP_BUY){
new gMoney = fm_get_user_money(id) + MONEY_AWP;
fm_set_user_money(id, gMoney);
}
#endif
client_print_color(id, false, "%s %s", MSG_PREFIX, MSG_LOWONLINE);
}
EventRestartRound();
return PLUGIN_CONTINUE;
}
public SpawnPlayer(id){
if(!is_user_alive(id))
return HAM_IGNORED;
gTeam[id] = fm_get_user_team(id);
return HAM_IGNORED;
}
public AddItem(id, wId){
if(fm_get_weaponid(wId) != CSW_AWP)
return HAM_IGNORED;
if(!check_awp(id, AWP_PICK_UP))
set_task(0.1, "delawp", id); //Костыли one love
return HAM_IGNORED;
}
public delawp(id)
fm_strip_user_gun(id, CSW_AWP);
public RemoveItem(id, iEnt){
if(fm_get_weaponid(iEnt) == CSW_AWP)
minus_awp(id);
}
public BuyRifle_Handle(id, key){
if(key != (gTeam[id] == TEAM_TERRORIST ? 4 : 5))
return PLUGIN_CONTINUE;
set_task(0.1, "mega_kostil", id);
if(!check_awp(id, AWP_BUY))
return PLUGIN_HANDLED;
return PLUGIN_CONTINUE;
}
public MenuSelect(id){
if(get_menuid(id) != idRifleMenu)
return PLUGIN_CONTINUE;
new szSlot[3], Slot;
read_argv(true, szSlot, charsmax(szSlot));
Slot = str_to_num(szSlot);
if(Slot != (gTeam[id] == TEAM_TERRORIST ? 5 : 6))
return PLUGIN_CONTINUE;
set_task(0.1, "mega_kostil", id);
if(!check_awp(id, AWP_BUY))
return PLUGIN_HANDLED;
return PLUGIN_CONTINUE;
}
public mega_kostil(id)
set_pdata_int(id, iMenu, idNoMenu);
public AwpBuy(id){
if(!check_awp(id, AWP_BUY))
return PLUGIN_HANDLED;
return PLUGIN_CONTINUE;
}
//Native's
public plugin_natives()
register_native("awpoff_check", "check_native", true);
public check_native(id)
return check_awp(id, AWP_NONE);
//Native's
check_awp(id, type){
if(gAwp[id] != AWP_NONE || !is_user_valid(id) || !is_user_alive(id))
return true;
if(!gBuy && type == AWP_BUY) //Ничего умнее не придумал (1)
return false;
new gMoney = fm_get_user_money(id), AWP_COST = 4750; //Ничего умнее не придумал (2)
if(gMoney < AWP_COST && type == AWP_BUY)
return false;
gAwp[id] = type;
if(gCount < get_pcvar_num(gCvar[CVAR_ONLINE]))
client_print_color(id, false, "%s %s", MSG_PREFIX, MSG_LOWONLINE);
else if(get_pcvar_num(gCvar[CVAR_LIMIT_AWP_STATUS])){
if(get_pcvar_num(gCvar[CVAR_LIMIT_IMMUN]) && get_user_flags(id) & FLAG)
return true;
#if defined PERCENT_PLAYERS
if(sAwp[gTeam[id]] < gLimit)
#else
if(sAwp[gTeam[id]] < get_pcvar_num(gCvar[CVAR_LIMIT_MAX_AWP]))
#endif
{
if(type != AWP_NONE)
sAwp[gTeam[id]] ++;
return true;
}else
client_print_color(id, false, "%s %s", MSG_PREFIX, MSG_LIMIT);
}else
return true;
gAwp[id] = AWP_NONE;
return false;
}
minus_awp(id){
if(!is_user_valid(id) || gAwp[id] == AWP_NONE)
return;
gAwp[id] = AWP_NONE;
if(!get_pcvar_num(gCvar[CVAR_LIMIT_AWP_STATUS]))
return;
if(get_pcvar_num(gCvar[CVAR_LIMIT_IMMUN]) && get_user_flags(id) & FLAG)
return;
sAwp[gTeam[id]] --;
}
#if defined RETURN_MONEY
fm_set_user_money(id, money){
set_pdata_int(id, iMoney, money);
message_begin(MSG_ONE_UNRELIABLE, g_MoneyMsgID, _, id);
write_long(money);
write_byte(true);
message_end();
}
#endif
is_user_valid(id){
if(is_user_bot(id)) return false;
if(is_user_hltv(id)) return false;
return true;
}
#include < hamsandwich >
#include < fakemeta_util >
#if AMXX_VERSION_NUM < 183
#include < colorchat >
#define MAX_PLAYERS 32
#endif
//■■■■■■■■■■■■■■■■■■■■■■■ CONFIG START ■■■■■■■■■■■■■■■■■■■■■■■//
#define ALLPLAYERS
/*
Закоментируйте, чтобы для проверки на онлайн брались только люди(ботов и хлтв считать не будет).
Пример:
Допустим на сервере 5 ботов и 2 человека 1 хлтв.
Дефайн закоментирован: Посчитает, что на сервере 2 из Максимально возможных игроков.
Дефайн раскоментирован: Посчитает, что на сервере 8 игроков из Максимально возможных игроков (5 ботов + 2 человека + 1 хлтв).
Отбирать авп будет ТОЛЬКО У ЛЮДЕЙ в любом случае.
*/
// ^4 - зелёный | ^3 - цвет тимы (КТ - синий | Т - красный | SPEC - серый) | ^1 - жёлтый
#define MSG_PREFIX "^3[^4AWP^3]"
#define MSG_LOWONLINE "У вас^4 отобрано^3 AWP. Причина:^4 низкий онлайн."
#define MSG_LIMIT "У вас^4 отобрано^3 AWP. Причина:^4 превышен лимит."
#define FLAG ADMIN_BAN //Флаг для иммунитета от лимита
#define RETURN_MONEY //Возвращать деньги при отборе авп в конце раунда из-за низкого онлайна? (Закоментируйте, если не хотите, чтобы возвращало деньги)
#if defined RETURN_MONEY
#define MONEY_AWP 4750 //Сколько денег возвращать?
new g_MoneyMsgID;
#endif
//#define PERCENT_PLAYERS
/*
Разкоменитруйте, если хотите чтобы лимит зависил от процента игроков [I am chetko ob'yasnyat']
Например: Онлайн = 10, Процент в кваре(awp_limit_max) = 20
10/100*20 = 2 авп на тиму (2 у терров и 2 у кт)
*/
//■■■■■■■■■■■■■■■■■■■■■■■■ CONFIG END ■■■■■■■■■■■■■■■■■■■■■■■■//
const iMoney = 115;
const iMenu = 205;
const iTeam = 114;
const idRifleMenu = 6;
const idNoMenu = 0;
const OFFSET_LINUX_WEAPONS = 4;
const OFFSET_WEAPONID = 43;
#define get_menuid(%0) get_pdata_int(%0, iMenu)
#define fm_get_user_team(%0) ETEAMS:get_pdata_int(%0, iTeam)
#define fm_get_weaponid(%0) get_pdata_int(%0, OFFSET_WEAPONID, OFFSET_LINUX_WEAPONS)
#define fm_get_user_money(%0) get_pdata_int(%0 , iMoney)
#define IsPlayer(%0) (0 < %0 < 33)
enum ETEAMS {
TEAM_TERRORIST = 1,
TEAM_CT,
TEAM_SPECTATOR
};
enum ECVARS {
CVAR_ONLINE = 0,
CVAR_LIMIT_AWP_STATUS,
CVAR_LIMIT_MAX_AWP,
CVAR_LIMIT_IMMUN,
CVAR_BUYTIME
};
enum {
AWP_NONE = 0,
AWP_BUY,
AWP_PICK_UP
};
new gBuy = true;
new sAwp[ETEAMS: TEAM_SPECTATOR], gCount, gCvar[ECVARS], gAwp[MAX_PLAYERS + 1], ETEAMS: gTeam[MAX_PLAYERS + 1];
#if defined PERCENT_PLAYERS
new gLimit;
#endif
public plugin_init(){
register_plugin("AWPoff", "1.6", "PAffAEJIkA :3");
new mapname[32];
get_mapname(mapname, charsmax(mapname));
new maps[][] = { "awp", "aim", "35hp", "$" };
for(new i; i < sizeof maps; i++){
if(containi(mapname, maps) != -1){
pause("ad");
return;
}
}
register_logevent("EventRoundStart", 2, "1=Round_Start");
register_logevent("EventRoundEnd", 2, "1=Round_End");
register_logevent("EventRestartRound", 2, "1&Restart_Round_");
register_menucmd(register_menuid("BuyRifle", true), (1<<4|1<<5), "BuyRifle_Handle");
register_clcmd("menuselect", "MenuSelect");
register_clcmd("awp", "AwpBuy");
register_clcmd("magnum", "AwpBuy");
RegisterHam(Ham_AddPlayerItem, "player", "AddItem");
RegisterHam(Ham_RemovePlayerItem, "player", "RemoveItem");
RegisterHam(Ham_Spawn, "player", "SpawnPlayer", true);
#if defined RETURN_MONEY
g_MoneyMsgID = get_user_msgid("Money");
#endif
gCvar[CVAR_ONLINE] = register_cvar("awp_players_low", "11"); //Если онлайн ниже указнного в кваре, в конце раунда у всех отберет авп, и запретит ее. (Что бы отключить поставьте 0) [стандартно: при онлайне меньше 8]
gCvar[CVAR_LIMIT_AWP_STATUS] = register_cvar("awp_limit", "1"); //Включить|Выключить лимит авп [Стандартно: включен]
gCvar[CVAR_LIMIT_MAX_AWP] = register_cvar("awp_limit_max", "1"); //Сколько АВП разрешено при лимите [Стандартно по 2 авп на команду] | Если раскоментирован PERCENT_PLAYERS, то сюда вписывать нужный процент
gCvar[CVAR_LIMIT_IMMUN] = register_cvar("awp_limit_immun", "1"); //Включить|Выключить иммунитет от лимита(Людей с флагом не учитывает вообще) [Стандартно включен]
gCvar[CVAR_BUYTIME] = get_cvar_pointer("mp_buytime");
}
public client_disconnect(id) if(IsPlayer(id)) minus_awp(id);
public EventRestartRound(){
sAwp[TEAM_CT] = 0;
sAwp[TEAM_TERRORIST] = 0;
arrayset(gAwp, AWP_NONE, sizeof gAwp);
}
public EventRoundStart(){
gBuy = true;
set_task(get_pcvar_float(gCvar[CVAR_BUYTIME]) * 60.0, "off_buy", 333);
}
public off_buy()
gBuy = false;
public EventRoundEnd(){
new players[32];
#if defined ALLPLAYERS
get_players(players, gCount);
#else
get_players(players, gCount, "ch");
#endif
#if defined PERCENT_PLAYERS
const MAX_PERCENT = 100;
gLimit = gCount * get_pcvar_num(gCvar[CVAR_LIMIT_MAX_AWP]) / MAX_PERCENT;
#endif
if(gCount >= get_pcvar_num(gCvar[CVAR_ONLINE]))
return PLUGIN_CONTINUE;
for(new i = 0, id; i < gCount; i ++){
id = players;
#if defined ALLPLAYERS
if(!is_user_valid(id))
continue;
#endif
if(gAwp[id] == AWP_NONE)
continue;
fm_strip_user_gun(id, CSW_AWP);
#if defined RETURN_MONEY
if(gAwp[id] == AWP_BUY){
new gMoney = fm_get_user_money(id) + MONEY_AWP;
fm_set_user_money(id, gMoney);
}
#endif
client_print_color(id, false, "%s %s", MSG_PREFIX, MSG_LOWONLINE);
}
EventRestartRound();
return PLUGIN_CONTINUE;
}
public SpawnPlayer(id){
if(!is_user_alive(id))
return HAM_IGNORED;
gTeam[id] = fm_get_user_team(id);
return HAM_IGNORED;
}
public AddItem(id, wId){
if(fm_get_weaponid(wId) != CSW_AWP)
return HAM_IGNORED;
if(!check_awp(id, AWP_PICK_UP))
set_task(0.1, "delawp", id); //Костыли one love
return HAM_IGNORED;
}
public delawp(id)
fm_strip_user_gun(id, CSW_AWP);
public RemoveItem(id, iEnt){
if(fm_get_weaponid(iEnt) == CSW_AWP)
minus_awp(id);
}
public BuyRifle_Handle(id, key){
if(key != (gTeam[id] == TEAM_TERRORIST ? 4 : 5))
return PLUGIN_CONTINUE;
set_task(0.1, "mega_kostil", id);
if(!check_awp(id, AWP_BUY))
return PLUGIN_HANDLED;
return PLUGIN_CONTINUE;
}
public MenuSelect(id){
if(get_menuid(id) != idRifleMenu)
return PLUGIN_CONTINUE;
new szSlot[3], Slot;
read_argv(true, szSlot, charsmax(szSlot));
Slot = str_to_num(szSlot);
if(Slot != (gTeam[id] == TEAM_TERRORIST ? 5 : 6))
return PLUGIN_CONTINUE;
set_task(0.1, "mega_kostil", id);
if(!check_awp(id, AWP_BUY))
return PLUGIN_HANDLED;
return PLUGIN_CONTINUE;
}
public mega_kostil(id)
set_pdata_int(id, iMenu, idNoMenu);
public AwpBuy(id){
if(!check_awp(id, AWP_BUY))
return PLUGIN_HANDLED;
return PLUGIN_CONTINUE;
}
//Native's
public plugin_natives()
register_native("awpoff_check", "check_native", true);
public check_native(id)
return check_awp(id, AWP_NONE);
//Native's
check_awp(id, type){
if(gAwp[id] != AWP_NONE || !is_user_valid(id) || !is_user_alive(id))
return true;
if(!gBuy && type == AWP_BUY) //Ничего умнее не придумал (1)
return false;
new gMoney = fm_get_user_money(id), AWP_COST = 4750; //Ничего умнее не придумал (2)
if(gMoney < AWP_COST && type == AWP_BUY)
return false;
gAwp[id] = type;
if(gCount < get_pcvar_num(gCvar[CVAR_ONLINE]))
client_print_color(id, false, "%s %s", MSG_PREFIX, MSG_LOWONLINE);
else if(get_pcvar_num(gCvar[CVAR_LIMIT_AWP_STATUS])){
if(get_pcvar_num(gCvar[CVAR_LIMIT_IMMUN]) && get_user_flags(id) & FLAG)
return true;
#if defined PERCENT_PLAYERS
if(sAwp[gTeam[id]] < gLimit)
#else
if(sAwp[gTeam[id]] < get_pcvar_num(gCvar[CVAR_LIMIT_MAX_AWP]))
#endif
{
if(type != AWP_NONE)
sAwp[gTeam[id]] ++;
return true;
}else
client_print_color(id, false, "%s %s", MSG_PREFIX, MSG_LIMIT);
}else
return true;
gAwp[id] = AWP_NONE;
return false;
}
minus_awp(id){
if(!is_user_valid(id) || gAwp[id] == AWP_NONE)
return;
gAwp[id] = AWP_NONE;
if(!get_pcvar_num(gCvar[CVAR_LIMIT_AWP_STATUS]))
return;
if(get_pcvar_num(gCvar[CVAR_LIMIT_IMMUN]) && get_user_flags(id) & FLAG)
return;
sAwp[gTeam[id]] --;
}
#if defined RETURN_MONEY
fm_set_user_money(id, money){
set_pdata_int(id, iMoney, money);
message_begin(MSG_ONE_UNRELIABLE, g_MoneyMsgID, _, id);
write_long(money);
write_byte(true);
message_end();
}
#endif
is_user_valid(id){
if(is_user_bot(id)) return false;
if(is_user_hltv(id)) return false;
return true;
}
aes_statsx.amxx
amx_gag.amxx
admin_loader_for_fb.amxx
opengl_detector.amxx
aim_detector.amxx
advanced_experience_system.amxx
;amxbans_core.amxx
fresh_bans.amxx
dop_ban.amxx
map_chooser.amxx
yet_another_spamguard.amxx
;;;second_load
admincmd.amxx
cmdmenu.amxx
mapsmenu.amxx
plmenu.amxx
pluginmenu.amxx
restmenu.amxx
adminvote.amxx
miscstats.amxx
stats_logging.amxx
statscfg.amxx
admin_check.amxx
parachute_new.amxx
perm_mute_mute.amxx
super_weaponmenu.amxx
block_cheat_key.amxx
demorecoder.amxx
aes_cstrike_say_tag.amxx
aes_status_info.amxx
lite_translit.amxx
mode_2x2.amxx
amxmodmenu_public.amxx
admin_esp_mini.amxx
steam_bonus.amxx
block_spawn_for_reconnect.amxx
high_ping_kicker.amxx
resetscore_by_jd.amxx
health_grenade.amxx
vip_custom_weapons.amxx
auto_change_map.amxx
afk_control.amxx
knife_start.amxx
;supplybox.amxx
statsx.amxx
lite_voteban.amxx
reklama_in_chat.amxx
hlds_awp_off.amxx
adminmenu.amxx
amx_gag.amxx
admin_loader_for_fb.amxx
opengl_detector.amxx
aim_detector.amxx
advanced_experience_system.amxx
;amxbans_core.amxx
fresh_bans.amxx
dop_ban.amxx
map_chooser.amxx
yet_another_spamguard.amxx
;;;second_load
admincmd.amxx
cmdmenu.amxx
mapsmenu.amxx
plmenu.amxx
pluginmenu.amxx
restmenu.amxx
adminvote.amxx
miscstats.amxx
stats_logging.amxx
statscfg.amxx
admin_check.amxx
parachute_new.amxx
perm_mute_mute.amxx
super_weaponmenu.amxx
block_cheat_key.amxx
demorecoder.amxx
aes_cstrike_say_tag.amxx
aes_status_info.amxx
lite_translit.amxx
mode_2x2.amxx
amxmodmenu_public.amxx
admin_esp_mini.amxx
steam_bonus.amxx
block_spawn_for_reconnect.amxx
high_ping_kicker.amxx
resetscore_by_jd.amxx
health_grenade.amxx
vip_custom_weapons.amxx
auto_change_map.amxx
afk_control.amxx
knife_start.amxx
;supplybox.amxx
statsx.amxx
lite_voteban.amxx
reklama_in_chat.amxx
hlds_awp_off.amxx
adminmenu.amxx
Последнее редактирование: