Raised This Month: $ Target: $400
 0% 

fix this plugin pls..


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nikeboy648
Member
Join Date: Dec 2013
Old 12-16-2013 , 08:25   fix this plugin pls..
Reply With Quote #1

this is the errors:

Error: Symbol already defined: "get_datadir" on line 128
Warning: Symbol is never used: "HandleSay" on line 130

this is the plugin:

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

#define USE_COLORCHAT	""

#define PLUGIN_TAG 	"Song"
#define MAX_QUESTIONS	64

#if defined USE_COLORCHAT
#include <colorchat>
#endif

#pragma semicolon 	1

new g_file[ MAX_QUESTIONS ];

new Questions[ 64 ][ MAX_QUESTIONS ];
new Answers[ 64 ][ MAX_QUESTIONS ];

new RandomAsked;

new bool:QuestionAsked;

public plugin_init( )
{
	new dir[ 64 ];
	get_datadir( dir, charsmax( dir ) );
	
	formatex( g_file, charsmax( g_file ), "%s/Song.ini", dir );
	
	register_clcmd( "say", "HandleSay" );
	register_clcmd( "say_team", "HandleSay" );
	
	QuestionAsked = false;
}

new endsound[ ][ ] =
{
"TxP/SongEvent1.mp3",
}



; HandleSay( client )
{
	new arg[ 10 ];
	
	read_argv( client, arg, charsmax( arg ) );
	client_cmd( 0, "mp3 play ^"sound/%s^"", endsound[ random( sizeof( endsound ) ) ] );
	
	if ( equali( arg, "/song" ) || equali( arg, "!song" ) )
	{
		if ( get_user_flags( client ) & ADMIN_ACCESS )
		{
			if ( !QuestionAsked )
			{
				Trivia( client );
			}
			else
			{
				#if defined USE_COLORCHAT
					ColorChat( client, TEAM_COLOR, "^4[ %s ] The^4 Event^1 is already^4 Enabled.", PLUGIN_TAG );
				#else
					client_print( client, print_chat, "The Event is already Enabled." );
				#endif
			}
		}
		else
		{
			#if defined USE_COLORCHAT
				ColorChat( client, TEAM_COLOR, "^4[ %s ] You dont have access to this^4 Command.", PLUGIN_TAG );
			#else
				client_print( client, print_chat, "You dont have access to this Command." );
			#endif
		}
	}
	else if ( QuestionAsked )
	{
		if ( equali( arg, Answers[ RandomAsked ] ) )
		{
			new NameSz[ 32 ];
			
			get_user_name( client, NameSz, charsmax( NameSz ) );
			
			#if defined USE_COLORCHAT
				ColorChat( client, TEAM_COLOR, "^4[ %s ]^3 %s^1 Answered Correct:^4 ''%s''", PLUGIN_TAG, NameSz, arg );
			#else
				client_print( client, print_chat, "^4%s Answered Correct: ''%s''^3", NameSz, arg );
			#endif
			
			QuestionAsked = false;
			
			return PLUGIN_HANDLED;
		}
	}
	return PLUGIN_CONTINUE;
}
		
public Trivia( client )
{	
	new file = fopen( g_file, "rt" );
	new data[ 128 ];
	new question[ MAX_QUESTIONS ];
	new answer[ MAX_QUESTIONS ];
	
	new i = 0;
	
	while ( !feof( file ) )
	{
		i++;
		
		fgets( file, data, charsmax( data ) );
		parse( data, question, 31, answer, 31 );
		
		formatex( Questions[ i ], charsmax( Questions ), question );
		formatex( Answers[ i ], charsmax( Answers ), answer );
		
		replace_all( Questions[ i ], charsmax( Questions ), "_", " " );
	}
	
	RandomAsked = random_num( 1, i );
	QuestionAsked = true;
}

stock get_datadir( name[ ],len )
{
	return get_localinfo( "amxx_datadir", name, len );
}
Fix it please!
nikeboy648 is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 12-16-2013 , 08:41   Re: fix this plugin pls..
Reply With Quote #2

Remove the semicolon in front of HandleSay(client)
Remove the get_datadir stock
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
nikeboy648
Member
Join Date: Dec 2013
Old 12-16-2013 , 09:30   Re: fix this plugin pls..
Reply With Quote #3

Quote:
Originally Posted by YamiKaitou View Post
Remove the semicolon in front of HandleSay(client)
Remove the get_datadir stock
now I got this errors:

Error: Expected token: ";", but found "public" on line 44
Error: Undefined symbol "ADMIN_ACCESS" on line 53

CODE:

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

#define USE_COLORCHAT	""

#define PLUGIN_TAG 	"Song"
#define MAX_QUESTIONS	64

#if defined USE_COLORCHAT
#include <colorchat>
#endif

#pragma semicolon 	1

new g_file[ MAX_QUESTIONS ];

new Questions[ 64 ][ MAX_QUESTIONS ];
new Answers[ 64 ][ MAX_QUESTIONS ];

new RandomAsked;

new bool:QuestionAsked;

public plugin_init( )
{
	new dir[ 64 ];
	get_datadir( dir, charsmax( dir ) );
	
	formatex( g_file, charsmax( g_file ), "%s/Song.ini", dir );
	
	register_clcmd( "say", "HandleSay" );
	register_clcmd( "say_team", "HandleSay" );
	
	QuestionAsked = false;
}

new endsound[ ][ ] =
{
"TxP/SongEvent1.mp3"
}

public HandleSay( client )
{
	new arg[ 10 ];
	
	read_argv( client, arg, charsmax( arg ) );
	client_cmd( 0, "mp3 play ^"sound/%s^"", endsound[ random( sizeof( endsound ) ) ] );
	
	if ( equali( arg, "/song" ) || equali( arg, "!song" ) )
	{
		if ( get_user_flags( client ) & ADMIN_ACCESS )
		{
			if ( !QuestionAsked )
			{
				Trivia( client );
			}
			else
			{
				#if defined USE_COLORCHAT
					ColorChat( client, TEAM_COLOR, "^4[ %s ] The^4 Event^1 is already^4 Enabled.", PLUGIN_TAG );
				#else
					client_print( client, print_chat, "The Event is already Enabled." );
				#endif
			}
		}
		else
		{
			#if defined USE_COLORCHAT
				ColorChat( client, TEAM_COLOR, "^4[ %s ] You dont have access to this^4 Command.", PLUGIN_TAG );
			#else
				client_print( client, print_chat, "You dont have access to this Command." );
			#endif
		}
	}
	else if ( QuestionAsked )
	{
		if ( equali( arg, Answers[ RandomAsked ] ) )
		{
			new NameSz[ 32 ];
			
			get_user_name( client, NameSz, charsmax( NameSz ) );
			
			#if defined USE_COLORCHAT
				ColorChat( client, TEAM_COLOR, "^4[ %s ]^3 %s^1 Answered Correct:^4 ''%s''", PLUGIN_TAG, NameSz, arg );
			#else
				client_print( client, print_chat, "^4%s Answered Correct: ''%s''^3", NameSz, arg );
			#endif
			
			QuestionAsked = false;
			
			return PLUGIN_HANDLED;
		}
	}
	return PLUGIN_CONTINUE;
}
		
public Trivia( client )
{	
	new file = fopen( g_file, "rt" );
	new data[ 128 ];
	new question[ MAX_QUESTIONS ];
	new answer[ MAX_QUESTIONS ];
	
	new i = 0;
	
	while ( !feof( file ) )
	{
		i++;
		
		fgets( file, data, charsmax( data ) );
		parse( data, question, 31, answer, 31 );
		
		formatex( Questions[ i ], charsmax( Questions ), question );
		formatex( Answers[ i ], charsmax( Answers ), answer );
		
		replace_all( Questions[ i ], charsmax( Questions ), "_", " " );
	}
	
	RandomAsked = random_num( 1, i );
	QuestionAsked = true;
}

Last edited by nikeboy648; 12-16-2013 at 09:33.
nikeboy648 is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 12-16-2013 , 18:44   Re: fix this plugin pls..
Reply With Quote #4

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

#define USE_COLORCHAT    ""

#define PLUGIN_TAG     "Song"
#define MAX_QUESTIONS    64

#if defined USE_COLORCHAT
#include <colorchat>
#endif

#pragma semicolon     1

new g_fileMAX_QUESTIONS ];

new 
Questions64 ][ MAX_QUESTIONS ];
new 
Answers64 ][ MAX_QUESTIONS ];

new 
RandomAsked;

new 
bool:QuestionAsked;

public 
plugin_init( )
{
    new 
dir64 ];
    
get_datadirdircharsmaxdir ) );
    
    
formatexg_filecharsmaxg_file ), "%s/Song.ini"dir );
    
    
register_clcmd"say""HandleSay" );
    
register_clcmd"say_team""HandleSay" );
    
    
QuestionAsked false;
}

new 
endsound[ ][ ] =
{
    
"TxP/SongEvent1.mp3"
};

public 
HandleSayclient )
{
    new 
arg10 ];
    
    
read_argvclientargcharsmaxarg ) );
    
client_cmd0"mp3 play ^"sound/%s^""endsoundrandomsizeofendsound ) ) ] );
    
    if ( 
equaliarg"/song" ) || equaliarg"!song" ) )
    {
        if ( 
get_user_flagsclient ) & ADMIN_KICK )
        {
            if ( !
QuestionAsked )
            {
                
Triviaclient );
            }
            else
            {
                
#if defined USE_COLORCHAT
                    
ColorChatclientTEAM_COLOR"^4[ %s ] The^4 Event^1 is already^4 Enabled."PLUGIN_TAG );
                
#else
                    
client_printclientprint_chat"The Event is already Enabled." );
                
#endif
            
}
        }
        else
        {
            
#if defined USE_COLORCHAT
                
ColorChatclientTEAM_COLOR"^4[ %s ] You dont have access to this^4 Command."PLUGIN_TAG );
            
#else
                
client_printclientprint_chat"You dont have access to this Command." );
            
#endif
        
}
    }
    else if ( 
QuestionAsked )
    {
        if ( 
equaliargAnswersRandomAsked ] ) )
        {
            new 
NameSz32 ];
            
            
get_user_nameclientNameSzcharsmaxNameSz ) );
            
            
#if defined USE_COLORCHAT
                
ColorChatclientTEAM_COLOR"^4[ %s ]^3 %s^1 Answered Correct:^4 ''%s''"PLUGIN_TAGNameSzarg );
            
#else
                
client_printclientprint_chat"^4%s Answered Correct: ''%s''^3"NameSzarg );
            
#endif
            
            
QuestionAsked false;
            
            return 
PLUGIN_HANDLED;
        }
    }
    
    return 
PLUGIN_CONTINUE;
}
        
public 
Triviaclient )
{    
    new 
file fopeng_file"rt" );
    new 
data128 ];
    new 
questionMAX_QUESTIONS ];
    new 
answerMAX_QUESTIONS ];
    
    new 
0;
    
    while ( !
feoffile ) )
    {
        
i++;
        
        
fgetsfiledatacharsmaxdata ) );
        
parsedataquestion31answer31 );
        
        
formatexQuestions], charsmaxQuestions ), question );
        
formatexAnswers], charsmaxAnswers ), answer );
        
        
replace_allQuestions], charsmaxQuestions ), "_"" " );
    }
    
    
RandomAsked random_num1);
    
QuestionAsked true;

If you want to change the admin access, so that here
PHP Code:
if ( get_user_flagsclient ) & ADMIN_KICK 

Last edited by Fuck For Fun; 12-16-2013 at 18:46.
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
Reply



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 20:39.


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