Okay
I did what you said and got this now
PHP Code:
public lightning_effects(iEnt)
{
if(!get_pcvar_num(zomb_switch))
return set_pev(iEnt, pev_nextthink, 10.0)
if (get_pcvar_num(zomb_lightning) == 0)
{
engfunc(EngFunc_LightStyle, 0, "m")
remove_task(12175)
//set_pev(iEnt, pev_nextthink, 10.0)
}
else if (get_pcvar_num(zomb_lightning) == 1)
{
static classname[33]
pev(iEnt, pev_classname, classname,32)
if (equal ( classname, g_entlight ) )
{
engfunc(EngFunc_LightStyle, 0, "a")
set_task(random_float(10.0,17.0),"thunder_clap",12175)
}
}
else if (get_pcvar_num(zomb_lightning) == 2)
{
engfunc(EngFunc_LightStyle, 0, "b")
remove_task(12175)
//set_pev(iEnt, pev_nextthink, 10.0)
}
return FMRES_IGNORED
}
public thunder_clap()
{
if(!get_pcvar_num(zomb_switch))
return
engfunc(EngFunc_LightStyle, 0, "p")
client_cmd(0,"speak %s", ZOMBIE_THUNDER)
//set_task(1.25, "lightning_effects", 12175)
}
I also made the classname a global just in case if I ever to typos.
This time it doesn't do anything if I set the cvar to 1.
The lighting stays the same as the cvar before it.
But one thing I accomplished with this is that it changes the lighting instantly which was one of my goals...
I change the cvar to 0 and it goes to normal lightning.
Then I try to change it to 1 but it stays the same as normal lighting and I wait for 20 seconds but nothing changed.
Then I changed to cvar 2 and it went to lighting b.
Tried to change it to cvar 1 again but stayed on lighting b.
__________________