Администратор
- Сообщения
- 3,023
- Реакции
- 1,731
- Помог
- 79 раз(а)
- Ошибка
-
Плагин не блокирует оружие,
- ОС
- Linux
- Amx Mod X
-
AMX Mod X 1.9.0.5241 (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: Jan 30 2019 07:09:07
Built from: https://github.com/alliedmodders/amxmodx/commit/2110037
Build ID: 5241:2110037
Core mode: JIT+ASM32
- Билд
-
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.4.0.669-dev
Build date: 18:21:09 Mar 29 2019 (1812)
Build from: https://github.com/dreamstalker/rehlds/commit/f6822e3
- ReGamedll
-
ReGameDLL version: 5.7.0.322-dev
Build date: 11:41:14 Jan 13 2019
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/7398bb7
- Версия Metamod
-
Metamod-r v1.3.0.128, API (5:13)
Metamod-r build: 17:47:54 Aug 24 2018
Metamod-r from: https://github.com/theAsmodai/metamod-r/commit/0cf2f70
- Список метамодулей
-
[ 1] Reunion RUN - reunion_mm_i386.so v0.1.75 ini Start Never
[ 2] ReAuthCheck RUN - reauthcheck_mm_i386.so v0.1.7 ini Start Never
[ 3] AMX Mod X RUN - amxmodx_mm_i386.so v1.9.0.5241 ini Start ANY
[ 4] WHBlocker RUN - whblocker_mm_i386.so v1.5.696 ini Chlvl ANY
[ 5] ReAimDetector RUN - reaimdetector_amxx_i386.so v0.2.2 pl3 ANY Never
[ 6] hackdetector RUN - hackdetector_amxx_i386.so v0.15.328.lite pl3 ANY ANY
[ 7] MySQL RUN - mysql_amxx_i386.so v1.9.0.5241 pl3 ANY ANY
[ 8] ReAPI RUN - reapi_amxx_i386.so v5.8.0.165-dev pl3 ANY Never
[ 9] FakeMeta RUN - fakemeta_amxx_i386.so v1.9.0.5241 pl3 ANY ANY
[10] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.9.0.5241 pl3 ANY ANY
[11] Engine RUN - engine_amxx_i386.so v1.9.0.5241 pl3 ANY ANY
[12] CStrike RUN - cstrike_amxx_i386.so v1.9.0.5241 pl3 ANY ANY
[13] ReCSDM RUN - csdm_amxx_i386.so v3.6 pl3 ANY ANY
13 plugins, 13 running
- Список плагинов
-
[ 1] ReAimDetector API 0.2.2 ReHLDS Team reaimdetector.a running
[ 2] fb_forwards 0.1.4 Kanagava & Realu fb_forwards.amx running
[ 3] Admin Load 3.9.3 Dev F@nt0M adminload_3_9_3 running
[ 4] Items Restrict Ultimat 0.0.4 Vaqtincha items_restrict_ running
[ 5] FreshBans 1.4.0b kanagava fresh_bans_140_ running
[ 6] [ReAPI] Only HeadShot 0.0.2 Vaqtincha only_hs_vaqtinc running
[ 7] Server Menu 1.5.0 F@nt0M server_menu_fan debug
[ 8] CSDM Spawn Protection 0.0.1-alph F@nt0M csdm_spawn_prot running
[ 9] CSDM Spawn Manager 0.1.1+fix Vaqtincha csdm_spawn_mana running
[ 10] Scrollblocker#Dirty 0.0.1 wopox1337 ant_dd_scroll_w running
[ 11] New Kick Menu 1.2.8 Radius newkickmenu.amx running
[ 12] Admin Commands 1.9.0.5241 AMXX Dev Team admincmd.amxx running
[ 13] Menus Front-End 1.9.0.5241 AMXX Dev Team menufront.amxx running
[ 14] Commands Menu 1.9.0.5241 AMXX Dev Team cmdmenu.amxx running
[ 15] Players Menu 1.9.0.5241 AMXX Dev Team plmenu.amxx running
[ 16] Maps Menu 1.9.0.5241 AMXX Dev Team mapsmenu.amxx running
[ 17] Admin Chat 1.9.0.5241 AMXX Dev Team adminchat.amxx running
[ 18] Admin Votes 1.9.0.5241 AMXX Dev Team adminvote.amxx running
[ 19] Anti Flood 1.9.0.5241 AMXX Dev Team antiflood.amxx running
[ 20] CSStatsX SQL 0.7.4 serfreeman1337 csstatsx_sql.am running
[ 21] AES: StatsX 0.5.9 [REA serfreeman1337/s aes_statsx_cstr running
[ 22] nice Demo 1.0 sector nice_demo.amxx running
[ 23] Advert Messages 1.3.3 neygomon | Radiu advert_messages running
[ 24] Gag Me 1.7.2 Radius gag_me.amxx running
[ 25] Killer ScreenFade 0.0.6 Vaqtincha reapi_killer_sc running
[ 26] Refill Weapon On Kill 0.0.1 Vaqtincha refill_weapon_o running
[ 27] Money as Frag Counter 0.1 Safety1st money_frag_coun running
[ 28] Fake Ping 1.0 MeRcyLeZZ/gyxoBk FakePing.amxx running
[ 29] Team Replace 1.0 Ish Chhabra task4.amxx debug
[ 30] AMXX God 0.1 F@tn0M amx_god.amxx running
[ 31] Fake Ping For Bots 1.0 fl0wer fake_ping_for_b running
[ 32] ReCSDM Main 3.6 ReCSDM Team csdm_main.amxx debug
[ 33] ReCSDM Equip 3.6 ReCSDM Team csdm_equip.amxx debug
[ 34] ReCSDM Misc 3.6 ReCSDM Team csdm_misc.amxx debug
[ 35] ReCSDM Stripper 3.6 KWo csdm_stripper.a running
[ 36] Map Manager: Core 3.0.0 Mistrick map_manager_cor running
[ 37] Map Manager: Scheduler 0.1.0 Mistrick map_manager_sch running
[ 38] Map Manager: Rtv 0.0.4 Mistrick map_manager_rtv running
[ 39] Map Manager: Nominatio 0.0.8 Mistrick map_manager_nom running
[ 40] Map Manager: BlockList 0.0.3 Mistrick map_manager_blo running
[ 41] Map Manager: Online so 0.0.2 Mistrick map_manager_onl running
[ 42] Map Manager: Effects 0.0.8 Mistrick map_manager_eff running
[ 43] Map Manager: Informer 0.0.5 Mistrick map_manager_inf running
43 plugins, 43 running
- Автор плагина
- vaqtincha
- Версия плагина
- 0.0.4
- Исходный код
-
// Copyright © 2017 Vaqtincha
/**
* Credits:
*
* - s1lent - for original plugin "Items Restrict"
*/
/* Default restrict flags:
"a" = buying
"b" = touching
"c" = equipping
*/
new const DEFAULT_FLAGS[4] = "abc"
// #define DEBUG_INFO
#include <amxmodx>
#include <reapi>
#define PL_VERSION "0.0.4"
#define IsValidFlag(%1) (RESTRICT_FLAG_BUY <= %1 <= RESTRICT_FLAG_ALL) // (%1 < 1 || %1 > 7 )
#define IsValidItem(%1) (ITEM_SHIELDGUN <= %1 <= ITEM_BATTERY && %1 != ITEM_GLOCK)
#define IsRestrictedItem(%1) (g_bitItemFlags[%1] != RESTRICT_FLAG_NONE)
#define HasFlag(%1,%2) (g_bitItemFlags[%1] & (1 << any:%2)) // %1 ItemId, %2 ItemRestType
#define IsValidAmmo(%1) (1 <= %1 < MAX_AMMO_SLOTS)
#define GetAmmoType(%1) rg_get_weapon_info(%1, WI_AMMO_TYPE)
#define IsRestrictedAmmo(%1) (g_bitRestrictedAmmo & (1 << %1))
#define PlayerHasMaxAmmo(%1,%2) (get_member(%1, m_rgAmmo, %2) >= g_iMaxAmmoDefault[%2])
enum
{
RESTRICT_FLAG_NONE = 0,
RESTRICT_FLAG_BUY = (1 << any:ITEM_TYPE_BUYING), // a = 1
RESTRICT_FLAG_TOUCH = (1 << any:ITEM_TYPE_TOUCHED), // b = 2
RESTRICT_FLAG_EQUIP = (1 << any:ITEM_TYPE_EQUIPPED) // c = 4
}
const RESTRICT_FLAG_ALL = (RESTRICT_FLAG_BUY | RESTRICT_FLAG_TOUCH | RESTRICT_FLAG_EQUIP) // abc = 7
const MAX_AMMO_SLOTS = 15 - 4
new HookChain:g_hookHasRestrictItem, HookChain:g_hookBuyGunAmmo
new Trie:g_tItemNames, Trie:g_tAmmoNames
new bool:g_bHasRestrictItem, g_iICounter
new bool:g_bBuyGunAmmo, g_iACounter
new g_bitItemFlags[any:ITEM_BATTERY + 1]
new g_bitRestrictedAmmo
new const g_iMaxAmmoDefault[MAX_AMMO_SLOTS] = {
-1, 30, 90, 200, 90, 32, 100, 100, 35, 52, 120 //, 2, 1, 1, 1
}
new const g_szValidItemNames[any:ITEM_BATTERY + 1][] =
{
// [weapons]
"shield",
"p228",
"", // unused
"scout",
"hegren", // hegrenade
"xm1014",
"c4",
"mac10",
"aug",
"smoke", // smokegrenade
"elite",
"fiveseven",
"ump45",
"sg550",
"galil",
"famas",
"usp",
"glock", // glock18
"awp",
"mp5", // mp5navy
"m249",
"m3",
"m4a1",
"tmp",
"g3sg1",
"flash", // flashbang
"deagle",
"sg552",
"ak47",
"knife",
"p90",
// [items]
"nvgs", // nightvision
"defuser",
"vest", // kevlar
"vesthelm", // helmet
"longjump",
"soda",
"healthkit",
"antidote",
"battery"
}
new const g_szValidAmmoNames[MAX_AMMO_SLOTS][] = {
"",
"338Magnum", // 1
"762Nato", // 2
"556NatoBox", // 3
"556Nato", // 4
"buckshot", // 5
"45acp", // 6
"57mm", // 7
"50AE", // 8
"357SIG", // 9
"9mm" // 10
// ,"Flashbang", // 11
// "HEGrenade", // 12
// "SmokeGrenade", // 14
// "C4" // 15
}
public plugin_init()
{
register_plugin("Items Restrict Ultimate", PL_VERSION, "Vaqtincha")
register_concmd("amx_rest", "ConCmd_ManageItem", ADMIN_CFG, "- add/remove item to/from list")
register_concmd("amx_restrict", "ConCmd_ManageItem", ADMIN_CFG, "- add/remove item to/from list")
register_concmd("amx_restammo", "ConCmd_ManageAmmo", ADMIN_CFG, "- add/remove ammo to/from list")
register_concmd("amx_restrictammo", "ConCmd_ManageAmmo", ADMIN_CFG, "- add/remove ammo to/from list")
DisableHookChain(g_hookHasRestrictItem = RegisterHookChain(RG_CBasePlayer_HasRestrictItem, "CBasePlayer_HasRestrictItem", .post = false))
DisableHookChain(g_hookBuyGunAmmo = RegisterHookChain(RG_BuyGunAmmo, "BuyGunAmmo", .post = false))
g_tItemNames = TrieCreate()
g_tAmmoNames = TrieCreate()
for(new ItemID:iItemId = ITEM_SHIELDGUN; iItemId <= ITEM_BATTERY; iItemId++)
{
TrieSetCell(g_tItemNames, g_szValidItemNames[iItemId], iItemId)
}
for(new iAmmoId = 1; iAmmoId < MAX_AMMO_SLOTS; iAmmoId++)
{
strtolower(g_szValidAmmoNames[iAmmoId])
TrieSetCell(g_tAmmoNames, g_szValidAmmoNames[iAmmoId], iAmmoId)
}
}
public plugin_cfg()
{
// admin.sma: set_task(6.1, "delayed_load") map extra config loading
set_task(6.2, "MapExtraCfgLoaded")
}
public MapExtraCfgLoaded()
{
I_CheckForward()
A_CheckForward()
}
public plugin_end()
{
if(g_tItemNames) {
TrieDestroy(g_tItemNames)
}
if(g_tAmmoNames) {
TrieDestroy(g_tAmmoNames)
}
}
public BuyGunAmmo(const pPlayer, const pWeapon, const bool:blinkMoney)
{
if(pWeapon <= 0)
return HC_CONTINUE
new iAmmoId = GetAmmoType(get_member(pWeapon, m_iId))
if(IsValidAmmo(iAmmoId) && IsRestrictedAmmo(iAmmoId) && !PlayerHasMaxAmmo(pPlayer, iAmmoId))
{
client_print(pPlayer, print_center, "* Ammo %s is restricted! *", g_szValidAmmoNames[iAmmoId])
SetHookChainReturn(ATYPE_INTEGER, false)
return HC_SUPERCEDE
}
return HC_CONTINUE
}
public CBasePlayer_HasRestrictItem(const pPlayer, const ItemID:iItemId, const ItemRestType:iRestType)
{
if(!IsValidItem(iItemId) || !IsRestrictedItem(iItemId))
return HC_CONTINUE
if(HasFlag(iItemId, iRestType))
{
if(iRestType == ITEM_TYPE_BUYING) {
client_print(pPlayer, print_center, "* Item %s is restricted! *", g_szValidItemNames[iItemId])
}
// return true, let's restrict up this item
SetHookChainReturn(ATYPE_INTEGER, true)
return HC_SUPERCEDE
}
return HC_CONTINUE
}
public ConCmd_ManageAmmo(const pPlayer, const level)
{
if(pPlayer > 0 && !(get_user_flags(pPlayer) & level))
return PLUGIN_HANDLED
new szCommand[5], szAmmoName[12], iNumArgs = read_argc()
read_argv(1, szCommand, charsmax(szCommand))
if(iNumArgs == 2 && equali(szCommand, "list"))
{
#if defined DEBUG_INFO
console_print(pPlayer, "^nBuyGunAmmo Forward: %sABLED | Counter: %d | Bits: %d", g_bBuyGunAmmo ? "EN" : "DIS", g_iACounter, g_bitRestrictedAmmo)
#endif
console_print(pPlayer, "^nRestricted ammo:^n %-4.5s %-10.11s", "id", "name")
for(new iAmmoId = 1; iAmmoId < MAX_AMMO_SLOTS; iAmmoId++)
{
if(IsRestrictedAmmo(iAmmoId)) {
console_print(pPlayer, " %-4.5d %-10.11s", iAmmoId, g_szValidAmmoNames[iAmmoId])
}
}
return PLUGIN_HANDLED
}
else if(iNumArgs < 3)
{
console_print(pPlayer, "[Restrict] USAGE: amx_restrictammo <on|off> <ammoname|ammoid>")
return PLUGIN_HANDLED
}
read_argv(2, szAmmoName, charsmax(szAmmoName))
strtolower(szAmmoName)
if(RestrictAmmo(szAmmoName, szCommand[1])) {
A_CheckForward()
}
return PLUGIN_HANDLED
}
public ConCmd_ManageItem(const pPlayer, const level)
{
if(pPlayer > 0 && !(get_user_flags(pPlayer) & level))
return PLUGIN_HANDLED
new szCommand[5], szItemName[12], szFlags[4], iNumArgs = read_argc()
read_argv(1, szCommand, charsmax(szCommand))
if(iNumArgs == 2 && equali(szCommand, "list"))
{
#if defined DEBUG_INFO
console_print(pPlayer,"^nHasRestrictItem Forward: %sABLED | Counter: %d", g_bHasRestrictItem ? "EN" : "DIS", g_iICounter)
console_print(pPlayer, "^nRestricted items:^n %-4.5s %-10.11s %-6.7s %-5.6s", "id", "name", "flags", "bits")
#else
console_print(pPlayer, "^nRestricted items:^n %-4.5s %-10.11s %-6.7s", "id", "name", "flags")
#endif
for(new ItemID:iItemId = ITEM_SHIELDGUN; iItemId <= ITEM_BATTERY; iItemId++)
{
if(!IsValidItem(iItemId) || !IsRestrictedItem(iItemId))
continue
get_flags(g_bitItemFlags[iItemId], szFlags, charsmax(szFlags))
#if defined DEBUG_INFO
console_print(pPlayer, " %-4.5d %-10.11s %-6.7s %-5.6d", iItemId, g_szValidItemNames[iItemId], szFlags, g_bitItemFlags[iItemId])
#else
console_print(pPlayer, " %-4.5d %-10.11s %-6.7s", iItemId, g_szValidItemNames[iItemId], szFlags)
#endif
}
return PLUGIN_HANDLED
}
else if(iNumArgs < 3)
{
console_print(pPlayer, "[Restrict] USAGE: amx_restrict <on|off> <itemname|itemid> <flags>")
console_print(pPlayer,
"^nOptional restrict flags: (^"%s^" by default) \
^n ^"a^" = buying \
^n ^"b^" = touching \
^n ^"c^" = equipping", DEFAULT_FLAGS
)
return PLUGIN_HANDLED
}
read_argv(2, szItemName, charsmax(szItemName))
if(iNumArgs == 4) {
read_argv(3, szFlags, charsmax(szFlags)) // optional
}
strtolower(szItemName)
if(RestrictItem(szItemName, szFlags[0] ? szFlags : DEFAULT_FLAGS, szCommand[1], bool:(iNumArgs == 4))) {
I_CheckForward()
}
return PLUGIN_HANDLED
}
bool:RestrictItem(const szItemName[], const szFlags[], const ch, const bool:bitSet)
{
new ItemID:iItemId = ITEM_NONE
if(is_str_num(szItemName)) // add by item index
{
iItemId = any:str_to_num(szItemName)
if(!IsValidItem(iItemId)) {
server_print("[Restrict] ERROR: Invalid item id ^"%d^"", iItemId)
return false
}
}
else if(!szItemName[0] || !TrieGetCell(g_tItemNames, szItemName, iItemId)) // add by item name
{
server_print("[Restrict] ERROR: Invalid item name ^"%s^"", szItemName)
return false
}
new iFlags = read_flags(szFlags)
if(ch == 'n') // on
{
if(!IsValidFlag(iFlags)) {
server_print("[Restrict] WARNING: Wrong flags ^"%s^" trying to set item ^"%s^"", szFlags, g_szValidItemNames[iItemId])
server_print("[Restrict] INFO: Allowed flags ^"abc^"")
return false
}
if((g_bitItemFlags[iItemId] & iFlags) == iFlags) {
server_print("[Restrict] WARNING: Item ^"%s^" already restricted with this flags!", g_szValidItemNames[iItemId])
return false
}
if(g_bitItemFlags[iItemId] == RESTRICT_FLAG_NONE) {
g_iICounter++
}
g_bitItemFlags[iItemId] |= iFlags // set: g_bitItemFlags[iItemId] = iFlags
#if defined DEBUG_INFO
server_print("[Restrict] INFO: Restrict item ^"%s^" id ^"%d^" with flags ^"%s^" bits ^"%d^" itembits ^"%d^"", g_szValidItemNames[iItemId], iItemId, szFlags, iFlags, g_bitItemFlags[iItemId])
#else
server_print("[Restrict] INFO: Restrict item ^"%s^" with flags ^"%s^"", g_szValidItemNames[iItemId], szFlags)
#endif
return true
}
else if(ch == 'f') // off
{
if(!IsRestrictedItem(iItemId)) {
server_print("[Restrict] WARNING: Item ^"%s^" not restricted!", g_szValidItemNames[iItemId])
return false
}
if(!bitSet) // "amx_restrict off awp" = clear all bits 7 (flags "abc")
{
g_bitItemFlags[iItemId] = RESTRICT_FLAG_NONE
server_print("[Restrict] INFO: Unrestrict item ^"%s^" id ^"%d^"", g_szValidItemNames[iItemId], iItemId)
}
else // "amx_restrict off awp b" = clear bit 2 (flag "b" only)
{
if(!IsValidFlag(iFlags))
{
server_print("[Restrict] WARNING: Wrong flags ^"%s^" trying to unset item ^"%s^"", szFlags, g_szValidItemNames[iItemId])
server_print("[Restrict] INFO: Allowed flags ^"abc^"")
return false
}
if((g_bitItemFlags[iItemId] & iFlags) != iFlags)
{
server_print("[Restrict] WARNING: Item ^"%s^" not restricted with this flags!", g_szValidItemNames[iItemId])
return false
}
g_bitItemFlags[iItemId] &= ~iFlags
#if defined DEBUG_INFO
server_print("[Restrict] INFO: Unset item ^"%s^" flags ^"%s^" bits ^"%d^" itembits ^"%d^"", g_szValidItemNames[iItemId], szFlags, iFlags, g_bitItemFlags[iItemId])
#else
server_print("[Restrict] INFO: Unset item ^"%s^" flags ^"%s^"", g_szValidItemNames[iItemId], szFlags)
#endif
}
if(g_bitItemFlags[iItemId] == RESTRICT_FLAG_NONE) {
--g_iICounter
}
return true
}
return false
}
bool:RestrictAmmo(const szAmmoName[], const ch)
{
new iAmmoId
if(is_str_num(szAmmoName)) // add by ammo index
{
iAmmoId = str_to_num(szAmmoName)
if(!IsValidAmmo(iAmmoId)) {
server_print("[Restrict] ERROR: Invalid ammo id ^"%d^"", iAmmoId)
return false
}
}
else if(!szAmmoName[0] || !TrieGetCell(g_tAmmoNames, szAmmoName, iAmmoId)) // add by ammo name
{
server_print("[Restrict] ERROR: Invalid ammo name ^"%s^"", szAmmoName)
return false
}
if(ch == 'n') // on
{
if(IsRestrictedAmmo(iAmmoId)) {
server_print("[Restrict] WARNING: Ammo ^"%s^" already restricted!", g_szValidAmmoNames[iAmmoId])
return false
}
server_print("[Restrict] INFO: Restrict ammo ^"%s^" id ^"%d^"", g_szValidAmmoNames[iAmmoId], iAmmoId)
g_bitRestrictedAmmo |= (1 << iAmmoId)
g_iACounter++
return true
}
else if(ch == 'f') // off
{
if(!IsRestrictedAmmo(iAmmoId)) {
server_print("[Restrict] WARNING: Ammo ^"%s^" not restricted!", g_szValidAmmoNames[iAmmoId])
return false
}
server_print("[Restrict] INFO: Unrestrict ammo ^"%s^" id ^"%d^"", g_szValidAmmoNames[iAmmoId], iAmmoId)
g_bitRestrictedAmmo &= ~(1 << iAmmoId)
--g_iACounter
return true
}
return false
}
I_CheckForward()
{
if(g_iICounter > 0 && !g_bHasRestrictItem)
{
EnableHookChain(g_hookHasRestrictItem)
g_bHasRestrictItem = true
#if defined DEBUG_INFO
server_print("[Restrict] INFO: HasRestrictItem Forward: ENABLED!")
#endif
}
else if(g_iICounter <= 0 && g_bHasRestrictItem)
{
DisableHookChain(g_hookHasRestrictItem)
g_bHasRestrictItem = false
g_iICounter = 0
#if defined DEBUG_INFO
server_print("[Restrict] INFO: HasRestrictItem Forward: DISABLED!")
#endif
}
}
A_CheckForward()
{
if(g_iACounter > 0 && !g_bBuyGunAmmo)
{
EnableHookChain(g_hookBuyGunAmmo)
g_bBuyGunAmmo = true
#if defined DEBUG_INFO
server_print("[Restrict] INFO: BuyGunAmmo Forward: ENABLED!")
#endif
}
else if(g_iACounter <= 0 && g_bBuyGunAmmo)
{
DisableHookChain(g_hookBuyGunAmmo)
g_bBuyGunAmmo = false
g_iACounter = 0
#if defined DEBUG_INFO
server_print("[Restrict] INFO: BuyGunAmmo Forward: DISABLED!")
#endif
}
}
в amxx.cfg:
amx_restrict on 29
amx_restrict on knife
amx_restrict on knife abc
всё равно ножом можно пользоваться...
amx_restrict on 29
amx_restrict on knife
amx_restrict on knife abc
всё равно ножом можно пользоваться...