Пользователь
- Сообщения
- 162
- Реакции
- 4
- Помог
- 3 раз(а)
- Ошибка
-
L 07/06/2019 - 16:12:02: [AMXX] Plugin "restmenu.amxx" failed to load: Plugin uses an unknown function (name "cs_get_item_alias") - check your modules.ini.
- ОС
- Linux
- Amx Mod X
-
AMX Mod X 1.9.0.5249 (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: Jun 19 2019 13:31:53
Built from: https://github.com/alliedmodders/amxmodx/commit/6cecb34
Build ID: 5249:6cecb34
Core mode: JIT+ASM32
- Билд
-
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.6.0.672-dev
Build date: 17:31:06 Jun 5 2019 (1880)
Build from: https://github.com/dreamstalker/rehlds/commit/0c8d3d7
- ReGamedll
-
ReGameDLL version: 5.9.0.362-dev
Build date: 20:19:32 Jun 21 2019
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/b669a39
- Версия Metamod
-
Metamod v1.21p37 2013/05/30 (5:13)
by Will Day
http://www.metamod.org/
Patch: Metamod-P (mm-p) v37
by Jussi Kivilinna
http://metamod-p.sourceforge.net/
compiled: May 30 2013, 11:41:16 EET (optimized)
- Список метамодулей
-
[ 1] Reunion RUN - reunion.so v0.1.0.1 ini Start Never
[ 2] ReAuthCheck RUN - reauthcheck.so v0.1.6 ini Start Never
[ 3] Rechecker RUN - rechecker.so v2.5 ini ANY
[ 4] AMX Mod X RUN - amxmodx.so v1.9.0.5 ini ANY
[ 5] LocalizeBug Fix RUN - localizebugfix.s v2.4 ini Start Never
[ 6] ReSemiclip RUN - resemiclip.so v2.3.9 ini ANY
[ 7] VoiceTranscoder RUN - vtc.so v2017RC3 ini ANY
[ 8] WHBlocker RUN - whblocker.so v1.5.696 ini ANY
[ 9] MySQL RUN - mysql_amxx_i386. v1.9.0.5 pl4 ANY
[10] SQLite RUN - sqlite_amxx_i386 v1.9.0.5 pl4 ANY
[11] Fun RUN - fun_amxx_i386.so v1.9.0.5 pl4 ANY
[12] Engine RUN - engine_amxx_i386 v1.9.0.5 pl4 ANY
[13] FakeMeta RUN - fakemeta_amxx_i3 v1.9.0.5 pl4 ANY
[14] GeoIP RUN - geoip_amxx_i386. v1.9.0.5 pl4 ANY
[15] Ham Sandwich RUN - hamsandwich_amxx v1.9.0.5 pl4 ANY
[16] ReAPI RUN - reapi_amxx_i386. v5.9.0.1 pl4 ANY Never
[17] ReAimDetector RUN - reaimdetector_am v0.2.2 pl4 ANY Never
[18] CStrike RUN - cstrike_amxx_i38 v1.8.2 pl4 ANY
[19] CSX RUN - csx_amxx_i386.so v1.8.2 pl4 ANY
- Список плагинов
-
[ 1] Lite Admin ESP 1.0 neygomon admin_esp.amxx running
[ 2] Admin Loader 3.5 neygomon admin_loader_3. running
[ 3] FreshBans 1.4.0b kanagava fresh_bans.amxx running
[ 4] ReAimDetector API 0.2.2 ReHLDS Team reaimdetector.a running
[ 5] Gag Me 2.3.4 Radius gag_me.amxx running
[ 6] [ReAPI] Round Balancer 1.1 neygomon round_balancer. running
[ 7] Admin Chat 1.9.0.5249 AMXX Dev Team adminchat.amxx running
[ 8] Adverts 3.3 panicaskill adverts.amxx running
[ 9] Nextmap Chooser 1.9.0.5249 AMXX Dev Team mapchooser.amxx running
[ 10] ADMIN MENU 3.3 panicaskill adminmenu.amxx running
[ 11] Players Menu 1.7 neugomon players_menu.am running
[ 12] Maps Menu 1.4.1 neugomon mapsmenu.amxx running
[ 13] Stats Configuration 1.9.0.5249 AMXX Dev Team statscfg.amxx running
[ 14] AES: StatsX 0.5.9 [REA serfreeman1337/s aes_statsx_cstr running
[ 15] CSStatsX SQL 0.7.4+2 serfreeman1337 csstatsx_sql.am running
[ 16] Admin Votes 1.9.0.5249 AMXX Dev Team adminvote.amxx running
[ 17] unknown unknown unknown restmenu.amxx bad load
[ 18] Afk Control 0.5.1 neygomon afk_control.amx running
[ 19] Parachute 1.1 maeStro | neygom parachute.amxx running
[ 20] resetscore(ReAPI) 1.0 Phantom resetscore.amxx running
[ 21] Damager Advanced 1.1.2 Radius (based on damager_advance running
[ 22] [ReAPI] IDEAL VIP by W 1.4.8 Wikiname (Remake reapi_ideal_vip running
[ 23] [ReAPI] No Team Flash 0.0.2 Vaqtincha no_team_flash.a running
[ 24] DemoRecoder 1.1 neygomon amx_demorec.amx running
[ 25] Ping Control 1.31 neygomon Ping_Control.am running
[ 26] unknown unknown unknown simple_menu.amx running
[ 27] Say me and Say hp 1.4 neygomon sayme.amxx running
[ 28] Mode 2x2 2.5re s1lent mode.amxx running
[ 29] AWPoff 1.7 PAffAEJIkA :3 hlds_awp_off.am running
[ 30] RE C4 Timer [ON] 1.0 AcE re_c4_timer.amx running
[ 31] WarmUP Knife Round 1.7 neygomon warmup_knife_ro running
[ 32] Lite Translit 2.8 neygomon lite_translit.a running
[ 33] Advanced Experience Sy 0.5.9 [REA serfreeman1337/s aes_main.amxx running
[ 34] AES: CStrike Addon 0.5.9 [REA serfreeman1337/s aes_exp_cstrike running
[ 35] AES: Informer 0.5.9 [REA serfreeman1337/s aes_informer.am running
[ 36] AES: Admin Tools 0.5.9 [REA serfreeman1337/s aes_exp_editor. running
[ 37] AES: Bonus System 0.5.9 Vega serfreeman1337/s aes_bonus_syste running
[ 38] AES: Bonus CSTRIKE 0.5.9.1 [R serfreeman1337/s aes_bonus_cstri running
( 17) Load fails: Plugin uses an unknown function (name "cs_get_item_alias") - check your modules.ini.
- Автор плагина
- AMXX Dev Team
- Версия плагина
- 1
- Исходный код
-
// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
//
// This software is licensed under the GNU General Public License, version 3 or higher.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// https://alliedmods.net/amxmodx-license
//
// Restrict Weapons Plugin
//
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
new const PluginName[] = "Restrict Weapons";
const MaxAliasNameLength = 16;
const MaxItemNameLength = 32;
const MaxMenuTitleLength = 48;
const MaxCommandAliasLength = 12;
const MaxConfigFileLength = 48;
const MaxConsoleLength = 128;
const MaxMapLength = 32;
new bool:BlockedItems[CSI_MAX_COUNT];
new bool:ModifiedItem;
new bool:ConfigsExecuted;
new MenuPosition[MAX_PLAYERS + 1];
new MenuHandle [MAX_PLAYERS + 1] = { -1, ... };
new ConfigFilePath[PLATFORM_MAX_PATH];
new RestrictedBotWeapons[] = "00000000000000000000000000";
new RestrictedBotEquipAmmos[] = "000000000";
new CvarPointerAllowMapSettings;
new CvarPointerRestrictedWeapons;
new CvarPointerRestrictedEquipAmmos;
enum MenuTitle
{
m_Title[MaxMenuTitleLength],
m_Alias[MaxCommandAliasLength],
};
#define TITLE(%0) "MENU_TITLE_" + #%0
new const MenuInfos[][MenuTitle] =
{
{ TITLE(HANDGUNS) , "pistol" },
{ TITLE(SHOTGUNS) , "shotgun" },
{ TITLE(SUBMACHINES) , "sub" },
{ TITLE(RIFLES) , "rifle" },
{ TITLE(SNIPERS) , "sniper" },
{ TITLE(MACHINE) , "machine" },
{ TITLE(EQUIPMENT) , "equip" },
{ TITLE(AMMUNITION) , "ammo" },
}
enum MenuItem
{
m_Index,
m_Name[MaxItemNameLength],
};
#define ITEM(%0) { CSI_%0, "MENU_ITEM_" + #%0 }
#define ITEM_NONE { CSI_NONE, "" }
new const ItemsInfos[][][MenuItem] =
{
{ ITEM(USP) , ITEM(GLOCK18) , ITEM(DEAGLE) , ITEM(P228) , ITEM(ELITE) , ITEM(FIVESEVEN), ITEM_NONE , ITEM_NONE },
{ ITEM(M3) , ITEM(XM1014) , ITEM_NONE , ITEM_NONE , ITEM_NONE , ITEM_NONE , ITEM_NONE , ITEM_NONE },
{ ITEM(MP5NAVY), ITEM(TMP) , ITEM(P90) , ITEM(MAC10) , ITEM(UMP45) , ITEM_NONE , ITEM_NONE , ITEM_NONE },
{ ITEM(AK47) , ITEM(SG552) , ITEM(M4A1) , ITEM(GALIL) , ITEM(FAMAS) , ITEM(AUG) , ITEM_NONE , ITEM_NONE },
{ ITEM(SCOUT) , ITEM(AWP) , ITEM(G3SG1) , ITEM(SG550) , ITEM_NONE , ITEM_NONE , ITEM_NONE , ITEM_NONE },
{ ITEM(M249) , ITEM_NONE , ITEM_NONE , ITEM_NONE , ITEM_NONE , ITEM_NONE , ITEM_NONE , ITEM_NONE },
{ ITEM(VEST) , ITEM(VESTHELM), ITEM(FLASHBANG), ITEM(HEGRENADE), ITEM(SMOKEGRENADE), ITEM(DEFUSER) , ITEM(NVGS), ITEM(SHIELD) },
{ ITEM(PRIAMMO), ITEM(SECAMMO) , ITEM_NONE , ITEM_NONE , ITEM_NONE , ITEM_NONE , ITEM_NONE , ITEM_NONE },
};
public plugin_init()
{
register_plugin(PluginName, AMXX_VERSION_STR, "AMXX Dev Team");
register_dictionary("restmenu.txt");
register_dictionary("common.txt");
register_clcmd( "amx_restmenu", "@ClientCommand_MainMenu" , ADMIN_CFG, .info = "REG_CMD_MENU", .info_ml = true);
register_concmd("amx_restrict", "@ConsoleCommand_Restrict", ADMIN_CFG, .info = "REG_CMD_REST", .info_ml = true);
CvarPointerAllowMapSettings = register_cvar("amx_restrmapsettings", "0");
CvarPointerRestrictedWeapons = register_cvar("amx_restrweapons" , RestrictedBotWeapons);
CvarPointerRestrictedEquipAmmos = register_cvar("amx_restrequipammo" , RestrictedBotEquipAmmos);
}
public OnConfigsExecuted()
{
new const configFile[] = "weaprest";
new const configFileExt[] = "ini";
new configsDir[PLATFORM_MAX_PATH];
get_configsdir(configsDir, charsmax(configsDir));
if (get_pcvar_bool(CvarPointerAllowMapSettings))
{
new mapName[MaxMapLength];
get_mapname(mapName, charsmax(mapName));
formatex(ConfigFilePath, charsmax(ConfigFilePath), "%s/%s_%s.%s", configsDir, configFile, mapName, configFileExt);
}
else
{
formatex(ConfigFilePath, charsmax(ConfigFilePath), "%s/%s.%s", configsDir, configFile, configFileExt);
}
loadSettings(ConfigFilePath);
ConfigsExecuted = true;
}
public CS_OnBuyAttempt(player, itemid)
{
if (BlockedItems[itemid])
{
return blockcommand(player);
}
return PLUGIN_CONTINUE;
}
public blockcommand(const id) // Might be used by others plugins, so keep this for backward compatibility.
{
client_print(id, print_center, "%l", "RESTRICTED_ITEM");
return PLUGIN_HANDLED;
}
@ClientCommand_MainMenu(const id, const level, const cid)
{
if (cmd_access(id, level, cid, 1))
{
displayMenu(id, MenuPosition[id] = -1);
}
return PLUGIN_HANDLED;
}
@ConsoleCommand_Restrict(const id, const level, const cid)
{
if (!cmd_access(id, level, cid, 1))
{
return PLUGIN_HANDLED;
}
new const argumentsCount = read_argc();
if (argumentsCount <= 1) // Main command only, no arguments.
{
goto usage;
}
new action[8];
new argumentIndex;
new const actionLength = read_argv(++argumentIndex, action, charsmax(action)) - trim(action);
if (!actionLength || !isalpha(action[0])) // Empty argument or first character is not a letter.
{
goto usage;
}
new const ch1 = char_to_lower(action[0]);
new const ch2 = char_to_lower(action[1]);
if (ch1 == 'o' && (ch2 == 'n' || ch2 == 'f')) // [on]/[of]f
{
new const bool:restricted = (ch2 == 'n');
new bool:valid;
if (argumentsCount <= argumentIndex + 1) // No arguments, all items are concerned.
{
arrayset(BlockedItems, restricted, sizeof BlockedItems);
console_print(id, "%l", restricted ? "EQ_WE_RES" : "EQ_WE_UNRES");
ModifiedItem = valid = true;
refreshMenus(level);
}
else // Either item type or specific alias
{
new commands[MaxConsoleLength];
new itemName[MaxItemNameLength];
new argument[MaxAliasNameLength];
new position, class;
new itemid, slot;
new commandLength;
while (argumentIndex < argumentsCount)
{
// Ignore if the argument is empty or the first character is not a letter.
if ((commandLength = read_argv(++argumentIndex, commands, charsmax(commands)) - trim(commands)) <= 0 || !isalpha(commands[0]))
{
continue;
}
strtolower(commands);
position = 0;
// In case argument contains several input between quotes.
while (position != commandLength && (position = argparse(commands, position, argument, charsmax(argument))) != -1)
{
if ((class = findMenuAliasId(argument)) != -1)
{
for (slot = 0; slot < sizeof ItemsInfos[] && (itemid = ItemsInfos[class][slot][m_Index]) != CSI_NONE; ++slot)
{
BlockedItems[itemid] = restricted;
}
console_print(id, "%l %l %l", MenuInfos[class], (class < 6) ? "HAVE_BEEN" : "HAS_BEEN", restricted ? "RESTRICTED" : "UNRESTRICTED");
ModifiedItem = valid = true;
}
else if ((itemid = cs_get_item_id(argument)) != CSI_NONE)
{
BlockedItems[itemid] = restricted;
findItemFullName(itemid, itemName, charsmax(itemName));
console_print(id, "%l %l %l", itemName, "HAS_BEEN", restricted ? "RESTRICTED" : "UNRESTRICTED");
ModifiedItem = valid = true;
}
}
}
if (!valid)
{
console_print(id, "%l", "NO_EQ_WE");
}
else
{
refreshMenus(level);
}
}
if (ConfigsExecuted && valid)
{
show_activity_key("ADMIN_UPD_RES_1", "ADMIN_UPD_RES_2", fmt("%n", id));
log_amx("%L", LANG_SERVER, "ADMIN_CMD_UPDATEDCFG", id);
}
}
else if (ch1 == 'l' && ch2 == 'i') // [li]st
{
// Items list.
if (argumentsCount > argumentIndex + 1) // Available arguments.
{
new const selection = read_argv_int(++argumentIndex) - 1; // Index starts from 0.
if (0 <= selection <= charsmax(ItemsInfos))
{
console_print(id, "^n----- %l: %l -----^n", "WEAP_RES", MenuInfos[selection][m_Title]);
SetGlobalTransTarget(id);
new alias[MaxAliasNameLength];
new itemid;
console_print(id, " %-32.31s %-10.9s %-9.8s", fmt("%l", "NAME"), fmt("%l", "VALUE"), fmt("%l", "STATUS"));
console_print(id, "");
for (new slot = 0; slot < sizeof ItemsInfos[] && (itemid = ItemsInfos[selection][slot][m_Index]) != CSI_NONE; ++slot)
{
cs_get_item_alias(itemid, alias, charsmax(alias));
console_print(id, " %-32.31s %-10.9s %-9.8s", fmt("%l", ItemsInfos[selection][slot][m_Name]), alias
, fmt("%l", BlockedItems[itemid] ? "ON" : "OFF"));
}
console_print(id, "");
return PLUGIN_HANDLED;
}
}
console_print(id, "^n----- %l -----^n", "WEAP_RES");
// Item types list.
for (new class = 0; class < sizeof MenuInfos; ++class)
{
console_print(id, "%3d: %l", class + 1, MenuInfos[class][m_Title]);
}
console_print(id, "^n----- %l -----^n", "REST_USE_HOW");
}
else if (ch1 == 's') // [s]ave
{
// If 'save' is used in a per-map config file, the plugin config file is not yet known as it depends on
// amx_restrmapsettings cvar value read after per-map configs are processed. Postponing the saving a little.
if (!ConfigsExecuted)
{
const taskId = 424242;
if (!task_exists(taskId))
{
set_task(0.1, "@Task_SaveConfig", taskId);
}
return PLUGIN_HANDLED;
}
new bool:saved = saveSettings(ConfigFilePath);
if (saved)
{
ModifiedItem = false;
refreshMenus(level, .displaySaveMessage = true);
if (ConfigsExecuted)
{
log_amx("%L", LANG_SERVER, "ADMIN_CMD_SAVEDCFG", id, ConfigFilePath);
}
}
console_print(id, "%l^n", saved ? "REST_CONF_SAVED" : "REST_COULDNT_SAVE", ConfigFilePath);
}
else if (ch1 == 'l' && ch2 == 'o') // [lo]ad
{
if (argumentsCount <= argumentIndex + 1) // No argument
{
goto usage;
}
new argument[MaxConfigFileLength];
read_argv(++argumentIndex, argument, charsmax(argument)) - trim(argument);
new filepath[PLATFORM_MAX_PATH];
new length = get_configsdir(filepath, charsmax(filepath));
formatex(filepath[length], charsmax(filepath) - length, "/%s", argument);
new bool:loaded = loadSettings(filepath);
if (loaded)
{
arrayset(BlockedItems, false, sizeof BlockedItems);
ModifiedItem = true;
refreshMenus(level);
if (ConfigsExecuted)
{
show_activity_key("ADMIN_UPD_RES_1", "ADMIN_UPD_RES_2", fmt("%n", id));
log_amx("%L", LANG_SERVER, "ADMIN_CMD_LOADEDCFG", id, ConfigFilePath);
}
}
console_print(id, "%l^n", loaded ? "REST_CONF_LOADED" : "REST_COULDNT_LOAD", filepath);
}
else
{
usage:
console_print(id, "%l", "COM_REST_USAGE");
console_print(id, "^n%l", "COM_REST_COMMANDS");
console_print(id, "%l", "COM_REST_ON");
console_print(id, "%l", "COM_REST_OFF");
console_print(id, "%l", "COM_REST_ONV");
console_print(id, "%l", "COM_REST_OFFV");
console_print(id, "%l", "COM_REST_LIST");
console_print(id, "%l", "COM_REST_SAVE");
console_print(id, "%l^n", "COM_REST_LOAD");
console_print(id, "%l^n", "COM_REST_VALUES");
console_print(id, "%l^n", "COM_REST_TYPE");
}
return PLUGIN_HANDLED;
}
@Task_SaveConfig()
{
server_cmd("amx_restrict save");
}
displayMenu(const id, const position)
{
SetGlobalTransTarget(id);
new menuTitle[MaxMenuTitleLength * 2];
formatex(menuTitle, charsmax(menuTitle), " \y%l", "REST_WEAP");
new const menu = MenuHandle[id] = menu_create(menuTitle, "@OnMenuAction");
if (position < 0) // Main menu
{
for (new class = 0; class < sizeof MenuInfos; ++class)
{
menu_additem(menu, fmt("%l", MenuInfos[class][m_Title]));
}
}
else // Sub-menus
{
menu_setprop(menu, MPROP_TITLE, fmt("%s > \d%l", menuTitle, MenuInfos[position][m_Title]));
for (new slot = 0, data[MenuItem], index; slot < sizeof ItemsInfos[]; ++slot)
{
data = ItemsInfos[position][slot];
if ((index = data[m_Index]))
{
menu_additem(menu, fmt("%l\R%s%l", data[m_Name], BlockedItems[index] ? "\y" : "\r", BlockedItems[index] ? "ON" : "OFF"));
continue;
}
menu_addblank2(menu);
}
}
menu_addblank(menu, .slot = false);
menu_additem(menu, fmt("%s%l \y\R%s", ModifiedItem ? "\y" : "\d", "SAVE_SET", ModifiedItem ? "*" : ""));
if (position >= 0) // Inside a sub-menu
{
menu_addblank(menu, .slot = false);
menu_additem(menu, fmt("%l", "BACK"));
}
else // Main menu
{
menu_setprop(menu, MPROP_EXITNAME, fmt("%l", "EXIT"));
menu_setprop(menu, MPROP_EXIT, MEXIT_FORCE); // Force an EXIT item since pagination is disabled.
}
menu_setprop(menu, MPROP_PERPAGE, 0); // Disable pagination.
menu_setprop(menu, MPROP_NUMBER_COLOR, " \r"); // Small QoL change to avoid menu overlapping with left icons.
menu_display(id, menu);
return menu;
}
@OnMenuAction(const id, const menu, const key)
{
new position = MenuPosition[id];
if (key >= 0)
{
switch (key + 1)
{
case 1 .. sizeof ItemsInfos[]:
{
if (position < 0) // We are right now in the main menu, go to sub-menu.
{
position = key;
}
else // We are in a sub-menu.
{
ModifiedItem = true;
new const itemid = ItemsInfos[any:position][key][m_Index];
BlockedItems[itemid] = !BlockedItems[itemid];
restrictPodbotItem(itemid, .toggle = true);
updatePodbotCvars();
}
}
case sizeof ItemsInfos[] + 1: // Save option.
{
if (saveSettings(ConfigFilePath))
{
show_activity_key("ADMIN_UPD_RES_1", "ADMIN_UPD_RES_2", fmt("%n", id));
log_amx("%L", LANG_SERVER, "ADMIN_MENU_SAVEDCFG", id ,ConfigFilePath);
ModifiedItem = false;
}
client_print(id, print_chat, "* %l", ModifiedItem ? "CONF_SAV_FAIL" : "CONF_SAV_SUC");
}
default:
{
position = -1; // Back to main menu.
}
}
}
MenuHandle[id] = -1;
menu_destroy(menu);
if (position != MenuPosition[id] || key >= 0)
{
displayMenu(id, MenuPosition[id] = position);
}
return PLUGIN_HANDLED;
}
findAdminsWithMenu(playersList[MAX_PLAYERS], &playersCount, const commandLevel = -1)
{
new player, adminsCount;
new menu, newmenu;
get_players(playersList, playersCount, "ch");
for (new i = 0; i < playersCount, (player = playersList[i]); ++i)
{
if (player_menu_info(player, menu, newmenu) && newmenu != -1 && newmenu == MenuHandle[player])
{
if (commandLevel == -1 || access(player, commandLevel)) // extra safety
{
playersList[adminsCount++] = player;
}
}
}
playersCount = adminsCount;
}
refreshMenus(const commandLevel = 0, const bool:displaySaveMessage = false)
{
new playersList[MAX_PLAYERS], playersCount;
findAdminsWithMenu(playersList, playersCount, commandLevel);
if (!playersCount)
{
return;
}
for (new i = 0, player; i < playersCount, (player = playersList[i]); ++i)
{
MenuHandle[player] = displayMenu(player, MenuPosition[player]);
if (displaySaveMessage)
{
client_print(playersList[i], print_chat, "* %l (amx_restrict)", "CONF_SAV_SUC");
}
}
}
bool:saveSettings(const filename[])
{
new const fp = fopen(filename, "wt");
if (!fp)
{
return false;
}
fprintf(fp, "%L", LANG_SERVER, "CONFIG_FILE_HEADER", PluginName);
new alias[MaxAliasNameLength];
new itemid;
new bool:showCategory;
for (new class = 0, slot; class < sizeof ItemsInfos; ++class)
{
showCategory = true;
for (slot = 0; slot < sizeof ItemsInfos[]; ++slot)
{
if ((itemid = ItemsInfos[class][slot][m_Index]) == CSI_NONE)
{
break;
}
if (BlockedItems[itemid])
{
if (showCategory)
{
showCategory = false;
fprintf(fp, "^n; %l^n; -^n", MenuInfos[class][m_Title]);
}
cs_get_item_alias(itemid, alias, charsmax(alias));
fprintf(fp, "%-16.15s ; %L^n", alias, LANG_SERVER, ItemsInfos[class][slot][m_Name]);
}
}
}
fclose(fp);
return true;
}
bool:loadSettings(const filename[])
{
new const fp = fopen(filename, "rt");
if (!fp)
{
return false;
}
new lineRead[MaxAliasNameLength], alias[MaxAliasNameLength];
new itemid, ch;
arrayset(RestrictedBotEquipAmmos, '0', charsmax(RestrictedBotEquipAmmos));
arrayset(RestrictedBotWeapons, '0', charsmax(RestrictedBotWeapons));
while (!feof(fp))
{
if (fgets(fp, lineRead, charsmax(lineRead)) - trim(lineRead) <= 0)
{
continue;
}
if ((ch = lineRead[0]) == ';' || ch == '/' || ch == '#')
{
continue;
}
if (parse(lineRead, alias, charsmax(alias)) == 1 && (itemid = cs_get_item_id(alias)) != CSI_NONE)
{
BlockedItems[itemid] = true;
restrictPodbotItem(itemid);
}
}
fclose (fp);
updatePodbotCvars();
return true;
}
findMenuAliasId(const name[])
{
for (new i = 0; i < sizeof MenuInfos; ++i)
{
if (equal(name, MenuInfos[i][m_Alias]))
{
return i;
}
}
return -1;
}
findItemFullName(const itemid, name[], const maxlen)
{
for (new class = 0, slot; class < sizeof ItemsInfos; ++class)
{
for (slot = 0; slot < sizeof ItemsInfos[]; ++slot)
{
if (ItemsInfos[class][slot][m_Index] == itemid)
{
copy(name, maxlen, ItemsInfos[class][slot][m_Name]);
return;
}
}
}
}
restrictPodbotItem(const itemid, const bool:toggle = false)
{
new const translatedItems[CSI_MAX_COUNT] =
{
// CSI ids -> string indexes of pb_restrweapons and pb_restrequipammo cvars. See podbot.cfg.
-1, 4, -1, 20, 3, 8, -1, 12, 19, 4, 5, 6, 13, 23, 17, 18, 1, 2, 21, 9, 24, 7, 16, 10, 22, 2, 3, 15, 14, 0, 11, 0, 1, 5, 6, 25, 7, 8
};
new const index = translatedItems[itemid];
if (index >= 0)
{
if ((itemid <= CSI_LAST_WEAPON && !(1 << itemid & CSI_ALL_GRENADES)) || itemid == CSI_SHIELD)
{
RestrictedBotWeapons[index] = toggle && RestrictedBotWeapons[index] == '1' ? '0' : '1';
}
else
{
RestrictedBotEquipAmmos[index] = toggle && RestrictedBotEquipAmmos[index] == '1' ? '0' : '1';
}
}
}
updatePodbotCvars()
{
set_pcvar_string(CvarPointerRestrictedWeapons, RestrictedBotWeapons);
set_pcvar_string(CvarPointerRestrictedEquipAmmos, RestrictedBotEquipAmmos);
}
Amxx скачан с офф сайта. В исходнике ничего не менялось.
В этой теме было размещено решение! Перейти к решению.