it seems that i need your help again.
i have recently found a stock that allows me to show a hud message via menu.
but there is a problem:
if the user already has opened another menu( like radio for example ) when my 'hud menu' is displayed,
it will dissapear.
how can i check if a user has any other menu opened so i can skip that player ?
here is the code:
PHP Code:
/* Plugin generated by AMXX-Studio */
#include < amxmodx >
#pragma semicolon 1
new const
PLUGIN_NAME[ ] = "New Plugin",
PLUGIN_VERSION[ ] = "1.0";
new const MESSAGES[ 11 ][ ] =
{
"\rFun Jump-ul\d este interzis! ( \y CT\d )",
"\rWait-ul\d,\r Camp-ul\d sunt intezise! ( \y CT\d )",
"\rRun-ul\d,\r Hide-ul\d,\r Airflash-ul\d sunt interzise! ( \y T\d )",
"\rBlock-ul\d,\r Team Block-ul\d sunt interzise!",
"\rUnderstab-ul\d, \rUnder Block-ul\d este interzis!",
"\rBoost-ul \deste interzis!",
"\rRetry-ul \deste interzis!",
"\dFara scripturi sau cvar-uri\r ilegale\d!",
"\dFara wait-uri sau hack-uri de orice forma!",
"\rFara injuraturi si limbaj vulgar!",
"\rRespectati\d adminii si jucatorii serverului!"
};
public plugin_init( )
{
register_plugin( PLUGIN_NAME, PLUGIN_VERSION, "" );
set_task( 10.0, "task_DisplayMessage", 1337, _, _, "b", 0 );
// Add your code here...
}
public task_DisplayMessage( )
{
static iPlayers[ 32 ];
static iPlayersNum;
get_players( iPlayers, iPlayersNum, "ch" );
if( !iPlayersNum )
return;
static id, i;
for( i = 0; i < iPlayersNum; i++ )
{
id = iPlayers[ i ];
CreateMenuHud( id, MESSAGES[ random( 11 ) ], 5 );
}
}
CreateMenuHud( id, szMsg[ ], iTime = 5)
{
static bool:bRegistered;
if( !bRegistered )
{
register_menucmd( register_menuid( "MenuHud" ), (1<<9), "MenuHud" );
bRegistered = true;
}
new szMessage[ 512 ], iLen;
static const NEWLINE[ ] = "^n ";
static const NEWLINES[ ] = "^n^n^n^n^n^n^n^n^n";
iLen += formatex( szMessage[ iLen ], sizeof( szMessage ) - iLen -1, "%s%s",NEWLINES, NEWLINE );
iLen += formatex( szMessage[ iLen ], sizeof( szMessage ) - iLen -1, "%s", szMsg );
replace_all( szMessage, sizeof( szMessage ) -1, "\n", NEWLINE );
show_menu( id, (1<<9), szMessage, iTime, "MenuHud" );
}
// Just to let menu show
public MenuHud( id, key )
{
return PLUGIN_CONTINUE;
}
edit:
ok so it happened that i found out about
:
PHP Code:
/**
* Returns information about a menu (if any) the client is currently viewing.
*
* If newmenu is valid, then the menu will refer to the menuid associated with
* the title. If newmenu is not valid, and the menu is valid, then the player
* is viewing a menu displayed with show_menu().
*
* Both may be invalid if the player is not viewing a menu.
*
* @param id Client index.
* @param menu Variable to store old menu id. If none, then <1 will be
* stored.
* @param newmenu Variable to store new menu id. If none, then -1 will be
* stored.
* @param menupage Variable to store current page of the new menu, if any.
* @return 1 if the player is viewing a menu, 0 otherwise.
* @error Invalid client.
*/
native player_menu_info(id, &menu, &newmenu, &menupage=0);
but i don't understand how to use it.
can you help me ?
thanks in advance!
__________________