Post by newandclueless on Jul 4, 2016 4:07:02 GMT
This tutorial is by zmd94
Original link: zppv.boards.net/thread/1335/idea-give-ammo-packs-damage
Gives an ammopack to you for each person that got affected by your HE or fire bomb.
Original link: zppv.boards.net/thread/1335/idea-give-ammo-packs-damage
Gives an ammopack to you for each person that got affected by your HE or fire bomb.
1) OPEN ZOMBIE_PLAGUE40.SMA AND FIND THIS CODE ->
// Fire Grenade Explosion
fire_explode(ent)
{
// Get origin
static Float:originF[3]
pev(ent, pev_origin, originF)
// Make the explosion
create_blast2(originF)
// Fire nade explode sound
static sound[64]
ArrayGetString(grenade_fire, random_num(0, ArraySize(grenade_fire) - 1), sound, charsmax(sound))
emit_sound(ent, CHAN_WEAPON, sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
// Collisions
static victim
victim = -1
while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, NADE_EXPLOSION_RADIUS)) != 0)
{
// Only effect alive zombies
if (!is_user_valid_alive(victim) || !g_zombie[victim] || g_nodamage[victim])
continue;
// Heat icon?
if (get_pcvar_num(cvar_hudicons))
{
message_begin(MSG_ONE_UNRELIABLE, g_msgDamage, _, victim)
write_byte(0) // damage save
write_byte(0) // damage take
write_long(DMG_BURN) // damage type
write_coord(0) // x
write_coord(0) // y
write_coord(0) // z
message_end()
}
if (g_nemesis[victim] || g_assassin[victim]) // fire duration (nemesis is fire resistant)
g_burning_duration[victim] += get_pcvar_num(cvar_fireduration)
else
g_burning_duration[victim] += get_pcvar_num(cvar_fireduration) * 5
// Set burning task on victim if not present
if (!task_exists(victim+TASK_BURN))
set_task(0.2, "burning_flame", victim+TASK_BURN, _, _, "b")
}
// Get rid of the grenade
engfunc(EngFunc_RemoveEntity, ent)
}
2) CHANGE TO THIS CODE --->
// Fire Grenade Explosion
fire_explode(ent)
{
// Get origin
static Float:originF[3]
pev(ent, pev_origin, originF)
// Make the explosion
create_blast2(originF)
// Fire nade explode sound
static sound[64]
ArrayGetString(grenade_fire, random_num(0, ArraySize(grenade_fire) - 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)
// Collisions
static victim, victimcount
victim = -1
victimcount = 0
while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, NADE_EXPLOSION_RADIUS)) != 0)
{
// Only effect alive zombies
if (!is_user_valid_alive(victim) || !g_zombie[victim] || g_nodamage[victim])
continue;
victimcount++
// Heat icon?
if (get_pcvar_num(cvar_hudicons))
{
message_begin(MSG_ONE_UNRELIABLE, g_msgDamage, _, victim)
write_byte(0) // damage save
write_byte(0) // damage take
write_long(DMG_BURN) // damage type
write_coord(0) // x
write_coord(0) // y
write_coord(0) // z
message_end()
}
if (g_nemesis[victim] || g_assassin[victim]) // fire duration (nemesis is fire resistant)
g_burning_duration[victim] += get_pcvar_num(cvar_fireduration)
else
g_burning_duration[victim] += get_pcvar_num(cvar_fireduration) * 5
// Set burning task on victim if not present
if (!task_exists(victim+TASK_BURN))
set_task(0.2, "burning_flame", victim+TASK_BURN, _, _, "b")
}
g_ammopacks[attacker] += victimcount
// Get rid of the grenade
engfunc(EngFunc_RemoveEntity, ent)
}