Test:
Code:
// Infection Bomb Explosion
infection_explode(ent)
{
// Round ended (bugfix)
if (g_endround) return;
// Get origin
static FloatriginF[3]
pev(ent, pev_origin, originF)
// Make the explosion
create_blast(originF)
// Infection nade explode sound
static sound[64]
ArrayGetString(grenade_infect, random_num(0, ArraySize(grenade_infect) - 1), sound, charsmax(sound))
emit_sound(ent, CHAN_WEAPON, sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
// Get attacker
static attacker
attacker = pev(ent, pev_owner)
// Infection bomb owner disconnected? (bugfix)
if (!is_user_valid_connected(attacker))
{
// Get rid of the grenade
engfunc(EngFunc_RemoveEntity, ent)
return;
}
// Collisions
static victim
victim = -1
while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, NADE_EXPLOSION_RADIUS)) != 0)
{
// Only effect alive non-spawnprotected humans
if (!is_user_valid_alive(victim) || g_zombie[victim] || g_nodamage[victim])
continue;
if(!pev(victim, pev_takedamage))
continue
// Last human is killed
if (fnGetHumans() == 1)
{
ExecuteHamB(Ham_Killed, victim, attacker, 0)
continue;
}
// Infected victim's sound
ArrayGetString(grenade_infect_player, random_num(0, ArraySize(grenade_infect_player) - 1), sound, charsmax(sound))
emit_sound(victim, CHAN_VOICE, sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
// Turn into zombie
zombieme(victim, attacker, 0, 0, 1, 1)
}
// Get rid of the grenade
engfunc(EngFunc_RemoveEntity, ent)
}
__________________