I am making a menu to show other players who do not have a team selected then do an action with them.
The problem I have is that after 10 or more players have been selected it then acts weird and selects a different player and applies the action.
Code:
public menu_pTeam( id )
{
new MSG[ 2 ];
new menu = menu_create( "\rChoose A Player:", "menu_handler" );
for ( new i = 1; i <= g_iMaxPlayers; i++ )
{
// Ignore player ID if not connected
if ( !is_user_connected( i ) || g_pTeam[ i ] > 0 || pid == i )
continue;
formatex( MSG, 1, "%i", i )
menu_additem( menu, P_NAME[ i ], MSG );
}
menu_setprop( menu, MPROP_EXIT, MEXIT_NEVER );
menu_id[ id ] = 2;
menu_display( id, menu, 0 );
}
The action is used on a player using "data" to get the chosen player ID
Code:
new data[ 6 ], pName[ 64 ];
new access, callback;
menu_item_getinfo( menu, item, access, data, 5, pName, 63, callback );
new key = str_to_num( data );
Any suggestions for a different way to make the player menu or an error in code?
P_NAME[ id ] is the players name when they connect to the server.
Thanks