// Copyright © 2016 Vaqtincha
//============================ CONFIG START ===========================//
//============================= CONFIG END ============================//
const m_bHasShield = 1<<24
const m_bHasShield = 2043
const m_flNextAttack = 83
const m_flNextSecondaryAttack = 47
new g_iMode[MAX_PLAYERS + 1] = {GrenadeType}
new const g_szGrenadeName[][] = {
register_plugin("Grenade Explode Modes", VERSION, "Vaqtincha")
RegisterHam(Ham_Weapon_SecondaryAttack, ONLY_ONE_GRENADE, "Ham_SecAttack_Post", true)
RegisterHam(Ham_Item_Deploy, ONLY_ONE_GRENADE, "Ham_ItemDeploy_Post", true)
for(new i = 0; i < sizeof(g_szGrenadeName); ++i)
RegisterHam(Ham_Weapon_SecondaryAttack, g_szGrenadeName[i], "Ham_SecAttack_Post", true)
RegisterHam(Ham_Item_Deploy, g_szGrenadeName[i], "Ham_ItemDeploy_Post", true)
public Ham_ItemDeploy_Post(wEnt)
new id = get_weapon_owner(wEnt)
case NORMAL: return HAM_IGNORED
case MODE_1: client_print(id, print_center, "Explode after %0.f seconds", EXPLODE_TIME_1)
case MODE_2: client_print(id, print_center, "Explode after %0.f seconds", EXPLODE_TIME_2)
case MODE_3: client_print(id, print_center, "Explode after %0.f seconds", EXPLODE_TIME_3)
default: return HAM_IGNORED
public Ham_SecAttack_Post(wEnt)
new id = get_weapon_owner(wEnt)
if(id > 0 && wEnt > 0 && !HasShield(id))
case NORMAL: client_print(id, print_center, "Explode Normal")
case MODE_1: client_print(id, print_center, "Explode after %0.f seconds", EXPLODE_TIME_1)
case MODE_2: client_print(id, print_center, "Explode after %0.f seconds", EXPLODE_TIME_2)
case MODE_3: client_print(id, print_center, "Explode after %0.f seconds", EXPLODE_TIME_3)
client_print(id, print_center, "Explode Normal")
set_pdata_float(id, m_flNextAttack, 0.5)
set_pdata_float(wEnt, m_flNextSecondaryAttack, 0.5, XO_WEAPON)
public grenade_throw(id, wEnt, iId)
if(iId != get_weaponid(ONLY_ONE_GRENADE))
case MODE_1: set_pev(wEnt, pev_dmgtime, get_gametime() + EXPLODE_TIME_1)
case MODE_2: set_pev(wEnt, pev_dmgtime, get_gametime() + EXPLODE_TIME_2)
case MODE_3: set_pev(wEnt, pev_dmgtime, get_gametime() + EXPLODE_TIME_3)