PHP Code:
public fw_ThinkGrenade(entity)
{
// Invalid entity
if (!pev_valid(entity)) return HAM_IGNORED;
// Get damage time of grenade
static Float:dmgtime, Float:current_time
pev(entity, pev_dmgtime, dmgtime)
current_time = get_gametime()
// Check if it's time to go off
if (dmgtime > current_time)
return HAM_IGNORED;
// Check if it's one of our custom nades
switch (pev(entity, PEV_NADE_TYPE))
{
case NADE_TYPE_INFECTION: // Infection Bomb
{
infection_explode(entity)
return HAM_SUPERCEDE;
}
case NADE_TYPE_NAPALM: // Napalm Grenade
{
fire_explode(entity)
return HAM_SUPERCEDE;
}
case NADE_TYPE_FROST: // Frost Grenade
{
frost_explode(entity)
return HAM_SUPERCEDE;
}
case NADE_TYPE_CAMPO:
{
static duration
duration = pev(entity, PEV_FLARE_DURATION)
// Already went off, do lighting loop for the duration of PEV_FLARE_DURATION
if (duration > 0)
{
// Check whether this is the last loop
if (duration == 1)
{
// Get rid of the flare entity
engfunc(EngFunc_RemoveEntity, entity)
return HAM_SUPERCEDE;
}
bubble_explode(entity)
// Set time for next loop
set_pev(entity, PEV_FLARE_DURATION, --duration)
set_pev(entity, pev_dmgtime, current_time + 5.0)
}
// Light up when it's stopped on ground
else if ((pev(entity, pev_flags) & FL_ONGROUND) && fm_get_speed(entity) < 10)
{
// Flare sound
static sound[64]
ArrayGetString(grenade_flare, random_num(0, ArraySize(grenade_flare) - 1), sound, charsmax(sound))
emit_sound(entity, CHAN_WEAPON, sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
// Set duration and start lightning loop on next think
set_pev(entity, PEV_FLARE_DURATION, 1 + get_pcvar_num(cvar_flareduration)/5)
set_pev(entity, pev_dmgtime, current_time + 0.1)
}
else
{
// Delay explosion until we hit ground
set_pev(entity, pev_dmgtime, current_time + 0.5)
}
}
case NADE_TYPE_FLARE: // Flare
{
// Get its duration
static duration
duration = pev(entity, PEV_FLARE_DURATION)
// Already went off, do lighting loop for the duration of PEV_FLARE_DURATION
if (duration > 0)
{
// Check whether this is the last loop
if (duration == 1)
{
// Get rid of the flare entity
engfunc(EngFunc_RemoveEntity, entity)
return HAM_SUPERCEDE;
}
// Light it up!
flare_lighting(entity, duration)
// Set time for next loop
set_pev(entity, PEV_FLARE_DURATION, --duration)
set_pev(entity, pev_dmgtime, current_time + 5.0)
}
// Light up when it's stopped on ground
else if ((pev(entity, pev_flags) & FL_ONGROUND) && fm_get_speed(entity) < 10)
{
// Flare sound
static sound[64]
ArrayGetString(grenade_flare, random_num(0, ArraySize(grenade_flare) - 1), sound, charsmax(sound))
emit_sound(entity, CHAN_WEAPON, sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
// Set duration and start lightning loop on next think
set_pev(entity, PEV_FLARE_DURATION, 1 + get_pcvar_num(cvar_flareduration)/5)
set_pev(entity, pev_dmgtime, current_time + 0.1)
}
else
{
// Delay explosion until we hit ground
set_pev(entity, pev_dmgtime, current_time + 0.5)
}
}
}
return HAM_IGNORED;
}
OMG! Funcionar funciona pero a saber la de warnings que te manda. Se te debe llenar el compiler de