Помогите доделать проверку на поднятие оружия в випке

Сообщения
14
Реакции
-1
Ошибка
Ошибок при debug не выдает
ОС
Linux
Amx Mod X
AMX Mod X 1.10.0.5435 (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: Aug 7 2021 08:32:30
Built from: https://github.com/alliedmodders/amxmodx/commit/36d5aa9
Build ID: 5435:36d5aa9
Core mode: JIT+ASM32
Билд
ReHLDS version: 3.11.0.767-dev
Build date: 16:15:06 Oct 28 2021 (2756)
Build from: https://github.com/dreamstalker/rehlds/commit/471158b
ReGamedll
ReGameDLL version: 5.21.0.540-dev
Build date: 17:33:16 Oct 25 2021
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/b9cccc6
Версия 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.so                  v0.1.92d         ini  Start Never
[ 2] VoiceTranscoder RUN - VoiceTranscoder.so v2017RC5 ini ANY ANY
[ 3] AMX Mod X RUN - amxmodx.so v1.10.0.5435 ini Start ANY
[ 4] ReSemiclip RUN - resemiclip.so v2.3.9 ini Chlvl ANY
[ 5] Rechecker RUN - rechecker.so v2.7 ini Chlvl ANY
[ 6] ReAuthCheck RUN - reauthcheck.so v0.1.6 ini Start Never
[ 7] ReSRDetector RUN - resrdetector.so v0.1.0 ini Chlvl ANY
[ 8] WHBlocker RUN - whblocker.so v1.5.697 ini Chlvl ANY
[ 9] CStrike RUN - cstrike_amxx_i386.so v1.10.0.5435 pl3 ANY ANY
[10] CSX RUN - csx_amxx_i386.so v1.10.0.5435 pl3 ANY ANY
[11] MySQL RUN - mysql_amxx_i386.so v1.10.0.5435 pl3 ANY ANY
[12] SQLite RUN - sqlite_amxx_i386.so v1.10.0.5435 pl3 ANY ANY
[13] ReAPI RUN - reapi_amxx_i386.so v5.21.0.248-dev pl3 ANY Never
[14] FakeMeta RUN - fakemeta_amxx_i386.so v1.10.0.5435 pl3 ANY ANY
[15] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.10.0.5435 pl3 ANY ANY
[16] ReAimDetector RUN - reaimdetector_amxx_i386.so v0.2.2 pl3 ANY Never
[17] Fun RUN - fun_amxx_i386.so v1.10.0.5435 pl3 ANY ANY
[18] Engine RUN - engine_amxx_i386.so v1.10.0.5435 pl3 ANY ANY
18 plugins, 18 running
Список плагинов
id  name                    version     author            url                              file         status   
[ 1] 0 GameCMS_API 5.5.3 zhorzh78 unknown gamecms_api running
[ 2] 1 FreshBans 1.4.6b kanagava unknown fresh_bans. running
[ 3] 2 WebHS 0.1 kanagava unknown fb_web_onli running
[ 4] 3 Admin Commands 1.10.0.543 AMXX Dev Team admincmd.am running
[ 5] 4 Slots Reservation 1.10.0.543 AMXX Dev Team adminslots. running
[ 6] 5 Commands Menu 1.10.0.543 AMXX Dev Team cmdmenu.amx running
[ 7] 6 Players Menu 1.2 O.Hooligan plmenu.amxx running
[ 8] 7 NextMap 1.10.0.543 AMXX Dev Team nextmap.amx running
[ 9] 8 Maps Menu 1.0 O.Hooligan mapsmenu.am running
[ 10] 9 Plugin Menu 1.10.0.543 AMXX Dev Team pluginmenu. running
[ 11] 10 Admin Chat 1.10.0.543 AMXX Dev Team adminchat.a running
[ 12] 11 Scrolling Message 1.10.0.543 AMXX Dev Team scrollmsg.a running
[ 13] 12 Info. Messages 1.10.0.543 AMXX Dev Team imessage.am running
[ 14] 13 Admin Votes 1.10.0.543 AMXX Dev Team adminvote.a running
[ 15] 14 Pause Plugins 1.10.0.543 AMXX Dev Team pausecfg.am running
[ 16] 15 CSStatsX SQL 0.7.4+2 serfreeman1337 unknown csstatsx_sq debug
[ 17] 16 Stats Configuration 1.10.0.543 AMXX Dev Team statscfg.am running
[ 18] 17 AES: StatsX 0.5.9 [REA serfreeman1337/s unknown aes_statsx. running
[ 19] 18 StatsX 1.10.0.543 AMXX Dev Team statsx.amxx running
[ 20] 19 GameCMS_VipTest 3.8.1 zhorzh78 unknown gamecms_vip running
[ 21] 20 GameCMS BonusSystem 1.1 +- DUKKHAZ0R unknown gamecms_bon running
[ 22] 21 GameCMS_GagManager 2.2.7 ReAp zhorzh78 unknown gamecms_gag debug
[ 23] 22 Hooligan VoteBan 1.4 cTpAx unknown ctpax_voteb running
[ 24] 23 Kill Assist 1.17 cTpAx unknown ctpax_kill_ running
[ 25] 24 Hooligan Vampire 1.2 cTpAx unknown ctpax_vampi running
[ 26] 25 Ping 1.1 cTpAx unknown ctpax_ping. running
[ 27] 26 Translit 1.0 cTpAx unknown ctpax_trans running
[ 28] 27 knife duel 0.5 cTpAx ctpax_duel. running
[ 29] 28 Nice Voice 2.0 R cTpAx unknown ctpax_voice running
[ 30] 29 Lite MapChooser 2.6 cTpAx unknown ctpax_map_c debug
[ 31] 30 Sound Kill 1.3 cTpAx ctpax_sound running
[ 32] 31 Menu 1.0 cTpAx unknown ctpax_menu. running
[ 33] 32 Menu 1.0 cTpAx ctpax_cabin running
[ 34] 33 Menu 1.0 cTpAx unknown ctpax_menup running
[ 35] 34 AmxModMenu 1.2 cTpAx unknown ctpax_admin running
[ 36] 35 Knife Manager 0.3 cTpAx ctpax_knife debug
[ 37] 36 TeamBalancer 1.20 cTpAx unknown ctpax_balan running
[ 38] 37 Warn Menu 0.1 cTpAx unknown ctpax_warn_ running
[ 39] 38 Damager 1.0 cTpAx unknown ctpax_damag running
[ 40] 39 Free ammo 1.4 cTpAx unknown ctpax_ammo. running
[ 41] 40 recoil_manager 1.0 cTpAx unknown ctpax_recoi running
[ 42] 41 Frags Counter 1.0 cTpAx unknown ctpax_frags running
[ 43] 42 [GTX] Healthnade 1.0 cTpAx unknown ctpax_healt running
[ 44] 43 cTpAx Admin ESP 1.0 cTpAx unknown ctpax_esp.a running
[ 45] 44 [GTX] Flash 1.0 cTpAx unknown ctpax_antif running
[ 46] 45 Ban Sound 1.2 cTpAx ctpax_ban_s running
[ 47] 46 VIP System 1.1.03 Emma Jule vipka debug
[ 48] 47 Remove Drop Weapons 0.0.2 Athix removedrop. debug
[ 49] 48 CMS_GM_Sorry_Addon 1.0 unknown sorry.amxx running
[ 50] 49 Reset Score 0.2 Silenttt / CepeH unknown rs.amxx running
[ 51] 50 Parachute 1.0 maeStro unknown parachute.a running
[ 52] 51 lite screen fade 1.0 AcE unknown lite_screen running
[ 53] 52 kill_knife_money 1.0 IntelCom unknown knife_kill_ running
[ 54] 53 Killa HP 1.6 jas0n unknown killa_hp.am running
[ 55] 54 User Connect 0.1.1 Jumper unknown connect_pri running
[ 56] 55 Autoresponder/Advertis 0.5 MaximusBrood unknown reklama_in_ running
[ 57] 56 [ReAPI] AWPoff 1.4.3 PAffAEJIkA :3 unknown awp_off.amx running
[ 58] 57 Afk Control 0.5.1 neygomon unknown afk_control running
[ 59] 58 AES: Status Info 0.1 serfreeman1337 unknown aes_status_ running
[ 60] 59 DemoRecoder 1.1 neygomon unknown demka.amxx running
[ 61] 60 SITE 1.0 O.Hooligan unknown site.amxx running
[ 62] 61 Block grande info 1.0 O.Hooligan unknown BlockGrenad running
[ 63] 62 Top Round Damage 1.0.4 ReAP Dager* *.* -G- unknown top_damage. running
[ 64] 63 [ReAPI] Custom Models 1.6.1 neugomon unknown custom_mode running
[ 65] 64 ReAimDetector API 0.2.2 ReHLDS Team unknown reaimdetect running
[ 66] 65 Mode 2x2 2.5re s1lent mode2x2.amx running
[ 67] 66 Block Pickup Gold 0.1 Vaqtincha Block.amxx debug
[ 68] 67 Advanced Experience Sy 0.5.9 [REA serfreeman1337/s unknown aes_main.am running
[ 69] 68 AES: CStrike Addon 0.5.9 [REA serfreeman1337/s unknown aes_exp_cst running
[ 70] 69 AES: Informer 0.5.9 [REA serfreeman1337/s unknown aes_informe running
[ 71] 70 AES: Admin Tools 0.5.9 [REA serfreeman1337/s unknown aes_exp_edi running
[ 72] 71 AES: Bonus System 0.5.9 Vega serfreeman1337/s unknown aes_bonus_s running
[ 73] 72 AES: Bonus CSTRIKE 0.5.9.1 [R serfreeman1337/s unknown aes_bonus_c running
73 plugins, 73 running
Автор плагина
Emma Jule
Версия плагина
1.1.03
Исходный код
#define MOD(%1,%2)				((((%1) % (%2)) + (%2)) % (%2))
#define VALID_PLAYER(%1) (1 <= %1 <= MaxClients)
#define GET_CURRENT_ROUND() (get_member_game(m_iTotalRoundsPlayed) + 1)

#define MAX_MODEL_LEN 200

new const BLOCK_MODELS[][MAX_MODEL_LEN] = {
"models/priv_guns/w_ak47_redline.mdl",
"models/priv_guns/w_m4a1_redline.mdl",
"models/priv_guns/w_famas_redline.mdl",
"models/priv_guns/w_awp_redline.mdl",
"models/priv_guns/w_ak47_icar.mdl",
"models/priv_guns/w_m4a1_icar.mdl",
"models/priv_guns/w_famas_icar.mdl",
"models/priv_guns/w_awp_icar.mdl",
"models/priv_guns/w_ak47_tech.mdl",
"models/priv_guns/w_m4a1_tech.mdl",
"models/priv_guns/w_awp_tech.mdl",
"models/priv_guns/w_ak47_girl.mdl",
"models/priv_guns/w_m4a1_girl.mdl",
"models/priv_guns/w_awp_girl.mdl",
"models/priv_guns/w_ak47_meduse.mdl",
"models/priv_guns/w_m4a1_meduse.mdl",
"models/priv_guns/w_famas_meduse.mdl",
"models/priv_guns/w_awp_meduse.mdl",
"models/priv_guns/w_ak47_white.mdl",
"models/priv_guns/w_m4a1_white.mdl",
"models/priv_guns/w_awp_white.mdl",
"models/priv_guns/w_ak47_azimov.mdl",
"models/priv_guns/w_m4a1_azimov.mdl",
"models/priv_guns/w_famas_azimov.mdl",
"models/priv_guns/w_awp_azimov.mdl",
}

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <engine>
#include <reapi>


#if !defined MAX_MAPNAME_LENGTH
#define MAX_MAPNAME_LENGTH 128
#endif

#define IsEntOnGround(%1) (entity_get_int(%1, EV_INT_flags) & FL_ONGROUND)

// ######################################################### //

// Местоположение кастомных оружий
new const FOLDER[] = "models/priv_guns/";

// Раздел кастомных оружий по умолчанию
new const DEFAULT_SECTION[] = "Оружейка";

// Звук вампирки (опционально)
new const VAMPIRE_SAMPLE[] = "buttons/bell1.wav";


// ######################################################### //

const EntVars:viewmodel = var_noise1;
const EntVars:playermodel = var_noise2;
const EntVars:gunmodel = var_message;

stock const ScoreAttrib_PlayerID = 1;
stock const ScoreAttrib_Flags = 2;

const FFADE_IN = 0x0000;
const RULES = 11;


enum (+=1)
{
NULL = -1,
COMMANDS,
INFO,
EQUIP_MANAGER,
ABILITIES,
BONUSES,
VAMPIRE,
CUSTOM_WEAPONS,
MAPS,

}; new SECTION;

enum _:CVARS
{
TAB_ACCESS,
ONLINE_ACCESS,
CONNECT_ACCESS,

EQUIP_ROUND,
EQUIP_ONLY_1,
EQUIP_PISTOL[17],
EQUIP_HE_ACCESS,
EQUIP_FLASH_ACCESS,
EQUIP_SMOKE_ACCESS,
EQUIP_AUTO_RELOAD_ACCESS,
EQUIP_ARMOR_ACCESS,
EQUIP_DKIT_ACCESS,
EQUIP_NIGHTVISION_ACCESS,
EQUIP_PISTOL_ACCESS,
//DROP_TYPE_ACCESS,
//DROP_TYPE,
FALL_DAMAGE_ACCESS,
PLANT_UNFREEZE_ACCESS,
MENU_MODE,
ONLY_IN_BUYZONE,
BUYTIME_EXPIRED,
MAX_USE,
INSTANT_RELOAD_ACCESS,
INSTANT_RELOAD,

BONUS_ACCESS,
BONUS_FRAGS,
BONUS_KILLED,
BONUS_EXPLODE_BOMB,
BONUS_PLANT_BOMB,
BONUS_DEFUSED_BOMB,
BONUS_HOSTAGE_TOOK,
BONUS_HOSTAGE_RESCUED,
BONUS_VIP_KILLED,
BONUS_VIP_RESCUED_MYSELF,
Float:BONUS_ROUND,
Float:BONUS_DISCOUNT,

VAMPIRE_ACCESS,
Float:VAMPIRE_HEALTH,
Float:VAMPIRE_HEALTH_HS,
Float:VAMPIRE_HEALTH_NADE,
Float:VAMPIRE_HEALTH_MAX,
VAMPIRE_SCREENFADE,
VAMPIRE_HUD,
#if defined VAMPIRE_SAMPLE
VAMPIRE_SOUND,
#endif

}; new CVAR[CVARS];

enum _:WEAPON_DATA
{
CLASS[64], // ArrayFindString

ACCESS,
REFERENCE[64],
NAME[64],
ALIAS[32],
V_MODEL[MAX_RESOURCE_PATH_LENGTH],
P_MODEL[MAX_RESOURCE_PATH_LENGTH],
W_MODEL[MAX_RESOURCE_PATH_LENGTH],
AMMO,
BPAMMO,
Float: DAMAGE,

PLUGIN_NAME[32],

}; new Array:g_aCustomWeapons, g_iCustomWeaponsNum;


new g_iUseMenu[MAX_PLAYERS + 1]; //, g_iDieInPrevRound[MAX_PLAYERS + 1];
new Array:g_aMenuSections;
new Trie:g_tDefaultWeapons;
new Float:g_flBuyTime;
new HamHook:PrimaryAttack;
new bool:g_IsBadMap = false;
#if !defined MapName
new MapName[MAX_MAPNAME_LENGTH];
#endif

public plugin_precache()
{
register_plugin("VIP System", "1.1.03", "Emma Jule");

#if !defined MapName
get_mapname(MapName, charsmax(MapName));
#endif

g_aCustomWeapons = ArrayCreate(WEAPON_DATA, 0);


static const szDefaultWeaponsNames[][] = { "p228", "scout", "hegrenade",
"xm1014", "mac10", "aug", "smokegrenade", "elite", "fiveseven",
"ump45", "sg550", "galil", "usp", "famas", "glock18",
"awp", "mp5navy", "m249", "m3", "m4a1", "tmp", "g3sg1",
"flashbang", "deagle", "sg552", "ak47", "p90"
};

g_tDefaultWeapons = TrieCreate();
for (new i, aSize = sizeof(szDefaultWeaponsNames); i < aSize; i++)
TrieSetCell(g_tDefaultWeapons, szDefaultWeaponsNames[i], i);

if (!LoadSettings())
set_fail_state("Something went wrong");

if (g_aCustomWeapons)
{
if ((g_iCustomWeaponsNum = ArraySize(g_aCustomWeapons)))
g_aMenuSections = ArrayCreate(32, 0);
}
else {
ArrayDestroy(g_aCustomWeapons);
TrieDestroy(g_tDefaultWeapons);
}


#if defined VAMPIRE_SAMPLE
precache_sound(VAMPIRE_SAMPLE);
#endif
}

public plugin_init()
{
register_dictionary("common.txt");
if (register_dictionary("vip_system.txt") == 0)
//createLangFile();

if (CVAR[TAB_ACCESS])
register_message(get_user_msgid("ScoreAttrib"), "Message_ScoreAttrib");

if (CVAR[ONLINE_ACCESS]) {
register_clcmd("say /vips", "clcmd_vip_online");
register_clcmd("say_team /vips", "clcmd_vip_online");
}

//if (CVAR[ONLY_IN_BUYZONE])
// register_event("StatusIcon", "Event_HideStatusIcon", "b", "1=0", "2=buyzone");

if (!g_IsBadMap)
RegisterHookChain(RG_CBasePlayer_OnSpawnEquip, "CBasePlayer_OnSpawnEquip", true);

if (get_member_game(m_bMapHasBombTarget) || get_member_game(m_bMapHasBombZone))
{
if (CVAR[PLANT_UNFREEZE_ACCESS])
{
// ConnorMcLeod
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_c4", "CBaseWeapon_PrimaryAttack", false);
DisableHamForward(PrimaryAttack = RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_c4", "CBaseWeapon_PrimaryAttack_P", true));

RegisterHookChain(RG_CGrenade_DefuseBombStart, "CGrenade_DefuseBombStart", true);
}

if (CVAR[BONUS_ACCESS])
{
if (CVAR[BONUS_EXPLODE_BOMB])
RegisterHookChain(RG_CGrenade_ExplodeBomb, "CGrenade_ExplodeBomb", false);

if (CVAR[BONUS_PLANT_BOMB])
RegisterHookChain(RG_PlantBomb, "PlantBomb", true);

if (CVAR[BONUS_DEFUSED_BOMB])
RegisterHookChain(RG_CGrenade_DefuseBombEnd, "CGrenade_DefuseBombEnd", true);
}
}

if (CVAR[BONUS_ACCESS])
{
RegisterHookChain(RG_CBasePlayer_AddAccount, "CBasePlayer_AddAccount", false);
if (CVAR[BONUS_FRAGS])
RegisterHookChain(RG_CBasePlayer_AddPoints, "CBasePlayer_AddPoints", false);
}

if (CVAR[FALL_DAMAGE_ACCESS])
RegisterHookChain(RG_CSGameRules_FlPlayerFallDamage, "CSGameRules_FlPlayerFallDamage", true);

RegisterHookChain(RG_CBasePlayer_Killed, "CBasePlayer_Killed", true);
RegisterHookChain(RG_CBasePlayer_ThrowGrenade, "CBasePlayer_ThrowGrenade", true);
RegisterHookChain(RG_CBasePlayerWeapon_DefaultDeploy, "CBasePlayerWeapon_DefaultDeploy", false);
RegisterHookChain(RG_CWeaponBox_SetModel, "CWeaponBox_SetModel", false);

bind_pcvar_float(get_cvar_pointer("mp_buytime"), g_flBuyTime);

/*
if (CVAR[ADVANCED_SCOPE])
{
static const szWeapon[][] = {
"weapon_scout", "weapon_awp", "weapon_sg550", "weapon_g3sg1"
};

for (new i; i < sizeof(szWeapon); i++);
RegisterHam(Ham_Item_Deploy, szWeapon[i], "CBaseWeapon_SniperDeploy", true);
}
*/

RegisterHam(Ham_Touch,"weaponbox", "BlockVip")
}

// Найти плагины для кастомный функций после их прогрузки
public plugin_cfg()
{
if (!g_iCustomWeaponsNum)
return;

for (new i, p, aWeapons[WEAPON_DATA], pPlugins = get_pluginsnum(); i < g_iCustomWeaponsNum; i++)
{
ArrayGetArray(g_aCustomWeapons, i, aWeapons);
if (TrieKeyExists(g_tDefaultWeapons, aWeapons[REFERENCE]))
continue;

for (p = 0; p < pPlugins; p++)
{
if (get_func_id(aWeapons[REFERENCE], p) == -1)
continue;

get_plugin(p, aWeapons[PLUGIN_NAME], charsmax(aWeapons[PLUGIN_NAME]));
ArraySetArray(g_aCustomWeapons, i, aWeapons);

break;
}
}
}

public client_putinserver(id)
{

}

public BlockVip(wEnt, id)
{
new aWeapons[WEAPON_DATA];
if (get_user_flags(id) & aWeapons[ACCESS] || !IsEntOnGround(wEnt))
{
return PLUGIN_CONTINUE
}

static szModel[MAX_MODEL_LEN]
entity_get_string(wEnt, EV_SZ_model, szModel, charsmax(szModel))

for(new i = 0; i <sizeof(BLOCK_MODELS); i++)
{
if(!strcmp(szModel, BLOCK_MODELS[i]))
{
set_hudmessage(0, 255, 255, -1.0, 0.6, 2, 3.0, 6.0)
client_print(id, print_center, "Только для VIP!");
return HAM_SUPERCEDE; //Блокируем.
}
}

return PLUGIN_CONTINUE
}

public client_command(id)
{
if (!g_iCustomWeaponsNum || g_IsBadMap || GET_CURRENT_ROUND() < CVAR[EQUIP_ROUND]) {
return PLUGIN_CONTINUE;
}

// 1.1.03 fix
if (g_iUseMenu[id] >= CVAR[MAX_USE])
return PLUGIN_CONTINUE;


new szArgv[64];
read_argv(0, szArgv, charsmax(szArgv));
trim(szArgv);
strtolower(szArgv);

//if ((i = ArrayFindString(g_aCustomWeapons, szArgv)) == -1)
//return PLUGIN_CONTINUE;


new aWeapons[WEAPON_DATA];
for (new i; i < g_iCustomWeaponsNum; i++)
{
ArrayGetArray(g_aCustomWeapons, i, aWeapons);

if (strcmp(aWeapons[ALIAS], szArgv) != 0) {
continue;
}

if (get_user_flags(id) & aWeapons[ACCESS])
{
_GiveCustomWeapon(id,
aWeapons[REFERENCE],
aWeapons[NAME],
aWeapons[V_MODEL],
aWeapons[P_MODEL],
aWeapons[W_MODEL],
aWeapons[AMMO],
aWeapons[BPAMMO],
aWeapons[DAMAGE],
aWeapons[PLUGIN_NAME]
);
}

return PLUGIN_HANDLED;
}

return PLUGIN_CONTINUE;
}

public clcmd_vip_menu(id)
{
if (!g_iCustomWeaponsNum) {
return PLUGIN_HANDLED;
}

if (!rg_user_in_buyzone(id) && CVAR[ONLY_IN_BUYZONE]) {
return PLUGIN_HANDLED;
}

if (g_IsBadMap)
client_print_color(id, print_team_red, "%L %L", LANG_PLAYER, "VIP_PREFIX", LANG_PLAYER, "VIP_BAD_MAP");
else if (GET_CURRENT_ROUND() < CVAR[EQUIP_ROUND])
client_print_color(id, print_team_red, "%L %L", LANG_PLAYER, "VIP_PREFIX", LANG_PLAYER, "VIP_ROUND", CVAR[EQUIP_ROUND]);
else if (!is_user_alive(id))
client_print_color(id, print_team_red, "%L %L", LANG_PLAYER, "VIP_PREFIX", LANG_PLAYER, "VIP_ALIVE");
else if (rg_buytime_expired() && CVAR[BUYTIME_EXPIRED])
client_printex(id, print_center, "#Cant_buy"); // client_print_color(id, print_team_red, "%L %L", LANG_PLAYER, "VIP_PREFIX", LANG_PLAYER, "VIP_TIME_EXPIRED");
else if (g_iUseMenu[id] >= CVAR[MAX_USE])
client_print_color(id, print_team_red, "%L %L", LANG_PLAYER, "VIP_PREFIX", LANG_PLAYER, "VIP_MAX_USE");

else
show_vip_menu(id);


return PLUGIN_HANDLED;
}

show_vip_menu(id)
{
ArrayClear(g_aMenuSections);
// ArrayPushString(g_aMenuSections, DEFAULT_SECTION);

new menu = menu_create(fmt("%L", LANG_PLAYER, "VIP_MENU_TITLE", CVAR[MAX_USE] - g_iUseMenu[id]), "vip_menu_handler");

for (new i, aWeapons[WEAPON_DATA], flag = get_user_flags(id); i < g_iCustomWeaponsNum; i++)
{
ArrayGetArray(g_aCustomWeapons, i, aWeapons);

if (~flag & aWeapons[ACCESS]) {
continue;
}

if ((ArrayFindString(g_aMenuSections, aWeapons[CLASS])) != -1) {
continue;
}

// menu_additem(menu, aWeapons[CLASS], fmt("%i", ArrayPushString(g_aMenuSections, aWeapons[CLASS])));
ArrayPushString(g_aMenuSections, aWeapons[CLASS]); {
menu_additem(menu, aWeapons[CLASS]);
}
}

if (menu_items(menu) < 1)
{
// client_print_color(id, print_team_red, "%L %L", LANG_PLAYER, "VIP_PREFIX", LANG_PLAYER, "VIP_NO_ACCESS");
menu_destroy(menu);
return;
}

menu_setprop(menu, MPROP_SHOWPAGE, false);
menu_setprop(menu, MPROP_NEXTNAME, fmt("%L", LANG_PLAYER, "VIP_MENU_NEXT"));
menu_setprop(menu, MPROP_BACKNAME, fmt("%L", LANG_PLAYER, "VIP_MENU_BACK"));
menu_setprop(menu, MPROP_EXITNAME, fmt("%L", LANG_PLAYER, "VIP_MENU_EXIT"));

menu_display(id, menu);
}

public vip_menu_handler(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}

new szName[64];

menu_item_getinfo(menu, item, .name = szName, .namelen = charsmax(szName));
menu_destroy(menu);

menu
= menu_create(szName, "vip_section_menu_handler"
);

for (new i, aWeapons[WEAPON_DATA]; i < g_iCustomWeaponsNum; i++)
{
ArrayGetArray(g_aCustomWeapons, i, aWeapons);

if (strcmp(szName, aWeapons[CLASS], true) == 0) {
menu_additem(menu, fmt("%s^t^t^t\r(\y%.1f%% урон\r)", aWeapons[NAME], aWeapons[DAMAGE]), fmt("%i", i), .paccess = aWeapons[ACCESS]);
}
}

menu_setprop(menu, MPROP_SHOWPAGE, false);
menu_setprop(menu, MPROP_NEXTNAME, fmt("%L", LANG_PLAYER, "VIP_MENU_NEXT"));
menu_setprop(menu, MPROP_BACKNAME, fmt("%L", LANG_PLAYER, "VIP_MENU_BACK"));
menu_setprop(menu, MPROP_EXITNAME, fmt("%L", LANG_PLAYER, "VIP_MENU_EXIT"));

menu_display(id, menu);

return PLUGIN_HANDLED;
}

public vip_section_menu_handler(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}

new aWeapons[WEAPON_DATA], szNum[64];

menu_item_getinfo(menu, item, _, szNum, charsmax(szNum), _, _, _);
menu_destroy(menu);

ArrayGetArray(g_aCustomWeapons, str_to_num(szNum), aWeapons);

if (!
_GiveCustomWeapon(id,
aWeapons[REFERENCE],
aWeapons[NAME],
aWeapons[V_MODEL],
aWeapons[P_MODEL],
aWeapons[W_MODEL],
aWeapons[AMMO],
aWeapons[BPAMMO],
aWeapons[DAMAGE],
aWeapons[PLUGIN_NAME]
)
)
return PLUGIN_HANDLED;

if (++g_iUseMenu[id] < CVAR[MAX_USE] && CVAR[MENU_MODE])
show_vip_menu(id);

return PLUGIN_HANDLED;
}

// xenForo
public clcmd_vip_online(id)
{
new aPlayers[MAX_PLAYERS], pNum, i, c, text[128];
get_players(aPlayers, pNum, "ch");

// while (--pNum >= 0)
for (--pNum; pNum >= 0; pNum--)
{
i = aPlayers[pNum];

if (~get_user_flags(i) & CVAR[ONLINE_ACCESS])
continue;

if (++c == 1)
strcat(text, fmt("%n", i), charsmax(text));
else if (c <= 3)
strcat(text, fmt(", %n", i), charsmax(text));
}

if (c)
{
if (c > 3)
strcat(text, fmt( c - 3 == 1 ? " и ещё 1" : " и %d других", c - 3 ), charsmax(text));

client_print_color(id, print_team_blue, "%L %L %s", LANG_PLAYER, "VIP_PREFIX", LANG_PLAYER, "VIP_ONLINE", text);
}
else
client_print_color(id, print_team_red, "%L %L %L", LANG_PLAYER, "VIP_PREFIX", LANG_PLAYER, "VIP_ONLINE", LANG_PLAYER, "VIP_ONLINE_NO");

return PLUGIN_HANDLED;
}

public Event_HideStatusIcon(const id)
{
//UTIL_CloseMenu(id);
}

public CBasePlayer_OnSpawnEquip(const id)
{
new flag = get_user_flags(id);

if (CVAR[VAMPIRE_ACCESS] && (flag & CVAR[VAMPIRE_ACCESS])) {
set_entvar(id, var_max_health, CVAR[VAMPIRE_HEALTH_MAX]);
}

if (GET_CURRENT_ROUND() < CVAR[EQUIP_ROUND])
return;

if (CVAR[EQUIP_ONLY_1] && !rg_is_user_first_spawn(id))
return;

g_iUseMenu[id] = 0;

if (CVAR[EQUIP_PISTOL][0] && CVAR[EQUIP_PISTOL_ACCESS])
{
if (flag & CVAR[EQUIP_PISTOL_ACCESS])
{
if (!user_has_weapon(id, rg_get_weapon_info(fmt("weapon_%s", CVAR[EQUIP_PISTOL]), WI_ID)))
rg_give_item_ex(id, fmt("weapon_%s", CVAR[EQUIP_PISTOL]), GT_DROP_AND_REPLACE);
}
}

if (CVAR[EQUIP_HE_ACCESS] && (flag & CVAR[EQUIP_HE_ACCESS]))
rg_give_item(id, "weapon_hegrenade");

if (CVAR[EQUIP_FLASH_ACCESS] && (flag & CVAR[EQUIP_FLASH_ACCESS]))
rg_give_item(id, "weapon_flashbang");

if (CVAR[EQUIP_SMOKE_ACCESS] && (flag & CVAR[EQUIP_SMOKE_ACCESS]))
rg_give_item(id, "weapon_smokegrenade");

if (CVAR[EQUIP_AUTO_RELOAD_ACCESS] && (flag & CVAR[EQUIP_AUTO_RELOAD_ACCESS]))
rg_instant_reload_weapons(id);

if (CVAR[EQUIP_ARMOR_ACCESS] && (flag & CVAR[EQUIP_ARMOR_ACCESS]))
rg_give_item(id, "item_assaultsuit");

if (CVAR[EQUIP_NIGHTVISION_ACCESS] && (flag & CVAR[EQUIP_NIGHTVISION_ACCESS]))
set_member(id, m_bHasNightVision, true);

if (CVAR[EQUIP_DKIT_ACCESS])
if (flag & CVAR[EQUIP_DKIT_ACCESS] && get_member(id, m_iTeam) == TEAM_CT)
rg_give_defusekit(id, true);

if (g_iCustomWeaponsNum && CVAR[MENU_MODE])
{
if (CVAR[MENU_MODE] == 3 && get_member(id, m_bNotKilled) ||
CVAR[MENU_MODE] == 2 && rg_user_has_primary(id)
)
return;

show_vip_menu(id);
}
}

public CBaseWeapon_PrimaryAttack(const pWeapon)
{
new id = get_member(pWeapon, m_pPlayer);

// ConnorMcLeod
if (
get_user_flags(id) & CVAR[PLANT_UNFREEZE_ACCESS]
&& !get_member(pWeapon, m_C4_bStartedArming)
&& rg_user_in_bombzone(id)
&& (get_entvar(id, var_flags) & FL_ONGROUND) == FL_ONGROUND
)
EnableHamForward(PrimaryAttack);
}

public CBaseWeapon_PrimaryAttack_P(const pWeapon)
{
DisableHamForward(PrimaryAttack);

set_entvar(get_member(pWeapon, m_pPlayer), var_maxspeed, 250.0 /* knife speed */ );
}

public PlantBomb(id, Float:vecStart[3], Float:vecVelocity[3])
{
if (get_user_flags(id) & CVAR[BONUS_ACCESS])
{
rg_add_account(id, CVAR[BONUS_PLANT_BOMB]);
}
}

public CGrenade_ExplodeBomb(const this, tracehandle, const dmg_bits)
{
new id = get_entvar(this, var_owner);

if (is_user_connected(id) && get_user_flags(id) & CVAR[BONUS_ACCESS])
{
rg_add_account(id, CVAR[BONUS_EXPLODE_BOMB]);
}
}

public CGrenade_DefuseBombStart(const ent, const id)
{
if (get_user_flags(id) & CVAR[BONUS_ACCESS])
{
set_entvar(id, var_maxspeed, 250.0);
}
}

public CGrenade_DefuseBombEnd(const this, const id, bool:bDefused)
{
if (bDefused && get_user_flags(id) & CVAR[BONUS_ACCESS])
{
rg_add_account(id, CVAR[BONUS_DEFUSED_BOMB]);
}
}

public CBasePlayer_AddAccount(const id, amount, RewardType:type, bool:bTrackChange)
{
if (~get_user_flags(id) & CVAR[BONUS_ACCESS])
return;

if (CVAR[BONUS_KILLED] && type == RT_ENEMY_KILLED)
SetHookChainArg(2, ATYPE_INTEGER, CVAR[BONUS_KILLED]);
else if (CVAR[BONUS_HOSTAGE_TOOK] && type == RT_HOSTAGE_TOOK)
SetHookChainArg(2, ATYPE_INTEGER, CVAR[BONUS_HOSTAGE_TOOK]);
else if (CVAR[BONUS_HOSTAGE_RESCUED] && type == RT_HOSTAGE_RESCUED)
SetHookChainArg(2, ATYPE_INTEGER, CVAR[BONUS_HOSTAGE_RESCUED]);
else if (CVAR[BONUS_VIP_KILLED] && type == RT_VIP_KILLED)
SetHookChainArg(2, ATYPE_INTEGER, CVAR[BONUS_VIP_KILLED]);
else if (CVAR[BONUS_VIP_RESCUED_MYSELF] && type == RT_VIP_RESCUED_MYSELF)
SetHookChainArg(2, ATYPE_INTEGER, CVAR[BONUS_VIP_RESCUED_MYSELF]);
else if (CVAR[BONUS_DISCOUNT] && type == RT_PLAYER_BOUGHT_SOMETHING)
SetHookChainArg(2, ATYPE_INTEGER, floatround(float(amount) - (amount / 100.0 * CVAR[BONUS_DISCOUNT]), floatround_ceil));
else if (CVAR[BONUS_ROUND] && type == RT_ROUND_BONUS)
SetHookChainArg(2, ATYPE_INTEGER, floatround(float(amount) * CVAR[BONUS_ROUND]));
}

public CBasePlayer_AddPoints(const id, score, bAllowNegativeScore)
{
if (get_user_flags(id) & CVAR[BONUS_ACCESS])
SetHookChainArg(2, ATYPE_INTEGER, CVAR[BONUS_FRAGS]);
}

public CSGameRules_FlPlayerFallDamage(const id)
{
if (get_user_flags(id) & CVAR[FALL_DAMAGE_ACCESS])
SetHookChainReturn(ATYPE_FLOAT, 0.0);
}

public CBasePlayer_TakeDamage(id, inflictor, attacker, Float:damage, dmg_bits)
{
if (~dmg_bits & (DMG_BULLET | DMG_NEVERGIB))
return;

if (!VALID_PLAYER(attacker) || id == attacker)
return;

if (inflictor != attacker)
return;

if (!rg_is_player_can_takedamage(id, attacker))
return;

SetHookChainArg(4, ATYPE_FLOAT, 0.0);
}

public CBasePlayer_Killed(const id, const pevAttacker)
{
//UTIL_CloseMenu(id);

if (id == pevAttacker || !VALID_PLAYER(pevAttacker))
return;

new flag = get_user_flags(pevAttacker);

//if (CVAR[BONUS_ACCESS] && (flag & CVAR[BONUS_ACCESS]))
//ExecuteHamB(Ham_AddPoints, pevAttacker, CVAR[BONUS_FRAGS], true);

if (CVAR[INSTANT_RELOAD_ACCESS] && (flag & CVAR[INSTANT_RELOAD_ACCESS]))
{
if (CVAR[INSTANT_RELOAD])
{
new pWeapon = get_member(pevAttacker, m_pActiveItem);
if (!is_nullent(pWeapon))
rg_instant_reload_weapons(pevAttacker, pWeapon);
}
else
rg_instant_reload_weapons(pevAttacker);
}

if (CVAR[VAMPIRE_ACCESS] && (flag & CVAR[VAMPIRE_ACCESS]))
{
new Float:health
= get_member(id, m_bKilledByGrenade) ? CVAR[VAMPIRE_HEALTH_NADE]
: get_member(id, m_bHeadshotKilled) ? CVAR[VAMPIRE_HEALTH_HS]
: CVAR[VAMPIRE_HEALTH]
;

if (ExecuteHamB(Ham_TakeHealth, pevAttacker, health, DMG_GENERIC))
{
if (CVAR[VAMPIRE_HUD])
{
set_hudmessage(50, 225, 80, -1.0, 0.25, 0, 0.0, 1.75, 0.1, 0.4);
show_hudmessage(pevAttacker, "%L", LANG_PLAYER, "VAMPIRE_HUD_INFO", health);
}

#if defined VAMPIRE_SAMPLE
if (CVAR[VAMPIRE_SOUND])
client_cmd(pevAttacker, "spk ^"%s^"", VAMPIRE_SAMPLE);
#endif

if (CVAR[VAMPIRE_SCREENFADE])
UTIL_ScreenFade(pevAttacker);
}
}
}

public CBasePlayerWeapon_DefaultDeploy(pWeapon, viewModel[], weaponModel[], anim, animExt[], skiplocal)
{
// if (pWeapon <= 0)
// return;

// new id = get_member(pWeapon, m_pPlayer);

// if (!VALID_PLAYER(id))
// return;

new szModel[MAX_RESOURCE_PATH_LENGTH];
get_entvar(pWeapon, viewmodel, szModel, charsmax(szModel));
if (szModel[0])
SetHookChainArg(2, ATYPE_STRING, szModel);

get_entvar(pWeapon, playermodel, szModel, charsmax(szModel));
if (szModel[0])
SetHookChainArg(3, ATYPE_STRING, szModel);
}

public CWeaponBox_SetModel(pWeaponBox, const szModel[])
{
new pWeapon = UTIL_GetWeaponBoxWeapon(pWeaponBox);
if (pWeapon == NULLENT)
return;

// new id = get_member(pWeapon, m_pPlayer);

// if (!VALID_PLAYER(id))
// return;

new szModel[MAX_RESOURCE_PATH_LENGTH];
get_entvar(pWeapon, gunmodel, szModel, charsmax(szModel));
if (szModel[0])
SetHookChainArg(2, ATYPE_STRING, szModel);
}

public CBasePlayer_ThrowGrenade()
{
new pWeapon = GetHookChainReturn(ATYPE_INTEGER);
if ( !pWeapon )
return;

// new id = get_member(pWeapon, m_pPlayer);

// if (!VALID_PLAYER(id))
// return;

new szModel[MAX_RESOURCE_PATH_LENGTH];
get_entvar(pWeapon, gunmodel, szModel, charsmax(szModel));
if (szModel[0])
engfunc(EngFunc_SetModel, pWeapon, szModel);
}

public Message_ScoreAttrib(msg_id, msg_type, msg_entity)
{
if (get_msg_arg_int(ScoreAttrib_Flags)
|| ~get_user_flags(get_msg_arg_int(ScoreAttrib_PlayerID)) & CVAR[TAB_ACCESS]
)
return;

set_msg_arg_int(ScoreAttrib_Flags, ARG_BYTE, SCORE_STATUS_VIP);
}

bool:_GiveCustomWeapon(id, const reference[], const name[], const v_model[] = "", const p_model[] = "", const w_model[] = "", const ammo = 0, const bpammo = 0, const Float:damage = 0.0, const pluginName[] = "")
{
if (!is_user_alive(id)) {
client_print_color(id, print_team_red, "%L %L", LANG_PLAYER, "VIP_PREFIX", LANG_PLAYER, "VIP_ALIVE");
return false;
}

if (!rg_user_in_buyzone(id) && CVAR[ONLY_IN_BUYZONE]) {
client_print_color(id, print_team_red, "%L %L", LANG_PLAYER, "VIP_PREFIX", LANG_PLAYER, "VIP_ONLY_IN_BUYZONE");
return false;
}

if (rg_buytime_expired() && CVAR[BUYTIME_EXPIRED]) {
client_printex(id, print_center, "#Cant_buy");
return false;
}

if (pluginName[0])
{
if (callfunc_begin(reference, pluginName) == 1)
{
callfunc_push_int(id);
callfunc_end();

return true;
}

//rg_add_account(id, -);
}
else
{

/*
new pWeapon, GiveType:type = GT_DROP_AND_REPLACE;
if (CVAR[DROP_TYPE] && CVAR[DROP_TYPE_ACCESS] && (get_user_flags(id) & CVAR[DROP_TYPE_ACCESS]))
type = GT_APPEND;
*/

new pWeapon, WeaponIdType:weapon_id = rg_get_weapon_info(fmt("weapon_%s", reference), WI_ID);
// rg_get_weapon_info(rg_get_weapon_info(reference, WI_ID), WI_NAME, szWeaponName, charsmax(szWeaponName));
if (!is_nullent((pWeapon = rg_give_item(id, fmt("weapon_%s", reference), GT_REPLACE)))) /* только REPLACE */
{
if (ammo)
{
rg_set_iteminfo(pWeapon, ItemInfo_iMaxClip, ammo);
rg_set_user_ammo(id, weapon_id, ammo);
}

if (bpammo)
{
rg_set_iteminfo(pWeapon, ItemInfo_iMaxAmmo1, bpammo);
rg_set_user_bpammo(id, weapon_id, bpammo);
}

if (damage)
{
set_member(pWeapon, m_Weapon_flBaseDamage, Float: get_member(pWeapon, m_Weapon_flBaseDamage) + (Float: get_member(pWeapon, m_Weapon_flBaseDamage) / 100.0 * damage));

switch (weapon_id)
{
case WEAPON_M4A1:
set_member(pWeapon, m_M4A1_flBaseDamageSil, Float: get_member(pWeapon, m_M4A1_flBaseDamageSil) + (Float: get_member(pWeapon, m_M4A1_flBaseDamageSil) / 100.0 * damage));
case WEAPON_USP:
set_member(pWeapon, m_USP_flBaseDamageSil, Float: get_member(pWeapon, m_USP_flBaseDamageSil) + (Float: get_member(pWeapon, m_USP_flBaseDamageSil) / 100.0 * damage));
case WEAPON_FAMAS:
set_member(pWeapon, m_Famas_flBaseDamageBurst, Float: get_member(pWeapon, m_Famas_flBaseDamageBurst) + (Float: get_member(pWeapon, m_Famas_flBaseDamageBurst) / 100.0 * damage));
}
}

if (v_model[0])
set_entvar(pWeapon, viewmodel, v_model);

if (p_model[0])
set_entvar(pWeapon, playermodel, p_model);

if (w_model[0])
set_entvar(pWeapon, gunmodel, w_model);

ExecuteHamB(Ham_Item_Deploy, pWeapon);

client_print_color(id, print_team_default, "%L %L", LANG_PLAYER, "VIP_PREFIX", LANG_PLAYER, "VIP_BUY_CUSTOM_GUN", name);
//rg_add_account(id, -);

return true;
}
}

return false;
}

LoadSettings()
{
new szCfgDir[PLATFORM_MAX_PATH];
get_localinfo("amxx_configsdir", szCfgDir, charsmax(szCfgDir));
add(szCfgDir, charsmax(szCfgDir), "/plugins");

if (!dir_exists(szCfgDir))
return false;

add(szCfgDir, charsmax(szCfgDir), "/vip_system.ini");

if (!file_exists(szCfgDir))
return false;

new INIParser:parser = INI_CreateParser();

if (parser != Invalid_INIParser)
{
INI_SetReaders(parser, "OnKeyValue", "OnNewSection");
INI_ParseFile(parser, szCfgDir);
INI_DestroyParser(parser);

return true;
}

return false;
}

public bool:OnNewSection(INIParser:handle, const section[], bool:invalid_tokens, bool:close_bracket)
{
if (!close_bracket)
{
log_amx("Closing bracket was not detected! Current section name '%s'.", section);
return false;
}

if (strcmp(section, "COMMANDS") == 0)
{
SECTION = COMMANDS;
return true;
}

if (strcmp(section, "INFO") == 0)
{
SECTION = INFO;
return true;
}

if (strcmp(section, "EQUIP_MANAGER") == 0)
{
SECTION = EQUIP_MANAGER;
return true;
}

if (strcmp(section, "ABILITIES") == 0)
{
SECTION = ABILITIES;
return true;
}

if (strcmp(section, "BONUSES") == 0)
{
SECTION = BONUSES;
return true;
}

if (strcmp(section, "VAMPIRE") == 0)
{
SECTION = VAMPIRE;
return true;
}

if (strcmp(section, "CUSTOM_WEAPONS") == 0)
{
SECTION = CUSTOM_WEAPONS;
return true;
}

if (strcmp(section, "MAPS") == 0)
{
SECTION = MAPS;
return true;
}

return false;
}

public bool:OnKeyValue(INIParser:handle, const key[], const value[])
{
switch (SECTION)
{
case NULL:
return false;

case COMMANDS:
{
if (key[0] == '/' || key[0] == '!' || key[0] == '.')
{
register_clcmd(fmt("say %s", key), "clcmd_vip_menu");
register_clcmd(fmt("say_team %s", key), "clcmd_vip_menu");
}
else
{
register_clcmd(key, "clcmd_vip_menu");
}
}

case INFO:
{
if (strcmp(key, "tab") == 0)
CVAR[TAB_ACCESS] = read_flags(value);
else if (strcmp(key, "online") == 0)
CVAR[ONLINE_ACCESS] = read_flags(value);
else if (strcmp(key, "connect_info") == 0)
CVAR[CONNECT_ACCESS] = read_flags(value);
}

case EQUIP_MANAGER:
{
if (strcmp(key, "equip_round") == 0)
CVAR[EQUIP_ROUND] = str_to_num(value);
else if (strcmp(key, "equip_only_spawn") == 0)
CVAR[EQUIP_ONLY_1] = str_to_num(value);
else if (strcmp(key, "equip_pistol") == 0)
{
if (TrieKeyExists(g_tDefaultWeapons, value))
copy(CVAR[EQUIP_PISTOL], charsmax(CVAR[EQUIP_PISTOL]), value);
}
else if (strcmp(key, "he") == 0)
CVAR[EQUIP_HE_ACCESS] = read_flags(value);
else if (strcmp(key, "flash") == 0)
CVAR[EQUIP_FLASH_ACCESS] = read_flags(value);
else if (strcmp(key, "smoke") == 0)
CVAR[EQUIP_SMOKE_ACCESS] = read_flags(value);
else if (strcmp(key, "auto_reload") == 0)
CVAR[EQUIP_AUTO_RELOAD_ACCESS] = read_flags(value);
else if (strcmp(key, "armor") == 0)
CVAR[EQUIP_ARMOR_ACCESS] = read_flags(value);
else if (strcmp(key, "def") == 0)
CVAR[EQUIP_DKIT_ACCESS] = read_flags(value);
else if (strcmp(key, "nightvision") == 0)
CVAR[EQUIP_NIGHTVISION_ACCESS] = read_flags(value);
else if (strcmp(key, "pistol") == 0)
CVAR[EQUIP_PISTOL_ACCESS] = read_flags(value);
}

case ABILITIES:
{
/*
if (strcmp(key, "drop_mode_access") == 0)
CVAR[DROP_TYPE_ACCESS] = read_flags(value);
else if (strcmp(key, "drop_mode") == 0)
CVAR[DROP_TYPE] = str_to_num(value);
*/
if (strcmp(key, "fall_dmg") == 0)
CVAR[FALL_DAMAGE_ACCESS] = read_flags(value);
else if (strcmp(key, "plant_unfreeze") == 0)
CVAR[PLANT_UNFREEZE_ACCESS] = read_flags(value);
else if (strcmp(key, "menu_mode") == 0)
CVAR[MENU_MODE] = str_to_num(value);
else if (strcmp(key, "only_in_buyzone") == 0)
CVAR[ONLY_IN_BUYZONE] = str_to_num(value);
else if (strcmp(key, "buytime_expired") == 0)
CVAR[BUYTIME_EXPIRED] = str_to_num(value);
else if (strcmp(key, "max_use") == 0)
CVAR[MAX_USE] = str_to_num(value);
else if (strcmp(key, "instant_reload_weapons_access") == 0)
CVAR[INSTANT_RELOAD_ACCESS] = read_flags(value);
else if (strcmp(key, "instant_reload_weapons") == 0)
CVAR[INSTANT_RELOAD] = str_to_num(value);
}

case BONUSES:
{
if (strcmp(key, "bonus_access") == 0)
CVAR[BONUS_ACCESS] = read_flags(value);
else if (strcmp(key, "frags") == 0)
CVAR[BONUS_FRAGS] = str_to_num(value);
else if (strcmp(key, "killed") == 0)
CVAR[BONUS_KILLED] = str_to_num(value);
else if (strcmp(key, "bomb_planted") == 0)
CVAR[BONUS_PLANT_BOMB] = str_to_num(value);
else if (strcmp(key, "bomb_explode") == 0)
CVAR[BONUS_EXPLODE_BOMB] = str_to_num(value);
else if (strcmp(key, "bomb_defused") == 0)
CVAR[BONUS_DEFUSED_BOMB] = str_to_num(value);
else if (strcmp(key, "hostage_took") == 0)
CVAR[BONUS_HOSTAGE_TOOK] = str_to_num(value);
else if (strcmp(key, "hostage_rescued") == 0)
CVAR[BONUS_HOSTAGE_RESCUED] = str_to_num(value);
else if (strcmp(key, "vip_killed") == 0)
CVAR[BONUS_VIP_KILLED] = str_to_num(value);
else if (strcmp(key, "vip_rescued_myself") == 0)
CVAR[BONUS_VIP_RESCUED_MYSELF] = str_to_num(value);
else if (strcmp(key, "terminating") == 0)
CVAR[BONUS_ROUND] = str_to_float(value);
else if (strcmp(key, "discount") == 0)
CVAR[BONUS_DISCOUNT] = floatclamp(str_to_float(value), 0.0, 100.0);
}

case VAMPIRE:
{
if (strcmp(key, "vampire_access") == 0)
CVAR[VAMPIRE_ACCESS] = read_flags(value);
else if (strcmp(key, "vampire_health") == 0)
CVAR[VAMPIRE_HEALTH] = str_to_float(value);
else if (strcmp(key, "vampire_health_hs") == 0)
CVAR[VAMPIRE_HEALTH_HS] = str_to_float(value);
else if (strcmp(key, "vampire_health_nade") == 0)
CVAR[VAMPIRE_HEALTH_NADE] = str_to_float(value);
else if (strcmp(key, "vampire_health_max") == 0)
CVAR[VAMPIRE_HEALTH_MAX] = str_to_float(value);
else if (strcmp(key, "vampire_screenfade") == 0)
CVAR[VAMPIRE_SCREENFADE] = str_to_num(value);
else if (strcmp(key, "vampire_hud") == 0)
CVAR[VAMPIRE_HUD] = str_to_num(value);
#if defined VAMPIRE_SAMPLE
else if (strcmp(key, "vampire_sound") == 0)
CVAR[VAMPIRE_SOUND] = str_to_num(value);
#endif
}

case CUSTOM_WEAPONS:
{
new aData[RULES][128], aWeapons[WEAPON_DATA];

if (explode_string(key, " | ", aData, sizeof(aData), charsmax(aData[])) == RULES)
{
if (strcmp(aData[0], "_") != 0)
aWeapons[ACCESS] = read_flags(aData[0]);
if (strcmp(aData[1], "_") != 0)
copy(aWeapons[REFERENCE], charsmax(aWeapons[REFERENCE]), aData[1]);
if (strcmp(aData[2], "_") != 0)
copy(aWeapons[NAME], charsmax(aWeapons[NAME]), aData[2]);
if (strcmp(aData[3], "_") != 0)
{
strtolower(aData[3]);
copy(aWeapons[ALIAS], charsmax(aWeapons[ALIAS]), aData[3]);
}
if (strcmp(aData[4], "_") != 0)
{
if (file_exists(fmt("%s/%s", FOLDER, aData[4])))
{
copy(aWeapons[V_MODEL], charsmax(aWeapons[V_MODEL]), fmt("%s/%s", FOLDER, aData[4]));

precache_model(aWeapons[V_MODEL]);
}
else
aWeapons[V_MODEL][0] = '^0';
}
if (strcmp(aData[5], "_") != 0)
{
if (file_exists(fmt("%s/%s", FOLDER, aData[5])))
{
copy(aWeapons[P_MODEL], charsmax(aWeapons[P_MODEL]), fmt("%s/%s", FOLDER, aData[5]));

precache_model(aWeapons[P_MODEL]);
}
else
aWeapons[P_MODEL][0] = '^0';
}
if (strcmp(aData[6], "_") != 0)
{
if (file_exists(fmt("%s/%s", FOLDER, aData[6])))
{
copy(aWeapons[W_MODEL], charsmax(aWeapons[W_MODEL]), fmt("%s/%s", FOLDER, aData[6]));

precache_model(aWeapons[W_MODEL]);
}
else
aWeapons[W_MODEL][0] = '^0';
}
if (strcmp(aData[7], "_") != 0)
aWeapons[AMMO] = str_to_num(aData[7]);
if (strcmp(aData[8], "_") != 0)
aWeapons[BPAMMO] = str_to_num(aData[8]);
if (strcmp(aData[9], "_") != 0)
aWeapons[DAMAGE] = str_to_float(aData[9]);

copy(aWeapons[CLASS], charsmax(aWeapons[CLASS]), strcmp(aData[10], "_") == 0 ? DEFAULT_SECTION : aData[10]);

ArrayPushArray(g_aCustomWeapons, aWeapons);
/*
if (aWeapons[ALIAS][0])
register_clcmd(aWeapons[ALIAS], "@hook_custom_weapon", ArrayPushArray(g_aCustomWeapons, aWeapons));
else
ArrayPushArray(g_aCustomWeapons, aWeapons);
*/
}
else
log_amx("Не корректно заполнено оружие в 'CUSTOM_WEAPONS' смотрите внимательнее конфиг!");
}

case MAPS:
{
if (containi(MapName, key) != -1) {
g_IsBadMap = true;
return false;
}
}
}

return true;
}

stock bool:rg_buytime_expired()
{
//static mp_buytime;

//if (mp_buytime || (mp_buytime = get_cvar_pointer("mp_buytime")))
{
// new Float:flBuyTime = get_pcvar_float(mp_buytime);

// no limit
if (g_flBuyTime == -1.0)
return false;

if (g_flBuyTime == 0.0
|| (get_gametime() - Float: get_member_game(m_fRoundStartTime) > (g_flBuyTime * 60.0))
)
return true;
}

return false;
}

stock rg_give_item_ex(const id, szWeapon[], GiveType:type = GT_APPEND)
{
rg_give_item(id, szWeapon, type);
{
new Id = rg_get_weapon_info(szWeapon, WI_ID);

set_member(id, m_rgAmmo, rg_get_weapon_info(Id, WI_MAX_ROUNDS), rg_get_weapon_info(Id, WI_AMMO_TYPE));
}
}

stock SignalState:rg_get_user_mapzones(const id)
{
new iSignals[UnifiedSignals];
get_member(id, m_signals, iSignals);

return SignalState:iSignals[US_State];
}

stock bool:rg_user_in_buyzone(const id)
{
return bool:(rg_get_user_mapzones(id) & SIGNAL_BUY);
}

stock bool:rg_user_in_bombzone(const id)
{
return bool:(rg_get_user_mapzones(id) & SIGNAL_BOMB);
}

stock bool:rg_user_has_primary(const id)
{
return bool:((get_member(id, m_rgpPlayerItems, PRIMARY_WEAPON_SLOT) > 0) || get_member(id, m_bHasPrimary));
}

stock bool:rg_is_user_first_spawn(const id)
{
return bool:(get_member(id, m_iNumSpawns) == 1);
}

stock UTIL_ScreenFade(const id, const Float:fxtime = 1.0, const Float:holdtime = 0.15, const color[3] = { 0, 255, 100 }, const alpha = 200)
{
if (Float: get_member(id, m_blindUntilTime) > get_gametime())
return;

static iMsgScreenFade;
if (iMsgScreenFade || (iMsgScreenFade = get_user_msgid("ScreenFade")))
{
message_begin(MSG_ONE_UNRELIABLE, iMsgScreenFade, .player = id);
write_short(clamp(floatround(fxtime * (1 << 12)), 0, 0xFFFF));
write_short(clamp(floatround(holdtime * (1 << 12)), 0, 0xFFFF));
write_short(FFADE_IN);
write_byte(color[0]);
write_byte(color[1]);
write_byte(color[2]);
write_byte(alpha);
message_end();
}
}

stock UTIL_BlinkAcct(const dest, const id, const times)
{
static iMsgBlinkAcct;
if (iMsgBlinkAcct || (iMsgBlinkAcct = get_user_msgid("BlinkAcct")))
{
message_begin(dest, iMsgBlinkAcct, .player = id);
write_byte(times);
message_end();
}
}

stock UTIL_GetWeaponBoxWeapon(const pWeaponBox)
{
for (new item, InventorySlotType:i = PRIMARY_WEAPON_SLOT; i <= PISTOL_SLOT; i++)
if (!is_nullent((item = get_member(pWeaponBox, m_WeaponBox_rgpPlayerItems, i))))
return item;

return NULLENT;
}
Ребят помогите сделать блок на поднятия оружия, все компелируется, но игрок все равно может поднимать
 
  • Lol
Реакции: Nlm
Сообщения
889
Реакции
149
Помог
25 раз(а)
C++:
public Ham_PlayerTouch(iItem, iPlayer) {
    if(!pev_valid(iItem) || !is_user_alive(iPlayer))
        return HAM_IGNORED;       

    new szModelName[32];   

    pev(iItem, pev_model, szModelName, charsmax(szModelName));       

    if(equal(szModelName, WEAPONMODEL_W)) {         
        if(!(get_user_flags(iPlayer) & FLAGACCESS)) {
            static Float:flLastTouch[33];
            new Float:flGameTime = get_gametime();       
            if(flLastTouch[iPlayer] < flGameTime) {
                flLastTouch[iPlayer] = flGameTime + 3.0;
                client_print(iPlayer, print_chat, "Чтoбы взять дaнный пpeдmeт, нyжны oпpeдeлeнныe пpaвa!");
                return HAM_SUPERCEDE;               
            }         
        }     
    }       
    return HAM_IGNORED;
}
 
Последнее редактирование:
Сообщения
584
Реакции
1,006
Помог
18 раз(а)
Benzogang_BabyTape, раз в 3 секунды оружие нельзя поднять, а всё другое время можно?
 
Сообщения
889
Реакции
149
Помог
25 раз(а)

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу