#include <amxmodx>
#include <reapi>
enum _:CVARS
{
CVAR_BONUS_ROUND,
CVAR_BONUS_HE,
CVAR_BONUS_FLASH,
CVAR_BONUS_SMOKE,
CVAR_BONUS_ARMOR_VESTHELM,
CVAR_BONUS_DEFUSE_KIT,
CVAR_BONUS_DEAGLE,
CVAR_NOTIFICATION
};
new g_eCvar[CVARS];
new g_szFlag[32];
#define rg_get_current_round() (get_member_game(m_iTotalRoundsPlayed) + 1)
public plugin_init()
{
register_plugin("Steam Bonus", "1.0", "Will_be");
register_dictionary("steam_bonus.txt");
if (!is_block_map()) RegisterHookChain(RG_CBasePlayer_OnSpawnEquip, "CBasePlayer_OnSpawnEquip_Post", true);
else pause("ad");
RegisterCvars();
AutoExecConfig(true, "plugin-steam_bonus");
}
public CBasePlayer_OnSpawnEquip_Post(id)
{
if(rg_get_current_round() >= g_eCvar[CVAR_BONUS_ROUND])
{
if(is_user_alive(id) && !AccessCheck(id) && is_user_steam(id))
{
if(g_eCvar[CVAR_BONUS_HE])
{
rg_give_item(id, "weapon_hegrenade");
rg_set_user_bpammo(id, WEAPON_HEGRENADE, g_eCvar[CVAR_BONUS_HE]);
}
if(g_eCvar[CVAR_BONUS_FLASH])
{
rg_give_item(id, "weapon_flashbang");
rg_set_user_bpammo(id, WEAPON_FLASHBANG, g_eCvar[CVAR_BONUS_FLASH]);
}
if(g_eCvar[CVAR_BONUS_SMOKE])
{
rg_give_item(id, "weapon_smokegrenade");
rg_set_user_bpammo(id, WEAPON_SMOKEGRENADE, g_eCvar[CVAR_BONUS_SMOKE]);
}
if(g_eCvar[CVAR_BONUS_ARMOR_VESTHELM])
rg_set_user_armor(id, 100, ARMOR_VESTHELM);
if(g_eCvar[CVAR_BONUS_DEFUSE_KIT])
{
new TeamName:team = get_member(id, m_iTeam);
if(team == TEAM_CT)
rg_give_defusekit (id, true);
}
if(g_eCvar[CVAR_BONUS_DEAGLE])
rg_give_items(id, "weapon_deagle", 35);
if(g_eCvar[CVAR_NOTIFICATION])
client_print_color(id, print_team_default, "%L", LANG_PLAYER, "NOTIFICATION_CHAT");
}
}
}
stock bool:AccessCheck(id)
return bool:(get_user_flags(id) & read_flags(g_szFlag));
stock rg_give_items(id, currWeaponName[], ammoAmount)
{
rg_give_item(id, currWeaponName, GT_REPLACE);
rg_set_user_bpammo(id, rg_get_weapon_info(currWeaponName, WI_ID), ammoAmount);
return HC_CONTINUE;
}
is_block_map(){
new map[32], prefix[][]={"awp_","aim_","35hp_","fy_","$","awp4"};
rh_get_mapname(map, 31);
for(new i; i < sizeof prefix; i++) if(containi(map, prefix[i]) != -1) return 1;
return 0;
}
public RegisterCvars() {
bind_pcvar_string(create_cvar(
.name = "steam_bonus_ignore_flag",
.string = "t",
.flags = FCVAR_NONE,
.description = fmt("%L", LANG_SERVER, "DESC_IGNORE_FLAG")),
g_szFlag, charsmax(g_szFlag));
bind_pcvar_num(create_cvar(
.name = "steam_bonus_round",
.string = "1",
.flags = FCVAR_NONE,
.description = fmt("%L", LANG_SERVER, "DESC_BONUS_ROUND"),
.has_min = true,
.min_val = 1.0,
.has_max = false,
.max_val = 0.0),
g_eCvar[CVAR_BONUS_ROUND]);
bind_pcvar_num(create_cvar(
.name = "steam_bonus_he",
.string = "1",
.flags = FCVAR_NONE,
.description = fmt("%L", LANG_SERVER, "DESC_BONUS_HE"),
.has_min = true,
.min_val = 0.0,
.has_max = false,
.max_val = 0.0),
g_eCvar[CVAR_BONUS_HE]);
bind_pcvar_num(create_cvar(
.name = "steam_bonus_flash",
.string = "2",
.flags = FCVAR_NONE,
.description = fmt("%L", LANG_SERVER, "DESC_BONUS_FLASH"),
.has_min = true,
.min_val = 0.0,
.has_max = false,
.max_val = 0.0),
g_eCvar[CVAR_BONUS_FLASH]);
bind_pcvar_num(create_cvar(
.name = "steam_bonus_smoke",
.string = "1",
.flags = FCVAR_NONE,
.description = fmt("%L", LANG_SERVER, "DESC_BONUS_SMOKE"),
.has_min = true,
.min_val = 0.0,
.has_max = false,
.max_val = 0.0),
g_eCvar[CVAR_BONUS_SMOKE]);
bind_pcvar_num(create_cvar(
.name = "steam_bonus_armor_vesthelm",
.string = "1",
.flags = FCVAR_NONE,
.description = fmt("%L", LANG_SERVER, "DESC_BONUS_ARMOR_VESTHELM"),
.has_min = true,
.min_val = 0.0,
.has_max = true,
.max_val = 1.0),
g_eCvar[CVAR_BONUS_ARMOR_VESTHELM]);
bind_pcvar_num(create_cvar(
.name = "steam_bonus_defuse_kit",
.string = "1",
.flags = FCVAR_NONE,
.description = fmt("%L", LANG_SERVER, "DESC_BONUS_DEFUSE_KIT"),
.has_min = true,
.min_val = 0.0,
.has_max = true,
.max_val = 1.0),
g_eCvar[CVAR_BONUS_DEFUSE_KIT]);
bind_pcvar_num(create_cvar(
.name = "steam_bonus_deagle",
.string = "1",
.flags = FCVAR_NONE,
.description = fmt("%L", LANG_SERVER, "DESC_BONUS_DEAGLE"),
.has_min = true,
.min_val = 0.0,
.has_max = true,
.max_val = 1.0),
g_eCvar[CVAR_BONUS_DEAGLE]);
bind_pcvar_num(create_cvar(
.name = "steam_bonus_notification",
.string = "1",
.flags = FCVAR_NONE,
.description = fmt("%L", LANG_SERVER, "DESC_NOTIFICATION"),
.has_min = true,
.min_val = 0.0,
.has_max = false,
.max_val = 0.0),
g_eCvar[CVAR_NOTIFICATION]);
}