Код
#include <amxmodx>
#include <fakemeta_util>
#include <cstrike>
#include <fun>
#include <hamsandwich>
#include <aes_main>
#include <colorchat>
// #### Конфигурационные defines ####
#define VIP_ACCESS ADMIN_LEVEL_H // Флаг доступа VIP (по дефолту флаг "t" ADMIN_LEVEL_H)
#define CHATTAG "^1[^4VIP^1]^4" // Префикс перед сообщениями || ^1 - желтый ^3 - цвет команды ^4 - зеленый
#define PUNKTMENU1 3 // Через сколько можно еще раз использовать пункт 1
#define PUNKTMENU2 3 // Через сколько можно еще раз использовать пункт 2
#define PUNKTMENU3 8 // Через сколько можно еще раз использовать пункт 3
#define PUNKTMENU4 1 // Через сколько можно еще раз использовать пункт 4
#define PUNKTMENU5 3 // Через сколько можно еще раз использовать пункт 5
// #### Конфигурационные defines ####
new const STARTMENU = 3
new start_menu = 0
#define is_user_vip(%0) (get_user_flags(%0) & VIP_ACCESS)
new g_roundCount[33][6];
new bool:iUserVip[33];
public plugin_init()
{
register_plugin("vipmenu", "9.999", "nedonebo");
//register_event("TextMsg", "eRestart", "a", "2&#Game_C", "2&#Game_w");
register_event("HLTV","eRoundStart","a","1=0","2=0");
register_event("HLTV", "NewRound", "a", "1=0", "2=0")
RegisterHam(Ham_Spawn, "player", "Player_Spawn", 1);
register_clcmd("say /vipmenu", "vip_handled");
register_clcmd("vipmenu", "vip_handled");
register_menucmd(register_menuid("Vip Menu"), MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5, "handler");
}
//public eRestart()
// g_roundCount[id] = 0;
public eRoundStart()
{
for(new id = 1; id <= get_maxplayers(); id++)
{
if (!is_user_connected(id)) continue
for(new i;i < 6;i++)
{
if (!g_roundCount[id][i]) continue
g_roundCount[id][i]--;
}
}
}
public Player_Spawn(id)
{
if(!is_user_alive(id)) return 0;
if(is_user_vip(id)){
iUserVip[id] = true;
}else{
iUserVip[id] = false
}
return 0;
}
public NewRound()
{
start_menu++
}
public vip_handled(id)
{
if(start_menu <= STARTMENU)
{
new name[32]
get_user_name(id,name,31)
ChatColor(id, "%s^1 Доступ к меню открыт с^3 3 ^1раунда.", CHATTAG)
return PLUGIN_HANDLED;
}
else CmdMenu(id);
return PLUGIN_HANDLED;
}
public CmdMenu(id)
{
if(!is_allow_use(id)) return 0;
static szMenu[512], iLen, iKey;
iKey = MENU_KEY_0;
iLen = formatex(szMenu, 511, "\yВип \wменю \dツ^n^n");
if(g_roundCount[id][1])
iLen += formatex(szMenu[iLen], 511 - iLen, "\d[1] Возродиться [\yПодожди \r%d \yраунд(а)\d]^n", g_roundCount[id][1]);
else
{
iKey |= MENU_KEY_1;
iLen += formatex(szMenu[iLen], 511 - iLen, "\r[\w1\r] \wВозродиться^n");
}
if(g_roundCount[id][2])
iLen += formatex(szMenu[iLen], 511 - iLen, "\d[2] Взять 5000$ [\yПодожди \r%d \yраунд(а)\d]^n", g_roundCount[id][2]);
else
{
iKey |= MENU_KEY_2;
iLen += formatex(szMenu[iLen], 511 - iLen, "\r[\w2\r] \wВзять \y5000$^n");
}
if(g_roundCount[id][3])
iLen += formatex(szMenu[iLen], 511 - iLen, "\d[3] Взять 5 кредитов [\yПодожди \r%d \yраунд(а)\d]^n", g_roundCount[id][3]);
else
{
iKey |= MENU_KEY_3;
iLen += formatex(szMenu[iLen], 511 - iLen, "\r[\w3\r] \wВзять \y5 \wкредитов^n");
}
if(g_roundCount[id][4])
iLen += formatex(szMenu[iLen], 511 - iLen, "\d[4] Взять свечение [\yПодожди \r%d \yраунд(а)\d]^n", g_roundCount[id][4]);
else
{
iKey |= MENU_KEY_4;
iLen += formatex(szMenu[iLen], 511 - iLen, "\r[\w4\r] \wВзять \yсвечение^n");
}
if(g_roundCount[id][5])
iLen += formatex(szMenu[iLen], 511 - iLen, "\d[5] Взять 50хп [\yПодожди \r%d \yраунд(а)\d]^n^n", g_roundCount[id][5]);
else
{
iKey |= MENU_KEY_5;
iLen += formatex(szMenu[iLen], 511 - iLen, "\r[\w5\r] \wВзять \y50хп^n^n");
}
formatex(szMenu[iLen], 511 - iLen, "\r[\w0\r] \wВыход");
set_pdata_int(id, 205, 0);
return show_menu(id, iKey, szMenu, -1, "Vip Menu");
}
public handler(id, iKey)
{
new name[32]
get_user_name(id, name, 31)
switch(iKey)
{
case 0:
{
if(is_user_alive(id) || GetAliveCt() < 2 || GetAliveTt() < 2 || g_roundCount[id][1])
{
CmdMenu(id)
if(is_user_alive(id))
ChatColor(id, "%s ^1Вы живы!", CHATTAG)
else if(GetAliveCt() < 2 || GetAliveTt() < 2)
ChatColor(id, "%s ^1Возрождение при^4 1 ^1запрещено!", CHATTAG)
}
else if(!is_user_alive(id) && (get_user_team(id) == 1 || get_user_team(id) == 2))
{
ExecuteHam(Ham_CS_RoundRespawn, id)
g_roundCount[id][1] = PUNKTMENU1
ChatColor(0, "%s ^3%s ^1возродился", CHATTAG, name)
return 0;
}
}
case 1:
{
if(!is_user_alive(id) || g_roundCount[id][2])
CmdMenu(id)
else
{
cs_set_user_money(id, cs_get_user_money(id) + 5000)
g_roundCount[id][2] = PUNKTMENU2
ChatColor(0, "%s ^3%s ^1взял^4 5000$", CHATTAG, name)
return 0;
}
}
case 2:
{
if(!is_user_alive(id) || g_roundCount[id][3])
CmdMenu(id)
else
{
aes_add_player_bonus(id,5)
g_roundCount[id][3] = PUNKTMENU3
ChatColor(0, "%s ^3%s ^1взял^4 5 кредитов", CHATTAG, name)
return 0;
}
}
case 3:
{
if(!is_user_alive(id) || g_roundCount[id][4])
CmdMenu(id)
else
{
new iRed = random_num(0,255)
new iGreen = random_num(0,255)
new iBlue = random_num(0,255)
set_user_rendering(id,kRenderFxGlowShell, iRed, iGreen, iBlue, kRenderNormal, 50)
g_roundCount[id][4] = PUNKTMENU4
ChatColor(0, "%s ^3%s ^1взял ^4свечение", CHATTAG, name)
return 0;
}
}
case 4:
{
if(!is_user_alive(id) || g_roundCount[id][5])
CmdMenu(id)
else
{
set_user_health(id, get_user_health(id) + 50)
g_roundCount[id][5] = PUNKTMENU5
ChatColor(0, "%s ^3%s ^1взял^4 50хп", CHATTAG, name)
return 0;
}
}
}
return 0;
}
stock ChatColor(id, const szMessage[], any:...)
{
if(id && !is_user_connected(id))
return 1;
new players[32];
new pnum = 1;
new szMsg[190];
vformat(szMsg, charsmax(szMsg), szMessage, 3);
if(!id) get_players(players, pnum, "c");
else players[0] = id;
for(new i; i < pnum; i++)
{
#define mSayText 76
message_begin(MSG_ONE_UNRELIABLE, mSayText, .player = players[i]);
write_byte(players[i]);
write_string(szMsg);
message_end();
}
return 1;
}
bool:is_allow_use(id)
{
if(!iUserVip[id])
{
ChatColor(id, "%s^1 Это меню только для ^3VIP", CHATTAG)
ChatColor(id, "%s^1 Хочешь купить ^4ВИП? ^1[VK]: ^3vk.com/ССЫЛКУ УБРАЛ:))", CHATTAG)
return false;
}
return true;
}
stock GetAliveCt()
{
new CountCt, i
for(i = 1; i <= get_maxplayers(); i++)
if(is_user_alive(i) && is_user_connected(i) && get_user_team(i) == 2)
CountCt++
return CountCt
}
stock GetAliveTt()
{
new CountTt, i
for(i = 1; i <= get_maxplayers(); i++)
if(is_user_alive(i) && is_user_connected(i) && get_user_team(i) == 1)
CountTt++
return CountTt
}