Oh hell no... lol i really need to try and debug next time.. Captain Coder helped! <3 Thanks.
Another thing, the sound doesn't play. Why?
I tried changing it to wav mp3...etc and there's not errors like i debuged but nothing.
Code:
#include < amxmodx >
#include < amxmisc >
new const g_szPlugin[ ] = "Surf Help";
new const g_szVersion[ ] = "1.0";
new const g_szAuthor[ ] = "Baws";
enum Color
{
NORMAL = 1,
GREEN,
TEAM_COLOR,
GREY,
RED,
BLUE
};
new const g_szLearnedSound[ ] = "sound/misc/learnedsurfing.mp3";
new const g_szTitle[ ] = "Advanced Surf Help";
public plugin_init( )
{
register_plugin( g_szPlugin, g_szVersion, g_szAuthor )
register_clcmd( "say /surfhelp", "SurfHelpMenu" );
register_clcmd( "say_team /surfhelp", "SurfHelpMenu" );
register_dictionary( "SurfHelp.txt" );
}
public SurfHelpMenu( id )
{
new hMenu = menu_create( "Surf Help Menu:", "SurfHelpMenu_Handler" );
menu_additem( hMenu, "Learn by: \rText", "", 0 );
menu_additem( hMenu, "Learn by: \rVideo", "", 0 );
menu_additem( hMenu, "\yStop The Video!", "", 0 );
menu_display( id, hMenu, 0 );
}
public SurfHelpMenu_Handler( id, hMenu, item )
{
if( item == MENU_EXIT )
{
new szName[ 33 ];
get_user_name( id, szName, charsmax( szName ) );
client_print_color( id, NORMAL, "^3%s^1, you are now a good surfer. Ask questions to be even better. Good Luck!", szName );
client_cmd( id, "mp3 play %s", g_szLearnedSound );
menu_destroy( hMenu );
return PLUGIN_HANDLED;
}
static Motd[ 4096 ], Len;
switch( item )
{
case 0:
{
Len = formatex( Motd, charsmax( Motd ), "<style type=^"text/css^"><!--.sty1 {color: #cdcccb;font-family: Arial, Helvetica, sans-serif;}--></style><body bgcolor=^"#000000^"><span class=^"sty1^"><strong><div align=^"center^">- Surf Help -</div></strong></span></p><table width=^"100%%^" border=^"1^"><table width=^"100%%^" border=^"1^">" );
Len += formatex( Motd[ Len ], charsmax( Motd ) - Len, "<tr><td><span class=^"sty1^">To surf, jump or walk onto one of the curved walls (hereby referted to as 'ramps'). Then simply hold strafe (Default are the A and D keys). This will cause you to glide along the walls, or "surf". </span></td></tr>" );
Len += formatex( Motd[ Len ], charsmax( Motd ) - Len, "<tr><td><span class=^"sty1^">While surfing, never press up, down, or crouch; pressing those will cause you to slide off the wall and fall, which, in most surf maps, will cause you to get sent back to your spawn. </span></td></tr>" );
Len += formatex( Motd[ Len ], charsmax( Motd ) - Len, "<tr><td><span class=^"sty1^">To change direction (in order to make it to the next ramp), press the button for the direction you wish to go before flying off of your current ramp.</span></td></tr>" );
Len += formatex( Motd[ Len ], charsmax( Motd ) - Len, "<tr><td><span class=^"sty1^">Surfing takes pratice, so don't be discouraged if you don't get it right the first time.</span></td></tr>" );
Len += formatex( Motd[ Len ], charsmax( Motd ) - Len, "</table><p align=^"center^"><span class=^"sty1^"><strong>Powered by %s</strong></span></p></body></html>", g_szPlugin );
show_motd( id, Motd, g_szTitle )
SurfHelpMenu( id );
}
case 1:
{
Len = formatex( Motd, charsmax( Motd ), "<html><head><style type=^"text/css^">body{background:#000000;margin-left:8px;margin-top:0px;}</style></head><body>" );
Len += formatex( Motd[ Len ], charsmax( Motd ) - Len, "<p style=^"text-align: center;^"><span style=^"color:cdcccb;^">This video is brought to you by <em><strong>%s</strong></em>.</span></p>^n", g_szAuthor );
Len += formatex( Motd[ Len ], charsmax( Motd ) - Len, "<h3 style=^"text-align: center;^"><span style=^"color:d7d5d2;^"><strong>Advanced Surfing Help Video</strong></span></h3>^n" );
Len += formatex( Motd[ Len ], charsmax( Motd ) - Len, "<p style=^"text-align: center;^"><span style=^"color:cdcccb;^">Note: Loading time depends on your internet speed.</span></p>^n" );
Len += formatex( Motd[ Len ], charsmax( Motd ) - Len, "<p style=^"text-align: center;^"><span style=^"color:cdcccb;^">Make sure to follow these steps! Or you will end up in jail.</span></p>^n" );
Len += formatex( Motd[ Len ], charsmax( Motd ) - Len, "<pre><center><object type=^"application/x-shockwave-flash^" data=^"http://allied-gamers.com/player.swf^" height=^"200^" width=^"500^" quality=^"high^">^n" );
Len += formatex( Motd[ Len ], charsmax( Motd ) - Len, "<param name=^"movie^" value=^"http://allied-gamers.com/player.swf^">^n" );
Len += formatex( Motd[ Len ], charsmax( Motd ) - Len, "<param name=^"FlashVars^" value=^"backcolor=0x000000&frontcolor=0xCCCCCC&lightcolor=0x996600&autostart=true&volume=50&file=http://www.youtube.com/watch?v=opdR6MVNIE4^">^n" );
formatex( Motd[ Len ], charsmax( Motd ) - Len, "</object></EMBED></OBJECT></pre></body></html>" );
show_motd( id, Motd, g_szTitle )
SurfHelpMenu( id );
}
case 2:
{
Len = formatex( Motd, charsmax( Motd ), "<html><head><style type=^"text/css^">pre{color:#cdcccb;}body{background:#000000;margin-left:8px;margin-top:0px;}</style></head><pre><body><center>" );
Len += formatex( Motd[ Len ], charsmax( Motd ) - Len, "<b>Video Stopped.</b>^n" );
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 plugin is here to help you out.^n", g_szPlugin );
Len += formatex( Motd[ Len ], charsmax( Motd ) - Len, "Hope you learned something from this!^n" );
formatex( Motd[ Len ], charsmax( Motd ) - Len, "</center></body></pre></html>" );
show_motd( id, Motd, g_szTitle );
SurfHelpMenu( id );
}
}
return PLUGIN_HANDLED;
}
client_print_color( id, Color:type, const msg[ ], { Float, Sql, Result, _ }:... )
{
static SayText;
if( !SayText )
SayText = get_user_msgid( "SayText" );
static message[ 256 ];
switch( type )
{
case GREEN: // Green
{
message[ 0 ] = 0x04;
}
case TEAM_COLOR: // Team Color. Ie. Red (Terrorist) or blue (Counter-Terrorist).
{
message[ 0 ] = 0x03;
}
default: // Yellow.
{
message[ 0 ] = 0x01;
}
}
vformat( message[ 1 ], 251, msg, 4 );
message[ 192 ] = '^0';
if( id )
{
if( is_user_connected( id ) )
{
message_begin( MSG_ONE, SayText, { 0, 0, 0 }, id );
write_byte( id );
write_string( message );
message_end( );
}
}
else
{
static Players[ 32 ]; new Count, Index;
get_players( Players, Count );
for( new i = 0 ; i < Count ; i++ )
{
Index = Players[ i ];
message_begin( MSG_ONE, SayText, { 0, 0, 0 }, Index );
write_byte( Index );
write_string( message );
message_end( );
}
}
}
/*register_dictionary_colored( const iFile[ ] )
{
if( !register_dictionary( iFile ) )
return 0;
new iLangDir[ 128 ];
get_localinfo( "amxx_datadir", iLangDir, charsmax( iLangDir ) );
formatex( iLangDir, charsmax( iLangDir ), "%s/lang/%s", iLangDir, iFile );
new iTempFile = fopen( iLangDir, "rt" );
if( !iTempFile )
{
log_amx( "Failed to open: %s", iLangDir );
return 0;
}
new szBuffer[ 512 ], szLang[ 3 ], szKey[ 64 ], szTranslation[ 256 ], TransKey:iKey;
while( !feof( iTempFile ) )
{
arrayset( szBuffer, 0, sizeof szBuffer );
fgets( iTempFile, szBuffer, 511 );
trim( szBuffer );
if( szBuffer[ 0 ] == '[' )
{
strtok( szBuffer[ 1 ], szLang, 2, szBuffer, 1, ']' );
}
else if( szBuffer[ 0 ] )
{
strbreak( szBuffer, szKey, 63, szTranslation, 255 );
iKey = GetLangTransKey( szKey );
if( iKey != TransKey_Bad )
{
replace_all( szTranslation, 255, "!g", "^4" );
replace_all( szTranslation, 255, "!t", "^3" );
replace_all( szTranslation, 255, "!n", "^1" );
AddTranslation( szLang, iKey, szTranslation[ 2 ] );
}
}
}
fclose( iTempFile );
return 1;
}*/