Raised This Month: $ Target: $400
 0% 

Trigger Light


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mr.ToeMayToe
Junior Member
Join Date: Feb 2010
Old 05-29-2010 , 08:38   Trigger Light
Reply With Quote #1

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_task0.1"remove_stuff" )
    
set_task0.1"remove_lights" )
}
 
public 
remove_stuff( )
{
    static 
ent
    
if ( !get_pcvar_numcvar_triggered ) )
    {
        
ent = -1
        
while ( ( ent engfuncEngFunc_FindEntityByStringent"classname""light" ) ) != )
        {
            
dllfuncDLLFunc_Useent); 
            
set_peventpev_targetname
        }
    }
}

public 
remove_lights( )
{
    static 
ent
    ent 
= -1
    
while ( ( ent engfuncEngFunc_FindEntityByStringent"classname""light" ) ) != )
    {
        
dllfuncDLLFunc_Useent);
        
set_peventpev_targetname
    }


Last edited by Mr.ToeMayToe; 05-29-2010 at 08:46.
Mr.ToeMayToe is offline
Mr.ToeMayToe
Junior Member
Join Date: Feb 2010
Old 05-30-2010 , 19:21   Re: Trigger Light
Reply With Quote #2

Please help !
Mr.ToeMayToe is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-31-2010 , 01:58   Re: Trigger Light
Reply With Quote #3

Quote:
Originally Posted by Mr.ToeMayToe View Post
Please help !
Don't bump until 2 weeks have passed since the last post.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 05-30-2010 , 21:41   Re: Trigger Light
Reply With Quote #4

Are you looking to just disable the lights? Or do you want them to just be turned off by default at round start?

This plugin removes all lights (make sure the classname is right, wasn't too sure):
Code:
#include <amxmodx> #include <fakemeta> // not sure, correct me if i'm wrong new const LightClassname[] = "func_light" public plugin_precache() {     register_forward( FM_Spawn, "SpawnForward" ) } public SpawnForward( Ent ) {     if( pev_valid( Ent ) )     {         new cname[32]         pev( Ent, pev_classname, cname, 31 )             if( equal( cname, LightClassname ) )         {             engfunc( EngFunc_RemoveEntity, Ent )         }     } } public plugin_init() {     register_plugin( "Light Remover", "1.0", "Wrecked" ) }

BTW, HLTV isn't called on the map start, so you'll have to wait until a new round restart for that to be called. This might be your issue, and you just weren't waiting for another round and assumed it wasn't working right away.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Mr.ToeMayToe
Junior Member
Join Date: Feb 2010
Old 05-31-2010 , 00:25   Re: Trigger Light
Reply With Quote #5

Quote:
Originally Posted by wrecked_ View Post
Are you looking to just disable the lights? Or do you want them to just be turned off by default at round start?


This plugin removes all lights (make sure the classname is right, wasn't too sure): Code:
#include <amxmodx></p><p>#include <fakemeta></p><p>&nbsp;</p><p>// not sure, correct me if i'm wrong</p><p>new const LightClassname[] = "func_light"</p><p>&nbsp;</p><p>public plugin_precache()</p><p>{</p><p>&nbsp;&nbsp;&nbsp;&nbsp;register_forwar d( FM_Spawn, "SpawnForward" )</p><p>}</p><p>&nbsp;</p><p>public SpawnForward( Ent )</p><p>{</p><p>&nbsp;&nbsp;&nbsp;&nbsp;if( pev_valid( Ent ) )</p><p>&nbsp;&nbsp;&nbsp;&nbsp;{</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;new cname[32]</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;pev( Ent, pev_classname, cname, 31 )</p><p>&nbsp;</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;if( equal( cname, LightClassname ) )</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;{</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;engfunc( EngFunc_RemoveEntity, Ent )</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;}</p><p>&nbsp;&nbsp;&nbsp;&nbsp;}</p><p>}</p><p>&nbsp;</p><p>public plugin_init()</p><p>{</p><p>&nbsp;&nbsp;&nbsp;&nbsp;register_plugin( "Light Remover", "1.0", "Wrecked" )</p><p>}



BTW, HLTV isn't called on the map start, so you'll have to wait until a new round restart for that to be called. This might be your issue, and you just weren't waiting for another round and assumed it wasn't working right away.
Sorry, it did not work. I try to restart round still it is not working.
Mr.ToeMayToe is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 05-31-2010 , 00:43   Re: Trigger Light
Reply With Quote #6

Quote:
Originally Posted by Mr.ToeMayToe View Post
Sorry, it did not work. I try to restart round still it is not working.
It'll work with any other entity classname. Check it with other classnames. Change the LightClassname[] to light and re-test it. If anyone else knows the classname for a light, feel free to correct me.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Mr.ToeMayToe
Junior Member
Join Date: Feb 2010
Old 05-31-2010 , 01:30   Re: Trigger Light
Reply With Quote #7

Quote:
Originally Posted by wrecked_ View Post
It'll work with any other entity classname. Check it with other classnames. Change the LightClassname[] to light and re-test it. If anyone else knows the classname for a light, feel free to correct me.
What you mean ?

PHP Code:
#include <amxmodx>
#include <fakemeta>
 
// not sure, correct me if i'm wrong
new const light[] = "func_light" or new const LightClassname[][] = "light" Both doesn't work
 
public plugin_precache()
{
    register_forward( FM_Spawn, "SpawnForward" )
}
 
public SpawnForward( Ent )
{
    if( pev_valid( Ent ) )
    {
        new cname[32]
        pev( Ent, pev_classname, cname, 31 )
 
        if( equal( cname, light ) )
        {
            engfunc( EngFunc_RemoveEntity, Ent )
        }
    }
}
 
public plugin_init()
{
    register_plugin( "Light Remover", "1.0", "Wrecked" )

Mr.ToeMayToe is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:25.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode