I wanted to trigger all the lights in cs_mansion to be off. However, It didn't work.
PHP Code:
#include < amxmodx >
#include < fakemeta >
new cvar_triggered
public plugin_init ( )
{
register_plugin( "Trigger Light", "0.1", "ToeMayToe" )
register_event( "HLTV", "event_round_start", "a", "1=0", "2=0" )
cvar_triggered = register_cvar( "zp_trigger_light", "1" )
}
public event_round_start( )
{
set_task( 0.1, "remove_stuff" )
set_task( 0.1, "remove_lights" )
}
public remove_stuff( )
{
static ent
if ( !get_pcvar_num( cvar_triggered ) )
{
ent = -1
while ( ( ent = engfunc( EngFunc_FindEntityByString, ent, "classname", "light" ) ) != 0 )
{
dllfunc( DLLFunc_Use, ent, 0 );
set_pev( ent, pev_targetname, 0 )
}
}
}
public remove_lights( )
{
static ent
ent = -1
while ( ( ent = engfunc( EngFunc_FindEntityByString, ent, "classname", "light" ) ) != 0 )
{
dllfunc( DLLFunc_Use, ent, 0 );
set_pev( ent, pev_targetname, 0 )
}
}