#include <amxmodx>
#include <cstrike>
#include <fun>
#include <hamsandwich>
// #### Начало Конфигурационные defines ####
#define CHATTAG "^3[^4Steam Bonus^3]^3"
#define ADM_FLAG ADMIN_LEVEL_H //Флаг админа, которого игнорируем
#define MIN_MONEY 100
#define MAX_MONEY 600
#define MIN_HP 1
#define MAX_HP 10
#define STEAMBONUSROUND 3
//#define OPENMENUSOUND
// #### Конец Конфигурационные defines ####
new g_roundCount;
public plugin_init()
{
new sPref[][] = {"awp_", "aim_", "35hp", "fy_"};
new map[32]; get_mapname(map, charsmax(map));
for(new i; i < sizeof sPref; i++)
{
if(containi(map, sPref[i]) != -1)
{
pause("ad");
return;
}
}
register_plugin("Steam Bonus", "1.9b", "neygomon and Acid.Sonic")
register_event("TextMsg", "eRestart", "a", "2&#Game_C", "2&#Game_w");
register_event("HLTV","eRoundStart","a","1=0","2=0");
RegisterHam(Ham_Spawn, "player", "Player_Spawn", 1);
register_menucmd(register_menuid("Steam Bonus Menu"), MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4, "SteamBonus");
}
public eRestart(id)
{
g_roundCount = 0;
show_menu(id, 0, "^n", 1)
}
public eRoundStart(id)
{
g_roundCount++;
}
public Player_Spawn(id)
{
if(g_roundCount < STEAMBONUSROUND)
return 0;
return SteamBonusMenu(id);
}
public SteamBonusMenu(id)
{
if(!is_user_steam(id) || (get_user_flags(id) & ADMIN_IMMUNITY)) return 0;
#if defined OPENMENUSOUND
static OpenMenuSound[] = "buttons/blip2";
client_cmd( id, "spk ^"%s^"", OpenMenuSound );
#endif
static szMenu[512], iLen, iKey, Name[32];
get_user_name(id, Name, charsmax(Name))
iKey = MENU_KEY_5|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4;
iLen = formatex(szMenu, 511, "\d[\rSteam Bonus Menu\d]^n\d[\rHello\r: \y%s\d]^n^n\r[\y1\r]\w Деньги^n\r[\y2\r]\w Набор гранат^n\r[\y3\r]\wДобавить \rHP \d[\wДо \r5P\d]^n^n^n", Name);
formatex(szMenu[iLen], 511 - iLen, "\r[\y4\r] [\yОтказаться от бонусов\r]");
return show_menu(id, iKey, szMenu, 10, "Steam Bonus Menu");
}
public SteamBonus(id, iKey)
{
switch(iKey)
{
case 0:
{
new money = cs_get_user_money(id);
new rand_money = random_num(MIN_MONEY, MAX_MONEY);
if(money < 16000 && money <= (money + rand_money)) {
cs_set_user_money(id, money + rand_money);
ChatColor(id, "%s Вы получили бонус деньги за ^4Steam ^3в размере ^4%d$", CHATTAG, rand_money);
}
else if(money < 16000) {
cs_set_user_money(id, 16000);
ChatColor(id, "%s Вы получили бонус деньги за ^4Steam ^3в размере ^4%d$", CHATTAG, rand_money);
}
else ChatColor(id, "%s У вас и так достаточно ^4Денег!", CHATTAG, rand_money);
}
case 1:
{
give_item(id, "weapon_hegrenade");
give_item(id, "weapon_flashbang");
give_item(id, "weapon_smokegrenade");
cs_set_user_bpammo(id, CSW_FLASHBANG, 2);
ChatColor(id, "%s Вы получили бонус за ^4Steam ^3Дополнительно ^4Набор гранат", CHATTAG);
}
case 2:
{
new iHealth = random_num(MIN_HP, MAX_HP);
set_user_health(id, get_user_health(id) + iHealth);
ChatColor(id, "%s Вы получили бонус за ^4Steam ^3Дополнительно ^4%dHP", CHATTAG, iHealth);
}
}
return PLUGIN_HANDLED;
}
stock ChatColor(const id, const szMessage[], any:...)
{
static szMsg[190], IdMsg;
vformat(szMsg, charsmax(szMsg), szMessage, 3);
if(!IdMsg) IdMsg = get_user_msgid("SayText");
message_begin(MSG_ONE, IdMsg, .player = id);
write_byte(id);
write_string(szMsg);
message_end();
}
stock bool:is_user_steam(id)
{
static dp_pointer;
if(dp_pointer || (dp_pointer = get_cvar_pointer("dp_r_id_provider")))
{
server_cmd("dp_clientinfo %d", id);
server_exec();
return (get_pcvar_num(dp_pointer) == 2) ? true : false;
}
return false;
}