| 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_bUsed[ 33 ];
public plugin_init( ) { register_plugin ( PLUGIN_NAME, PLUGIN_VERSION, "Askhanar" ); register_clcmd( "say /rt", "say_RT" ); RegisterHam( Ham_Spawn, "player", "ham_SpawnPlayerPost", true ); if( engfunc(EngFunc_FindEntityByString,-1 ,"classname", "func_button")) RegisterHam( Ham_Use, "func_button", "ham_ButtonUsed" ); // Add your code here... }
public client_putinserver( id ) g_bUsed[ id ] = false; public client_disconnect( id ) g_bUsed[ id ] = false;
public ham_SpawnPlayerPost( id ) { if( is_user_alive( id ) ) { g_bUsed[ id ] = false; } }
public say_RT( id ) { client_print( id, print_center, "RESET!" ); g_bUsed[ id ] = false; }
public ham_ButtonUsed( this, idcaller, idactivator, use_type, Float:value ) { if( idcaller != idactivator ) return HAM_IGNORED; if( g_bUsed[ idcaller ] ) { client_print( idcaller, print_center, "You allready answered!" ); return HAM_SUPERCEDE; } new szName[ 32 ]; entity_get_string( this, EV_SZ_target, szName, sizeof( szName ) -1 ); if( contain( szName, "Yes" ) != -1 ) client_print( idcaller, print_center, "You answered Yes!" ); else client_print( idcaller, print_center, "You answered NO!" ); g_bUsed[ idcaller ] = 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_pev( iEnt, pev_spawnflags, 1 ); dllfunc( DLLFunc_Spawn, iEnt );
|