AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   respawn/reset lights on the map (https://forums.alliedmods.net/showthread.php?t=270844)

red_bull2oo6 08-30-2015 15:18

respawn/reset lights on the map
 
Hi, we meet again.

I'm working on a trivia plugin which has a custom map where you can answer the question via buttons.

I made a test map with 2 buttons and 2 lights. Each button turns on a light ( Yes = Blue, Red = No ).
When i choose any of the options ( Yes or No ) , the light comes on and it remains on until round restarts.

There will be no round restarts when the plugin is finished.
All i need is to tell me if there is any way to reset all the lights ( 2 lights for each player ) on the map.
By resetting them i mean turning them of.. just how it happens when round restart is triggered.
I want to know how to set default 'properties' to an entity.

This is my test plugin.
PHP Code:

//* Plugin generated by AMXX-Studio */

    #include < amxmodx >
    //#include < amxmisc >
    //#include < cstrike >
    #include < engine >
    #include < fakemeta >
    #include < hamsandwich >
    
    
    #pragma semicolon 1
    
    
new const
        
PLUGIN_NAME[ ]         = "New Plugin",
        
PLUGIN_VERSION[ ]     = "1.0";
        
    new 
bool:g_bUsed33 ];    

                
public 
plugin_init( )
{
    
register_plugin
    
(
        
PLUGIN_NAME,
        
PLUGIN_VERSION,
        
"Askhanar"
    
);
    
register_clcmd"say /rt""say_RT" );
    
    
RegisterHamHam_Spawn"player""ham_SpawnPlayerPost"true );
    
    if( 
engfunc(EngFunc_FindEntityByString,-,"classname""func_button"))
        
RegisterHamHam_Use"func_button""ham_ButtonUsed" );
    
    
// Add your code here...
}

public 
client_putinserverid )    g_bUsedid ] = false;
public 
client_disconnectid )    g_bUsedid ] = false;

public 
ham_SpawnPlayerPostid )
{
    if( 
is_user_aliveid ) )
    {
        
g_bUsedid ] = false;
    }
    
}

public 
say_RTid )
{
    
client_printidprint_center"RESET!" );
    
g_bUsedid ] = false;
}

public 
ham_ButtonUsedthisidcalleridactivatoruse_typeFloat:value )
{
    if( 
idcaller != idactivator ) return HAM_IGNORED;
    
    
    if( 
g_bUsedidcaller ] )
    {
        
client_printidcallerprint_center"You allready answered!" );
        return 
HAM_SUPERCEDE;
    }
    
    new 
szName32 ];
    
    
entity_get_stringthisEV_SZ_targetszNamesizeofszName ) -);
    if( 
containszName"Yes" ) != -)
        
client_printidcallerprint_center"You answered Yes!" );
    else 
        
client_printidcallerprint_center"You answered NO!" );
        
        
    
g_bUsedidcaller ] = true;
    
    return 
HAM_IGNORED;


This is my test map( how it looks )


LE: Sorry for the thread, just came in my mind to search for spawnflags and found this.
PHP Code:

set_peviEntpev_spawnflags);
        
dllfuncDLLFunc_SpawniEnt ); 


safetymoose 08-30-2015 17:55

Re: respawn/reset lights on the map
 
try using call_think(your_button)


All times are GMT -4. The time now is 22:11.

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