|
Veteran Member
|

03-13-2014
, 21:10
if ! [Help] Equali, Print
|
#1
|
I want something like when i type the command ( /search ) and if it didn't find anything it will print "Results: Nothing was found". What i did, didn't work. Tried many things didn't work. if(!...... else print ...etc didn't work. Is there a way to do it?
PHP Code:
public Cmd_Say( id ) { new szText[ 192 ]; read_args( szText, charsmax( szText ) ); remove_quotes( szText ); if( szText[ 0 ] != '/' ) return PLUGIN_CONTINUE; if( equali( szText[ 1 ], "music", 5 ) ) { SongList( id ); return PLUGIN_HANDLED; } else if( equali( szText[ 1 ], "stop", 4 ) ) { new Motd[ 384 ], Len; Len = formatex( Motd, charsmax( Motd ), "<html><head><style type=^"text/css^">pre{color:#FFB000;}body{background:#000000;margin-left:8px;margin-top:0px;}</style></head><pre><body><center>" ); Len += formatex( Motd[ Len ], charsmax( Motd ) - Len, "<b>Music Stopped</b>." ); Len += formatex( Motd[ Len ], charsmax( Motd ) - Len, "This has been brought you by %s.^n", g_szAuthor ); Len += formatex( Motd[ Len ], charsmax( Motd ) - Len, "%s is the most powerful music player plugin ever!^n", g_szPlugin ); Len += formatex( Motd[ Len ], charsmax( Motd ) - Len, "Hope you had fun listening to the nice music!^n" ); formatex( Motd[ Len ], charsmax( Motd ) - Len, "</center></body></pre></html>" ); show_motd( id, Motd, g_szPlugin ); return PLUGIN_HANDLED; } else if( equali( szText[ 1 ], "replay", 6 ) ) { if( g_Song[ id ] != 0 ) Play_Song( id, g_Song[ id ] ); else client_print_color( id, NORMAL, "%L", id, "NO_SONG_PLAYED" ); return PLUGIN_HANDLED; } else if( equali( szText[ 1 ], "copy", 4 ) ) { Cmd_CopySong( id ); return PLUGIN_HANDLED; } else if( equali( szText[ 1 ], "search", 6 ) ) { new szName[ 64 ]; strbreak( szText, "", 0, szName, charsmax( szName ) ); Cmd_Search( id, szName ); return PLUGIN_HANDLED; } return PLUGIN_CONTINUE; }
public SongList_Handler( id, hMenu, item ) { if( item != MENU_EXIT ) { new szData[ 6 ], szName[ 64 ], access, callback; menu_item_getinfo( hMenu, item, access, szData, charsmax( szData ), szName, charsmax( szName ), callback )
new sChoice = str_to_num( szData );
Play_Song( id, sChoice ); } menu_destroy( hMenu ) return PLUGIN_HANDLED; }
Cmd_Search( id, const iText[ ] ) { client_print_color( id, NORMAL, "%L", id, "SEARCHED_FOR", iText ); //Where it says: "Searched for 'x'. " I want that if the 'x' word is not found well it will says instead of searched for, it'll say not found.
new szNum[ 6 ], hMenu = menu_create( "\ySearch Results:", "SongList_Handler" ); for( new i = 1 ; i < g_SongCount + 1 ; i++ ) { num_to_str( i, szNum, 5 ) ArrayGetArray( g_hArray, i, g_SongInformation );
if( containi( g_SongInformation[ Name ], iText ) == -1 ) continue; menu_additem( hMenu, g_SongInformation[ Name ], szNum ); }
menu_display( id, hMenu ) return PLUGIN_HANDLED; }
__________________
Like my clean plugins and work?
Last edited by Baws; 03-13-2014 at 21:11.
|
|