Народ, помогите найти косяк.
Есть плагин VIP menu. Начиная со 2го раунда он должен давать возможность брать галил, калаш, мку, ауг итд. И он их даёт. Начиная с 3го раунда должен давать возможность взять АВП, но почему-то ни в 3ем раунде ни дальше, он АВП не даёт, причём нажимаешь на цифру 4 в игре и ничего не происходит вообще, как будто цифра 4 на клаве не работает.
Код:
#include <amxmodx>
#include <colorchat>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>
#include <fun>
#define VERSION "1.1"
#define VIP_ACCESS (ADMIN_LEVEL_H | ADMIN_BAN)
#define is_user_vip(%0) (get_user_flags(%0) & VIP_ACCESS)
new g_RoundCount, bool:vipCount[33], bool:g_iBlockBonus
const KEYSMENU = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_0
new const PRIMARY_WEAPONS_BIT_SUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90)
new const SECONDARY_WEAPONS_BIT_SUM = (1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE)
public plugin_init() {
register_plugin("VIP", VERSION, "Alienware")
register_cvar("vip_version", VERSION, FCVAR_SERVER | FCVAR_SPONLY)
register_menucmd(register_menuid("menu_title"), KEYSMENU, "menu_handler")
register_event("TextMsg", "Event_GameRestart", "a", "2=#Game_Commencing", "2=#Game_will_restart_in")
register_event("HLTV", "Round_Start", "a", "1=0", "2=0")
register_logevent("Round_end", 2, "1=Round_End")
RegisterHam(Ham_Spawn, "player", "Equip_for_VIP", 1)
register_clcmd("say /vipmenu", "vipmenu")
register_clcmd("vipmenu", "vipmenu")
new iMap_Name[32], iMap_Prefix[][] = { "awp_", "aim_", "35hp_" }
get_mapname(iMap_Name, charsmax(iMap_Name))
for(new i; i < sizeof(iMap_Prefix); ++i)
if(containi(iMap_Name, iMap_Prefix[i]) != -1) g_iBlockBonus = true
}
public Round_Start() {
for(new i = 1; i <= get_playersnum(); ++i)
vipCount[i] = false
}
public Event_GameRestart()
g_RoundCount = 1
public Round_end()
g_RoundCount++
public vipmenu(id) {
if(g_iBlockBonus) return PLUGIN_HANDLED
if(!is_user_alive(id)) return PLUGIN_HANDLED
if(!is_user_vip(id)) {
ColorChat(id, GREEN, "^x01[^x04Сервер^x01] ^x01Недостаточно прав")
return PLUGIN_HANDLED
}
if(vipCount[id]) {
ColorChat(id, GREEN, "^x01[^x04Сервер^x01] ^x01Меню доступно 1 раз за раунд")
return PLUGIN_HANDLED
}
static szMenu[768], len
len = formatex(szMenu, charsmax(szMenu), "\wVIP меню^n")
if(cs_get_user_team(id) == CS_TEAM_CT) {
len += formatex(szMenu[len], charsmax(szMenu) - len, "\r1. \wВзять \yFamas^n")
len += formatex(szMenu[len], charsmax(szMenu) - len, "\r2. \wВзять \yM4A1^n")
len += formatex(szMenu[len], charsmax(szMenu) - len, "\r3. \wВзять \yAUG^n")
} else {
len += formatex(szMenu[len], charsmax(szMenu) - len, "\r1. \wВзять \yGalil^n")
len += formatex(szMenu[len], charsmax(szMenu) - len, "\r2. \wВзять \yAK-47^n")
len += formatex(szMenu[len], charsmax(szMenu) - len, "\r3. \wВзять \ySG552^n")
}
len += formatex(szMenu[len], charsmax(szMenu) - len, "\r4. \wВзять \yAWP^n^n")
len += formatex(szMenu[len], charsmax(szMenu) - len, "\r0. \wВыход")
show_menu(id, KEYSMENU, szMenu, -1, "vip_menu_title")
vipCount[id] = true
return PLUGIN_HANDLED
}
public menu_handler(id, item) {
new CsTeams:userTeam = cs_get_user_team(id)
switch(item) {
case 0: {
if(is_user_vip(id) && is_user_alive(id) && g_RoundCount >= 2) {
switch(userTeam) {
case (CS_TEAM_CT): {
drop_weapons(id, 1)
give_item(id, "weapon_famas")
cs_set_user_bpammo(id, CSW_FAMAS, 90)
}
case (CS_TEAM_T): {
drop_weapons(id, 1)
give_item(id, "weapon_galil")
cs_set_user_bpammo(id, CSW_GALIL, 90)
}
}
}
}
case 1: {
if(is_user_vip(id) && is_user_alive(id) && g_RoundCount >= 2) {
switch(userTeam) {
case (CS_TEAM_CT): {
drop_weapons(id, 1)
give_item(id, "weapon_m4a1")
cs_set_user_bpammo(id, CSW_M4A1, 90)
}
case (CS_TEAM_T): {
drop_weapons(id, 1)
give_item(id, "weapon_ak47")
cs_set_user_bpammo(id, CSW_AK47, 90)
}
}
}
}
case 2: {
if(is_user_vip(id) && is_user_alive(id) && g_RoundCount >= 2) {
switch(userTeam) {
case (CS_TEAM_CT): {
drop_weapons(id, 1)
give_item(id, "weapon_aug")
cs_set_user_bpammo(id, CSW_AUG, 90)
}
case (CS_TEAM_T): {
drop_weapons(id, 1)
give_item(id, "weapon_sg552")
cs_set_user_bpammo(id, CSW_SG552, 90)
}
}
}
}
case 3: {
if(is_user_vip(id) && is_user_alive(id) && g_RoundCount >= 3) {
drop_weapons(id, 1)
give_item(id, "weapon_awp")
cs_set_user_bpammo(id, CSW_AWP, 30)
}
}
}
return PLUGIN_HANDLED
}
public client_putinserver(id) {
set_task(0.1, "vip_connected", id)
vipCount[id] = false
}
public Equip_for_VIP(id) {
if(is_user_alive(id) && is_user_vip(id) && !g_iBlockBonus) {
drop_weapons(id, 2)
give_item(id, "weapon_deagle")
give_item(id, "weapon_hegrenade")
give_item(id, "weapon_flashbang")
give_item(id, "weapon_smokegrenade")
cs_set_user_bpammo(id, CSW_DEAGLE, 35)
cs_set_user_bpammo(id, CSW_FLASHBANG, 2)
cs_set_user_armor(id, 100, CS_ARMOR_VESTHELM)
if(cs_get_user_team(id) == CS_TEAM_CT) cs_set_user_defuse(id, 1)
}
}
public vip_connected(id) {
if(is_user_vip(id)){
new name[32]; get_user_name(id, name, 31)
ColorChat(0, GREEN, "^x01[^x04Сервер^x01] ^x01VIP ^x04%s^x01 присоединился ", name)
client_cmd(0, "spk buttons/blip1.wav")
}
}
stock drop_weapons(id, dropwhat) {
static weapons[32], num, i, weaponid
num = 0
get_user_weapons(id, weapons, num)
for (i = 0; i < num; i++) {
weaponid = weapons[i]
if((dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)) || (dropwhat == 2 && ((1<<weaponid) & SECONDARY_WEAPONS_BIT_SUM))) {
static wname[32]
get_weaponname(weaponid, wname, charsmax(wname))
engclient_cmd(id, "drop", wname)
}
}
}