Raised This Month: $ Target: $400
 0% 

Menu Got so much spacing! [ML SYSTEM-SWITCHMENU]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Baws
Veteran Member
Join Date: Oct 2012
Old 03-28-2014 , 13:08   Menu Got so much spacing! [ML SYSTEM-SWITCHMENU]
Reply With Quote #1

So basically in the menu it's too much spaced under it and i got some difficulties with it as i'm using the new menu system. And i'm trying to put the switches too in the ML system, sadly i don't really know how it will work with the new menu system. I searched so much but got basically nothing. I know that for the switches the ML won't work as i tested it, but can you show me how to do it for the switches and tell me why the menu is so spaced under? Thanks!

PHP Code:
#include < amxmodx >
#include < amxmisc >

new const g_szPlugin[ ]   = "AdvancedMusicPlayer";
new const 
g_szVersion[ ]  = "2.4";
new const 
g_szAuthor[ ]   = "Baws";

enum Color 
{
        
NORMAL 1,
        
GREEN,
        
TEAM_COLOR,
        
GREY,
        
RED,
        
BLUE
};

enum _SongEnum 
{
        
Name128 ],
        
Url512 ]
}

new 
g_SongInformation_SongEnum ];

new Array:
g_hArray;

new 
g_Song33 ];
new 
g_SongCount;

new 
g_FileName256 ];
new 
g_MusicPlayer256 ];

new 
g_Volume33 ];
new 
bool:g_Repeat33 ];
new 
bool:g_SettingsSave33 ];

new 
g_pcvarConnectMsg;
new 
g_pcvarShowCommands;

public 
plugin_init( ) 
{
        
register_pluging_szPluging_szVersiong_szAuthor );
        
register_cvarg_szPluging_szVersionFCVAR_SERVER FCVAR_EXTDLL FCVAR_UNLOGGED FCVAR_SPONLY );
    
        
register_clcmd"say""Cmd_Say" );
        
register_clcmd"say_team""Cmd_Say" );

        
register_clcmd"search""Cmd_Search1" );

        
register_concmd"amx_addsong""AddSong"ADMIN_CFG"- Usage: amx_addsong ^"Song name^" ^"Url/Link^" | Attention: Put them with quotes." );
    
        
g_pcvarConnectMsg register_cvar"sv_connectmessage""1" );
        
g_pcvarShowCommands register_cvar"sv_showcommands""0" );
    
        
register_dictionary_colored"AdvMusicPlayer.txt" );
    
        
Initialize( );
}

public 
client_putinserverid 
{
        
g_Songid ] = 0;
    
        new 
iRep], iVol];
        
get_user_infoid"hlmp_rep"iRep)
        
get_user_infoid"hlmp_vol"iVol)

        
g_Volumeid ] = 50;
        
g_Repeatid ] = false;
                                                                                                                                                                     
        if( 
get_pcvar_numg_pcvarConnectMsg ) == )
                
set_task15.0"ConnectMsg"id );
}

public 
ConnectMsgid 
{
        if( !
get_pcvar_numg_pcvarConnectMsg ) )
                return;
    
        new 
szName32 ];
        
get_user_nameidszNamecharsmaxszName ) );
        
client_print_coloridNORMAL"%L"id"ADV_CONNECT_MSG"szName );
}

public 
AddSongidlevelcid 
{
        if( !
cmd_accessidlevelcid) )
                return 
PLUGIN_HANDLED;
    
        
read_argv1g_SongInformationName ], charsmaxg_SongInformationName ] ) );
        
read_argv2g_SongInformationUrl ], charsmaxg_SongInformationUrl ] ) );
    
        
trimg_SongInformationName ] );
        
trimg_SongInformationUrl ] );
    
        if( !
g_SongInformationName ][ ] || !g_SongInformationUrl ][ ] ) 
        {
                
cmd_accessidlevelcid999 );
                return 
PLUGIN_HANDLED;
        }
    
        
ArrayPushArrayg_hArrayg_SongInformation );
        
g_SongCount++;
    
        new 
iFile fopeng_FileName"a+" );
    
        if( !
iFile 
        {
                
log_amx"[%s] Could not open file ^"%s^"."g_szPluging_FileName );
                return 
PLUGIN_HANDLED;
        }
    
        
fprintfiFile"^n^"%s^" ^"%s^""g_SongInformationName ], g_SongInformationUrl ] );
        
fcloseiFile );
    
        
console_printid"%L"id"ADV_SONG_ADDED",  g_SongInformationName ] );
    
        return 
PLUGIN_HANDLED;
}

public 
Cmd_Sayid 
{
        new 
szText194 ];
        
read_argsszTextcharsmaxszText ) );
        
remove_quotesszText );
    
        if( 
szText] != '/' )
                return 
PLUGIN_CONTINUE;
        
        if( 
get_pcvar_numg_pcvarShowCommands ) == )
        {
                if( 
equaliszText], "musichelp") ) 
                {
                        new 
Motd1056 ], Len;

                        
Len formatexMotdcharsmaxMotd ), "<html><head><style type=^"text/css^">pre{color:#CDCCCB;}body{background:#000000;margin-left:8px;margin-top:0px;}</style></head><pre><body>" );
                        
Len += formatexMotdLen ], charsmaxMotd ) - Len"<center><b><i>%L</i></b></center>^n"id"ADV_MOTD1_MUSIC_HELP" );
                        
Len += formatexMotdLen ], charsmaxMotd ) - Len"<b>%L</b>^n"id"ADV_MOTD1_PLAYER_COMMANDS" );
                        
Len += formatexMotdLen ], charsmaxMotd ) - Len"/music - <i>%L</i>^n"id"ADV_MOTD1_MUSIC_COMMAND" );
                        
Len += formatexMotdLen ], charsmaxMotd ) - Len"/search ^"song/name^" - <i>%L</i>^n"id"ADV_MOTD1_SEARCH_COMMAND" );
                        
Len += formatexMotdLen ], charsmaxMotd ) - Len"/replay - <i>%L</i>^n"id"ADV_MOTD1_REPLAY_COMMAND" );
                        
Len += formatexMotdLen ], charsmaxMotd ) - Len"/copy - <i>%L</i>^n"id"ADV_MOTD1_COPY_COMMAND" );
                        
Len += formatexMotdLen ], charsmaxMotd ) - Len"/stop - <i>%L</i>^n"id"ADV_MOTD1_STOP_COMMAND" );
                        
formatexMotdLen ], charsmaxMotd ) - Len"</center></body></pre></html>" );
            
                        if( 
get_user_flagsid ) & ADMIN_CFG )
                        {
                                
Len += formatexMotdLen ], charsmaxMotd ) - Len"<b>%L</b>^n"id"ADV_MOTD1_ADMIN_COMMAND"g_szPlugin );
                                
Len += formatexMotdLen ], charsmaxMotd ) - Len"amx_addsong - <i>%L</i>^n"id"ADV_MOTD1_ADDSONG_COMMAND" );
                                
formatexMotdLen ], charsmaxMotd ) - Len"</center></body></pre></html>" );
                        }
        
                        
show_motdidMotdg_szPlugin );
                        return 
PLUGIN_CONTINUE;
                }
        
                else if( 
equaliszText], "music") ) 
                {
                        if( 
g_SettingsSaveid ] == false )
                        {
                                
g_Volumeid ] = 50;
                                
g_Repeatid ] = false;
                        }

                        
SettingsMenuid );
                        return 
PLUGIN_CONTINUE;
                }
    
                else if( 
equaliszText], "stop") ) 
                {
                        new 
Motd386 ], Len;
        
                        
Len formatexMotdcharsmaxMotd ), "<html><head><style type=^"text/css^">pre{color:#CDCCCB;}body{background:#000000;margin-left:8px;margin-top:0px;}</style></head><pre><body><center>" );
                        
Len += formatexMotdLen ], charsmaxMotd ) - Len"<b>%L</b>"id"ADV_MOTD2_MUSIC_STOPPED" );
                        
Len += formatexMotdLen ], charsmaxMotd ) - Len"%L^n"id"ADV_MOTD2_BROUGHT_TO_YOU"g_szAuthor );
                        
Len += formatexMotdLen ], charsmaxMotd ) - Len"%L^n"id"ADV_MOTD2_POWERFUL_PLAYER"g_szPlugin );
                        
Len += formatexMotdLen ], charsmaxMotd ) - Len"%L^n"id"ADV_MOTD2_HOPE_FUN_LISTENING" );
                        
formatexMotdLen ], charsmaxMotd ) - Len"</center></body></pre></html>" );
        
                        
show_motdidMotdg_szPlugin );
                        return 
PLUGIN_CONTINUE;
                }
    
                else if( 
equaliszText], "replay") ) 
                {
        
                        if( 
g_Songid ] != )
                                
Play_Songidg_Songid ] );
                        else
                                
client_print_coloridNORMAL"%L"id"ADV_NO_SONG_PLAYED" );
            
                        return 
PLUGIN_CONTINUE;
                }
    
                else if( 
equaliszText], "copy") ) 
                {
                        
Cmd_CopySongid );
        
                        return 
PLUGIN_CONTINUE;
                }
    
                else if( 
equaliszText], "search") ) 
                {
                        new 
szName64 ];
                        
strbreakszText""0szNamecharsmaxszName ) );
        
                        
Cmd_SearchidszName );
        
                        return 
PLUGIN_CONTINUE;
                }
        }
        else
        {    
                if( 
equaliszText], "musichelp") ) 
                {
                        new 
Motd1056 ], Len;

                        
Len formatexMotdcharsmaxMotd ), "<html><head><style type=^"text/css^">pre{color:#CDCCCB;}body{background:#000000;margin-left:8px;margin-top:0px;}</style></head><pre><body>" );
                        
Len += formatexMotdLen ], charsmaxMotd ) - Len"<center><b><i>%L</i></b></center>^n"id"ADV_MOTD1_MUSIC_HELP" );
                        
Len += formatexMotdLen ], charsmaxMotd ) - Len"<b>%L</b>^n"id"ADV_MOTD1_PLAYER_COMMANDS" );
                        
Len += formatexMotdLen ], charsmaxMotd ) - Len"/music - <i>%L</i>^n"id"ADV_MOTD1_MUSIC_COMMAND" );
                        
Len += formatexMotdLen ], charsmaxMotd ) - Len"/search ^"song/name^" - <i>%L</i>^n"id"ADV_MOTD1_SEARCH_COMMAND" );
                        
Len += formatexMotdLen ], charsmaxMotd ) - Len"/replay - <i>%L</i>^n"id"ADV_MOTD1_REPLAY_COMMAND" );
                        
Len += formatexMotdLen ], charsmaxMotd ) - Len"/copy - <i>%L</i>^n"id"ADV_MOTD1_COPY_COMMAND" );
                        
Len += formatexMotdLen ], charsmaxMotd ) - Len"/stop - <i>%L</i>^n"id"ADV_MOTD1_STOP_COMMAND" );
                        
formatexMotdLen ], charsmaxMotd ) - Len"</center></body></pre></html>" );
            
                        if( 
get_user_flagsid ) & ADMIN_CFG )
                        {
                                
Len += formatexMotdLen ], charsmaxMotd ) - Len"<b>%L</b>^n"id"ADV_MOTD1_ADMIN_COMMAND"g_szPlugin );
                                
Len += formatexMotdLen ], charsmaxMotd ) - Len"amx_addsong - <i>%L</i>^n"id"ADV_MOTD1_ADDSONG_COMMAND" );
                                
formatexMotdLen ], charsmaxMotd ) - Len"</center></body></pre></html>" );
                        }
        
                        
show_motdidMotdg_szPlugin );
                        return 
PLUGIN_HANDLED;
                }
        
                else if( 
equaliszText], "music") ) 
                {
                        if( 
g_SettingsSaveid ] == false )
                        {
                                
g_Volumeid ] = 50;
                                
g_Repeatid ] = false;
                        }
            
                        
SettingsMenuid );
                        return 
PLUGIN_HANDLED;
                }
    
                else if( 
equaliszText], "stop") ) 
                {
                        new 
Motd386 ], Len;
        
                        
Len formatexMotdcharsmaxMotd ), "<html><head><style type=^"text/css^">pre{color:#CDCCCB;}body{background:#000000;margin-left:8px;margin-top:0px;}</style></head><pre><body><center>" );
                        
Len += formatexMotdLen ], charsmaxMotd ) - Len"<b>%L</b>"id"ADV_MOTD2_MUSIC_STOPPED" );
                        
Len += formatexMotdLen ], charsmaxMotd ) - Len"%L^n"id"ADV_MOTD2_BROUGHT_TO_YOU"g_szAuthor );
                        
Len += formatexMotdLen ], charsmaxMotd ) - Len"%L^n"id"ADV_MOTD2_POWERFUL_PLAYER"g_szPlugin );
                        
Len += formatexMotdLen ], charsmaxMotd ) - Len"%L^n"id"ADV_MOTD2_HOPE_FUN_LISTENING" );
                        
formatexMotdLen ], charsmaxMotd ) - Len"</center></body></pre></html>" );
        
                        
show_motdidMotdg_szPlugin );
                        return 
PLUGIN_HANDLED;
                }
    
                else if( 
equaliszText], "replay") ) 
                {
        
                        if( 
g_Songid ] != )
                                
Play_Songidg_Songid ] );
                        else
                                
client_print_coloridNORMAL"%L"id"ADV_NO_SONG_PLAYED" );
            
                        return 
PLUGIN_HANDLED;
                }
    
                else if( 
equaliszText], "copy") ) 
                {
                        
Cmd_CopySongid );
        
                        return 
PLUGIN_HANDLED;
                }
    
                else if( 
equaliszText], "search") ) 
                {
                        new 
szName64 ];
                        
strbreakszText""0szNamecharsmaxszName ) );
        
                        
Cmd_SearchidszName );
        
                        return 
PLUGIN_HANDLED;
                }
        }
    
        return 
PLUGIN_CONTINUE;
}

public 
Cmd_Search1id )
{
        new 
iArg33 ];
        
read_argv1iArgcharsmaxiArg ) );
    
        
Cmd_SearchidiArg );
}

public 
SettingsMenuid )
{
        new 
hMenu;

        new 
iSettingsMenu33 ];
        
formatex iSettingsMenucharsmaxiSettingsMenu ), "^n\y%L"hMenu"ADV_MENU1_SETTINGS_TITLE" )
        
hMenu menu_createiSettingsMenu"SettingsMenu_Handler" )
    
        new 
iPlay33 ];
        
formatexiPlaycharsmaxiPlay ), "^n%L"hMenu"ADV_MENU1_PLAY_SONG" )
        
menu_additemhMenuiPlay )
        new 
iCommands33 ];
        
formatexiCommandscharsmaxiCommands ), "^n%L"hMenu"ADV_MENU1_MUSIC_COMMANDS" )
        
menu_additemhMenuiCommands )
        new 
iSearch33 ];
        
formatexiSearchcharsmaxiSearch ), "^n%L"hMenu"ADV_MENU1_SEARCH_SONGS" )
        
menu_additemhMenuiSearch )
        new 
iRepeat33 ];
        
formatexiRepeatcharsmaxiRepeat ), "^n%L \w[\r%s\w]"hMenu"ADV_MENU1_REPEAT"g_Repeatid ] ? "%L" "%L""ADV_MENU1_REPEAT_ON""ADV_MENU1_REPEAT_OFF" // HERE! ML SWITCHS
        
menu_additemhMenuiRepeat )        
        
menu_addtexthMenu"\r--------------------")
        new 
iVolume33 ];
        
formatexiVolumecharsmaxiVolume ), "    ^n\y%L \r%d"hMenu"ADV_MENU1_VOLUME"g_Volumeid ] )
        
menu_addtexthMenuiVolume)
        new 
iVup33 ];
        
formatexiVupcharsmaxiVup ), "^n%L"hMenu"ADV_MENU1_VOLUME_UP" )
        
menu_additemhMenuiVup )
        new 
iVdown33 ];
        
formatexiVdowncharsmaxiVdown ), "^n%L"hMenu"ADV_MENU1_VOLUME_DOWN" )
        
menu_additemhMenuiVdown )
        
menu_addtexthMenu"\r--------------------")
        
menu_addtexthMenu"")
        
menu_addtexthMenu"")
        new 
iSave33 ];
        
formatexiSavecharsmaxiSave ), "^n%L \w[\r%s\w]"hMenu"ADV_MENU1_SETTINGS"g_SettingsSaveid ] ? "%L" "%L""ADV_MENU1_SETTINGS_SAVED""ADV_MENU1_SETTINGS_NOT_SAVED" // HERE! ML SWITCHS
        
menu_additemhMenuiSave )
    
        
menu_displayidhMenu);
        return;
}

public 
SettingsMenu_HandleridhMenuitem )
{
        if( 
item == MENU_EXIT )
        {
                
menu_destroyhMenu );
                return 
PLUGIN_HANDLED;
        }

        switch( 
item )
        {
                case 
0SongListid );
        
                case 
1:
                {
                        new 
Motd1056 ], Len;

                        
Len formatexMotdcharsmaxMotd ), "<html><head><style type=^"text/css^">pre{color:#CDCCCB;}body{background:#000000;margin-left:8px;margin-top:0px;}</style></head><pre><body>" );
                        
Len += formatexMotdLen ], charsmaxMotd ) - Len"<center><b><i>%L</i></b></center>^n"id"ADV_MOTD1_MUSIC_HELP" );
                        
Len += formatexMotdLen ], charsmaxMotd ) - Len"<b>%L</b>^n"id"ADV_MOTD1_PLAYER_COMMANDS" );
                        
Len += formatexMotdLen ], charsmaxMotd ) - Len"/music - <i>%L</i>^n"id"ADV_MOTD1_MUSIC_COMMAND" );
                        
Len += formatexMotdLen ], charsmaxMotd ) - Len"/search ^"song/name^" - <i>%L</i>^n"id"ADV_MOTD1_SEARCH_COMMAND" );
                        
Len += formatexMotdLen ], charsmaxMotd ) - Len"/replay - <i>%L</i>^n"id"ADV_MOTD1_REPLAY_COMMAND" );
                        
Len += formatexMotdLen ], charsmaxMotd ) - Len"/copy - <i>%L</i>^n"id"ADV_MOTD1_COPY_COMMAND" );
                        
Len += formatexMotdLen ], charsmaxMotd ) - Len"/stop - <i>%L</i>^n"id"ADV_MOTD1_STOP_COMMAND" );
                        
formatexMotdLen ], charsmaxMotd ) - Len"</center></body></pre></html>" );
            
                        if( 
get_user_flagsid ) & ADMIN_CFG )
                        {
                                
Len += formatexMotdLen ], charsmaxMotd ) - Len"<b>%L</b>^n"id"ADV_MOTD1_ADMIN_COMMAND"g_szPlugin );
                                
Len += formatexMotdLen ], charsmaxMotd ) - Len"amx_addsong - <i>%L</i>^n"id"ADV_MOTD1_ADDSONG_COMMAND" );
                                
formatexMotdLen ], charsmaxMotd ) - Len"</center></body></pre></html>" );
                        }
        
                        
show_motdidMotdg_szPlugin );
                }
                case 
2
                {
                        
client_cmdid"messagemode search" );
                        
client_printidprint_center"%L"id"ADV_TYPE_SONG_NAME" );
                }
                case 
3
                {
                        if( 
g_Repeatid ] == true )
                                
g_Repeatid ] = false;
                        else
                                
g_Repeatid ] = true;

                        
g_SettingsSaveid ] = false;
                        
SettingsMenuid )
                }
                case 
4
                {
                        if( 
g_Volumeid ] >= 100 )
                        {
                               
SettingsMenuid )
                               return 
PLUGIN_HANDLED;
                        }
                
                        
g_Volumeid ] += 10

                        g_SettingsSave
id ] = false;
                        
SettingsMenuid )
                }
                case 
5
                {
                        if( 
g_Volumeid ] <= 10 )
                        {
                               
SettingsMenuid )
                               return 
PLUGIN_HANDLED;
                        }
                
                        
g_Volumeid ] -= 10

                        g_SettingsSave
id ] = false;
                        
SettingsMenuid )
                }
                case 
6
                {
                        if( 
g_SettingsSaveid ] == false )
                                
g_SettingsSaveid ] = true;
            
                        
SettingsMenuid )
                }
        }

        return 
PLUGIN_CONTINUE;
}

public 
SongListid 
{
        if( !
g_SongCount )
                return;

        new 
iSongListMenu33 ];
        
formatex iSongListMenucharsmaxiSongListMenu ), "\y%L:^n"id"ADV_MENU2_SONG_LIST_TITLE" 
        new 
hMenu menu_createiSongListMenu"SongList_Handler" );
    
        new 
szNum];
    
        for( new 
g_SongCount i++ ) 
        {
                
num_to_striszNum);
                
ArrayGetArrayg_hArrayig_SongInformation );
                
menu_additemhMenug_SongInformationName ], szNum );
        }
    
        
menu_displayidhMenu );
        return;
}

public 
SongList_HandleridhMenuitem 
{    
        if( 
item != MENU_EXIT )
        {
                new 
szData], szName64 ], accesscallback;
                
menu_item_getinfohMenuitemaccessszDatacharsmaxszData ), szNamecharsmaxszName ), callback )

                new 
sChoice str_to_numszData );

                
Play_SongidsChoice );
        }
    
        
menu_destroyhMenu )
        return 
PLUGIN_HANDLED;
}

Cmd_Searchid, const iText[ ] )
{
        new 
iCmdSearchMenu33 ];
        
formatex iCmdSearchMenucharsmaxiCmdSearchMenu ), "\y%L:^n"id"ADV_MENU3_CMD_SEARCH_TITLE" 
        new 
hMenu menu_createiCmdSearchMenu"SongList_Handler" );
    
        new 
bool:bSearchFoundszNum];
    
        for( new 
g_SongCount i++ )
        {
                
num_to_striszNum)
                
ArrayGetArrayg_hArrayig_SongInformation );
        
                if( 
containig_SongInformationName ], iText ) == -)
                continue;
        
                
bSearchFound true;
                
menu_additemhMenug_SongInformationName ], szNum );
        }
    
        if ( !
bSearchFound 
        {
                
client_print_coloridNORMAL"%L"id"ADV_NOT_FOUND"iText );
        
                
menu_destroyhMenu );
                return;
        }
    
        
client_print_coloridNORMAL"%L"id"ADV_SEARCHED_FOR"iText );
        
menu_displayidhMenu )
        return;
}

public 
Cmd_CopySongid )
        
Play_Songidg_Song] );

Play_SongidiSongId 
{
        static 
Motd8192 ];
    
        new 
LeniFile fopeng_MusicPlayer"r" );
    
        if( !
iFile 
        {
                
log_amx"[%s] Could not open file ^"%s^"."g_szPluging_MusicPlayer );
                return;
        }
    
        while( !
feofiFile ) )
                
Len += fgetsiFileMotdLen ], charsmaxMotd ) - Len );
    
        
ArrayGetArrayg_hArrayiSongIdg_SongInformation );
    
        
replaceMotdcharsmaxMotd ), "[MEDIA_NAME]"g_SongInformationName ] );
        
replaceMotdcharsmaxMotd ), "[MEDIA_URL]"g_SongInformationUrl ] );
        new 
iVol33 ];
        
formatexiVolcharsmaxiVol ), "volume=%i"g_Volumeid ] );
        
replaceMotdcharsmaxMotd ), "volume=70"iVol );
    
        if( 
g_Repeatid ] == true )
                
replaceMotdcharsmaxMotd ), "repeat=never""repeat=always" )
    
        
show_motdidMotdg_szPlugin );
    
        new 
szName32 ];
        
get_user_nameidszNamecharsmaxszName ) );
        
client_print_color0NORMAL"%L"id"ADV_LISTENING_TO"szNameg_SongInformationName ] );
    
        
g_Songid ] = g_Song] = iSongId;
}

Initialize( ) 
{
        
g_hArray ArrayCreatesizeof g_SongInformation );
        
ArrayPushArrayg_hArray"" );
    
        new 
Len get_localinfo"amxx_configsdir"g_FileNamecharsmaxg_FileName ) );
        
copyg_FileNameLen ], charsmaxg_FileName ) - Len"/songlist.ini" );
    
        
copyg_MusicPlayercharsmaxg_MusicPlayer ), g_FileName );
        
copyg_MusicPlayerLen ], charsmaxg_MusicPlayer ) - Len"/AdvMusicPlayer.html" );
    
        if( !
file_existsg_FileName ) ) 
        {
                new 
iTempFile fopeng_FileName"w" );
        
                if( !
iTempFile 
                {
                        
log_amx"[%s] Could not open file ^"%s^"."g_szPluging_FileName );
                        return;
                }
        
                
fprintfiTempFile"; %s^n"g_szPlugin );
                
fprintfiTempFile"; Format: ^"Song Name^"  ^"Url/Link^"^n" );
                
fprintfiTempFile"; eg. ^"Eminem Mockingbird^" ^"http://www.youtube.com/watch?v=S9bCLPwzSC0^"^n" );
        
                
fcloseiTempFile );
        
                
server_print"%L""ADV_FILE_ADDED"g_FileName );
        
                return;
        }
    
        new 
iFile fopeng_FileName"r" );
    
        if( !
iFile 
        {
                
log_amx"[%s] Could not open file ^"%s^"."g_szPluging_FileName );
                return;
        }
    
        new 
iText1024 ];
    
        while( !
feofiFile ) ) 
        {
        
                
fgetsiFileiTextcharsmaxiText ) );
                
trimiText );
        
                if( !
iText] || iText] == ';' )
                        continue;
        
                
parseiTextg_SongInformationName ], charsmaxg_SongInformationName ] ), g_SongInformationUrl ], charsmaxg_SongInformationUrl ] ) );
                
trimg_SongInformationName ] );
                
trimg_SongInformationUrl ] );
        
                if( !
g_SongInformationName ][ ] || !g_SongInformationUrl ][ ] )
                        continue;
        
                
ArrayPushArrayg_hArrayg_SongInformation );
        
                
g_SongCount++;
        }
    
        
fcloseiFile );
}

public 
plugin_end( )
        
ArrayDestroyg_hArray );

register_dictionary_colored( const iFile[ ] )
{
        if( !
register_dictionaryiFile ) )
                return 
0;
    
        new 
iLangDir128 ];
        
get_localinfo"amxx_datadir"iLangDircharsmaxiLangDir ) );
        
formatexiLangDircharsmaxiLangDir ), "%s/lang/%s"iLangDiriFile );
    
        new 
iTempFile fopeniLangDir"rt" );
    
        if( !
iTempFile )
        {
                
log_amx"Failed to open: %s"iLangDir );
                return 
0;
        }
    
        new 
szBuffer512 ], szLang], szKey64 ], szTranslation256 ], TransKey:iKey;
    
        while( !
feofiTempFile ) )
        {
                
fgetsiTempFileszBuffer511 );
        
                if( 
szBuffer] == '[' )
                {
                        
strtokszBuffer], szLang2szBuffer1']' );
                }

                else if( 
szBuffer] )
                {
                        
strbreakszBufferszKey63szTranslation255 );
                        
iKey GetLangTransKeyszKey );
            
                        if( 
iKey != TransKey_Bad )
                        {
                                
replace_allszTranslation255"!g""^4" );
                                
replace_allszTranslation255"!t""^3" );
                                
replace_allszTranslation255"!n""^1" );
                
                                
AddTranslationszLangiKeyszTranslation] );
                        }
                }
        }
    
        
fcloseiTempFile );
    
        return 
1;
}

client_print_coloridColor:type, const msg[ ], { FloatSqlResult}:... )
{
        static 
SayText;

        if( !
SayText )
        
SayText get_user_msgid"SayText" );
    
        static 
message256 ];
    
        switch( 
type )
        {
                case 
GREEN// Green
                
{
                        
message] = 0x04;
                }
                case 
TEAM_COLOR// Team Color. Ie. Red (Terrorist) or blue (Counter-Terrorist).
                
{
                        
message] = 0x03;
                }
                default: 
// Yellow.
                
{
                        
message] = 0x01;
                }
        }

        
vformatmessage], 251msg);

        
message192 ] = '^0';

        if( 
id )
        {
                if( 
is_user_connectedid ) )
                {
                        
message_beginMSG_ONESayText, { 00}, id );
                        
write_byteid );
                        
write_stringmessage );
                        
message_end( );
                }
        } 
    
        else 
        {
                static 
Players32 ]; new CountIndex;
                
get_playersPlayersCount );
        
                for( new 
Count i++ )
                {
                        
Index Players];
            
                        
message_beginMSG_ONESayText, { 00}, Index );
                        
write_byteIndex );
                        
write_stringmessage );
                        
message_end( );
                }
        }

AdvMusicPlayer.txt
Code:
[en]
ADV_MOTD1_MUSIC_HELP = - Music Help -
ADV_MOTD1_PLAYER_COMMANDS = Player Commands:
ADV_MOTD1_MUSIC_COMMAND = Opens the list of all the songs added in the server.
ADV_MOTD1_SEARCH_COMMAND = Searches for a specific song. [ Without Quotes ]
ADV_MOTD1_REPLAY_COMMAND = Replays the last played song by you.
ADV_MOTD1_COPY_COMMAND = Copies the last song played by the last player.
ADV_MOTD1_STOP_COMMAND = Stops the music.
ADV_MOTD1_ADMIN_COMMAND = Admin Command:
ADV_MOTD1_ADDSONG_COMMAND = Usage: amx_addsong "Song name" "Url/Link" | Attention: Put them with quotes.

ADV_MOTD2_MUSIC_STOPPED = Music Stopped.
ADV_MOTD2_BROUGHT_TO_YOU = This has been brought you by %s.
ADV_MOTD2_POWERFUL_PLAYER = %s is the most powerful music player plugin ever!
ADV_MOTD2_HOPE_FUN_LISTENING = Hope you had fun listening to the nice music!

ADV_MENU1_SETTINGS_TITLE = Choose your settings
ADV_MENU1_PLAY_SONG = Play Song
ADV_MENU1_MUSIC_COMMANDS = Music Commands
ADV_MENU1_SEARCH_SONGS = Search Songs
ADV_MENU1_REPEAT = Repeat Song
ADV_MENU1_REPEAT_ON = On
ADV_MENU1_REPEAT_OFF = Off
ADV_MENU1_VOLUME = Volume
ADV_MENU1_VOLUME_UP = Volume Up
ADV_MENU1_VOLUME_DOWN = Volume Down
ADV_MENU1_SETTINGS = Save Settings
ADV_MENU1_SETTINGS_SAVED = Saved
ADV_MENU1_SETTINGS_NOT_SAVED = Not Saved

ADV_MENU2_SONG_LIST_TITLE = Choose a song to play

ADV_MENU3_CMD_SEARCH_TITLE = Search Results

ADV_CONNECT_MSG = Welcome !t%s!n. Type !g/musichelp !nto see the available commands to listen to music.
ADV_NO_SONG_PLAYED = You have not played any !gsong !nyet.
ADV_SEARCHED_FOR = Results for '!g%s!n': !tSuccessful Search!n.
ADV_NOT_FOUND = Results for '!g%s!n': !tNothing was found!n.
ADV_LISTENING_TO = !t%s !nis now listening to !g%s!n. Type !g/copy !nto copy his song.
ADV_TYPE_SONG_NAME = Now just type the song or the artist name and press enter!

ADV_SONG_ADDED = * Added "%s" song to songlist.ini file! *
ADV_FILE_ADDED = * File has been added to: %s *
__________________
Like my clean plugins and work?

Last edited by Baws; 03-28-2014 at 13:12.
Baws is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 03-28-2014 , 19:15   Re: Menu Got so much spacing! [ML SYSTEM-SWITCHMENU]
Reply With Quote #2

1, you don't need ^n in the new menu system. It will break rows by itself.

2,
formatex( iRepeat, charsmax( iRepeat ), "%L \w[\r%L\w]", id, "ADV_MENU1_REPEAT", id, g_Repeat[ id ] ? "ADV_MENU1_REPEAT_ON" : "ADV_MENU1_REPEAT_OFF" ) // HERE! ML SWITCHS
formatex( iSave, charsmax( iSave ), "%L \w[\r%L\w]", id, "ADV_MENU1_SETTINGS", id, g_SettingsSave[ id ] ? "ADV_MENU1_SETTINGS_SAVED" : "ADV_MENU1_SETTINGS_NOT_SAVED" ) // HERE! ML SWITCHS
Notice i switched hMenu to id. That is used to retrieve the language used for "id", you cannot use hMenu.

3, The ML adds a line-break for some weird reason. I'm not very experienced in ML, don't know why.

4, Stop making new variables to hold a temporary string for formatex(). Make one and reuse it. You're wasting memory.
__________________

Last edited by Black Rose; 03-28-2014 at 19:37.
Black Rose is offline
Baws
Veteran Member
Join Date: Oct 2012
Old 03-28-2014 , 20:39   Re: Menu Got so much spacing! [ML SYSTEM-SWITCHMENU]
Reply With Quote #3

I did what you asked but apparently nothing worked out.
When i did 1 variable to all the formatex(), and i tested it
like when i typed /music in-game the menu wouldn't come
up. I think the reason is that doing a variable for formatex
in the new menu system doesn't work? I think.

Plus, when i type, /search it's all fine but when it's too many
pages, the number of pages [x/x] is under the "Search Results:"

If the ML system is like that, it means i need to switch to the
old menu system or there's a fix to it?

Here's what i did for the main menu:
PHP Code:
public SettingsMenuid )
{
        new 
hMenuiText33 ];

        
formatex iTextcharsmaxiText ), "\y%L"id"ADV_MENU1_SETTINGS_TITLE" )
        
hMenu menu_createiText"SettingsMenu_Handler" )
    
        
formatexiTextcharsmaxiText ), "%L"id"ADV_MENU1_PLAY_SONG" )
        
menu_additemhMenuiText )
        
formatexiTextcharsmaxiText ), "%L"id"ADV_MENU1_MUSIC_COMMANDS" )
        
menu_additemhMenuiText )
        
formatexiTextcharsmaxiText ), "%L"id"ADV_MENU1_SEARCH_SONGS" )
        
menu_additemhMenuiText )
        
formatexiTextcharsmaxiText ), "%L \w[\r%L\w]"id"ADV_MENU1_REPEAT"idg_Repeatid ] ? "ADV_MENU1_REPEAT_ON" "ADV_MENU1_REPEAT_OFF" )
        
menu_additemhMenuiText )        
        
menu_addtexthMenu"\r--------------------")
        
formatexiTextcharsmaxiText ), "    \y%L \r%d"id"ADV_MENU1_VOLUME"g_Volumeid ] )
        
menu_addtexthMenuiText)
        
formatexiTextcharsmaxiText ), "%L"id"ADV_MENU1_VOLUME_UP" )
        
menu_additemhMenuiText )
        
formatexiTextcharsmaxiText ), "%L"id"ADV_MENU1_VOLUME_DOWN" )
        
menu_additemhMenuiText )
        
menu_addtexthMenu"\r--------------------")
        
menu_addtexthMenu"")
        
menu_addtexthMenu"")
        
formatexiTextcharsmaxiText ), "%L \w[\r%L\w]"id"ADV_MENU1_SETTINGS"g_SettingsSaveid ] ? "ADV_MENU1_SETTINGS_SAVED" "ADV_MENU1_SETTINGS_NOT_SAVED" )
        
menu_additemhMenuiText )
    
        
menu_displayidhMenu);
        return;

__________________
Like my clean plugins and work?
Baws is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 03-28-2014 , 21:03   Re: Menu Got so much spacing! [ML SYSTEM-SWITCHMENU]
Reply With Quote #4

You really need to know how to debug if you want to release plugins.

Code:
L 03/29/2014 - 02:02:24: String formatted incorrectly - parameter 6 (total 6)
L 03/29/2014 - 02:02:24: [AMXX] Displaying debug trace (plugin "test1.amxx")
L 03/29/2014 - 02:02:24: [AMXX] Run time error 25: parameter error
L 03/29/2014 - 02:02:24: [AMXX]    [0] test1.sma::SettingsMenu (line 332)
L 03/29/2014 - 02:02:24: [AMXX]    [1] test1.sma::Cmd_Say (line 248)
Black Rose : /music
Code:
formatex( iText, charsmax( iText ), "%L \w[\r%L\w]", id, "ADV_MENU1_SETTINGS", g_SettingsSave[ id ] ? "ADV_MENU1_SETTINGS_SAVED" : "ADV_MENU1_SETTINGS_NOT_SAVED" )
-->
Code:
formatex( iText, charsmax( iText ), "%L \w[\r%L\w]", id, "ADV_MENU1_SETTINGS", id, g_SettingsSave[ id ] ? "ADV_MENU1_SETTINGS_SAVED" : "ADV_MENU1_SETTINGS_NOT_SAVED" )
__________________

Last edited by Black Rose; 03-28-2014 at 21:04.
Black Rose is offline
Baws
Veteran Member
Join Date: Oct 2012
Old 03-28-2014 , 21:19   Re: Menu Got so much spacing! [ML SYSTEM-SWITCHMENU]
Reply With Quote #5

I really have to go search for some debuging tutorial haha. Thanks.
I fixed everything but there's 1 more thing that's annoying. It's so
much spaced for some reason. And the number of pages is under
the title too. Can it be fixed?



__________________
Like my clean plugins and work?
Baws is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 03-28-2014 , 21:30   Re: Menu Got so much spacing! [ML SYSTEM-SWITCHMENU]
Reply With Quote #6

I told you. It's because of the ML, it keeps including the linefeed. You can trim() it away, but there's obviously something wrong that needs to be checked out before taking shortcuts.
__________________
Black Rose is offline
Baws
Veteran Member
Join Date: Oct 2012
Old 03-28-2014 , 21:33   Re: Menu Got so much spacing! [ML SYSTEM-SWITCHMENU]
Reply With Quote #7

I know that in the old menu system it don't do that as i have checked many other plugins that uses ML with the old menu system. So the only option would be to trim()?
__________________
Like my clean plugins and work?
Baws is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 03-28-2014 , 21:54   Re: Menu Got so much spacing! [ML SYSTEM-SWITCHMENU]
Reply With Quote #8

Goddamn I hate colorchat and all these poorly written functions associated with it.
Code:
register_dictionary_colored( const iFile[ ] ) // ...     while( !feof( iTempFile ) )     {         arrayset(szBuffer, 0, sizeof szBuffer);         fgets( iTempFile, szBuffer, 511 );         trim(szBuffer);
Good enough.
__________________
Black Rose is offline
Baws
Veteran Member
Join Date: Oct 2012
Old 03-28-2014 , 22:41   Re: Menu Got so much spacing! [ML SYSTEM-SWITCHMENU]
Reply With Quote #9

That worked. Thanks mate!



ps. you should be some coding master or something lol
__________________
Like my clean plugins and work?
Baws is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:54.


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