#pragma semicolon 0
#include <amxmodx>
#include <reapi>
#if AMXX_VERSION_NUM < 183
#include <colorchat>
#endif
#define CheckBit(%1,%2) (%1 & (1 << (%2 & 31)))
#define SetBit(%1,%2) (%1 |= (1 << (%2 & 31)))
#define ClearBit(%1,%2) (%1 &= ~(1 << (%2 & 31)))
new g_IsSteam;
new g_Round
new pCvarFl, pCvarHe, pCvarSm, pCvarArmor, pCvarDgl, pCvarMsg, pCvarRoundMin
public plugin_init()
{
register_plugin("Steam Bonus", "1.1", "ill+F@nToM")
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
register_event("TextMsg", "event_restart_game", "a", "2=#Game_Commencing", "2=#Game_will_restart_in")
RegisterHookChain(RG_CBasePlayer_Spawn, "CBasePlayer_Spawn", 1)
pCvarFl = register_cvar("st_grenade_fl", "1")
pCvarHe = register_cvar("st_grenade_he", "1")
pCvarSm = register_cvar("st_grenade_sm", "1")
pCvarArmor = register_cvar("st_armor", "100")
pCvarDgl = register_cvar("st_deagle", "1")
pCvarMsg = register_cvar("st_msg", "1")
pCvarRoundMin = register_cvar("st_round_min", "2")
register_cvar("st_exlude_flag", "t")
}
public plugin_cfg()
server_cmd("exec addons/amxmodx/configs/steam_bonus_a2.cfg")
public event_round_start()
{
g_Round++
}
public event_restart_game()
{
g_Round = 0
}
public client_putinserver(id)
{
is_user_steam(id) ? SetBit(g_IsSteam, id) : ClearBit(g_IsSteam, id)
}
public CBasePlayer_Spawn(id)
{
static tmp, ArmorType:armortype;
if (!is_user_alive(id)) {
return HC_CONTINUE;
}
new szFlags[10]
get_cvar_string("st_exlude_flag", szFlags, 9)
if (!CheckBit(g_IsSteam, id) ||(get_user_flags(id) & read_flags(szFlags)) || g_Round < get_pcvar_num(pCvarRoundMin)) {
return HC_CONTINUE;
}
if ((tmp = get_pcvar_num(pCvarFl)) > 0) {
rg_give_item(id, "weapon_flashbang")
rg_set_user_bpammo(id, WEAPON_FLASHBANG, tmp)
}
if (get_pcvar_num(pCvarHe) == 1) {
rg_give_item(id, "weapon_hegrenade")
}
if (get_pcvar_num(pCvarSm) == 1) {
rg_give_item(id, "weapon_smokegrenade")
}
if ((tmp = get_pcvar_num(pCvarArmor)) > 0) {
if(rg_get_user_armor(id, armortype) < tmp) {
rg_set_user_armor(id, tmp, ARMOR_VESTHELM)
}
}
if (get_pcvar_num(pCvarDgl)) {
rg_give_item(id, "weapon_deagle", GT_REPLACE)
rg_set_user_bpammo(id, WEAPON_DEAGLE, 35)
}
if (get_pcvar_num(pCvarMsg)) {
client_print_color(id, print_team_default, "^4[STEAM] ^1Вы получили бонус за лицензионную версию игры!")
}
return HC_CONTINUE;
}
//stock 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) ? 1 : 0
// }
// return 0
//}