I'm working in a plugin with a special day votes, and i have a question about it. Example:
Code:
#include < amxmodx >
#include < amxmisc >
new vote_active, voteday[ 3 ];
// Init
public plugin_init()
{
// Register
register_plugin( "Compare variables", "1.0", "monster321" )
// Clcmd TEST
register_clcmd( "say test", "test_plugin" )
}
// CMD TestPlugin
public test_plugin( id )
{
if( !is_user_admin( id ) || vote_active )
return PLUGIN_HANDLED;
for( new i; i <= 32; i++ )
{
if( !is_user_connected( i ) )
continue;
vote_menu( i )
voteday[ 0 ] = 0;
voteday[ 1 ] = 0;
voteday[ 2 ] = 0;
vote_active = true;
set_task( 15.0, "vote_end", i )
}
}
// Special day vote
public vote_menu( id )
{
new menu = menu_create( "\wWhat you want to play?", "vote_handler" )
menu_additem( menu, "\ySpecial day 1", "1" )
menu_additem( menu, "\ySpecial day 2", "2" )
menu_additem( menu, "\ySpecial day 3", "3" )
menu_setprop( menu, MPROP_EXITNAME, "\wPrefer not vote" )
menu_display( id, menu, 0 )
}
public vote_handler( id, menu, item )
{
if( item == MENU_EXIT )
{
menu_destroy( menu )
return PLUGIN_HANDLED;
}
if( !vote_active )
return PLUGIN_HANDLED;
new data[ 6 ], name[ 64 ], access, callback;
menu_item_getinfo( menu, item, access, data, 5, name, 63, callback )
switch( str_to_num( data ) )
{
case 1: voteday[ 0 ] ++;
case 2: voteday[ 1 ] ++;
case 3: voteday[ 2 ] ++;
}
menu_destroy( menu )
return PLUGIN_HANDLED;
}
public vote_end( id )
{
vote_active = false;
// I want get here the variable "voteday" with more votes to start the day.
// But I want this so optimized.
}
Someone can help me? Thanks for your time.