symbol already defined: "SendClientMessage"????
#1

hey guys i was making some commands for my server i tried to compile it and i get this.

Код:
C:\Documents and Settings\Administrator\Desktop\gta sa server\gamemodes\DDPDRIFT.pwn(3789) : error 010: invalid function or declaration
C:\Documents and Settings\Administrator\Desktop\gta sa server\gamemodes\DDPDRIFT.pwn(3791) : error 021: symbol already defined: "SendClientMessage"
C:\Documents and Settings\Administrator\Desktop\gta sa server\gamemodes\DDPDRIFT.pwn(3796) : error 010: invalid function or declaration
C:\Documents and Settings\Administrator\Desktop\gta sa server\gamemodes\DDPDRIFT.pwn(3798) : error 021: symbol already defined: "SendClientMessage"
C:\Documents and Settings\Administrator\Desktop\gta sa server\gamemodes\DDPDRIFT.pwn(3804) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
and this is what im trying to do.

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(strcmp("/rules", cmdtext, true, 10) == 0)

	SendClientMessage(playerid, COLOR_GREEN, "=================The Laws of The Land==================");
	SendClientMessage(playerid, COLOR_WHITE, "1.No Death Matching");
	SendClientMessage(playerid, COLOR_WHITE, "2.Car Jacking is not allowed");
	SendClientMessage(playerid, COLOR_WHITE, "3.Do not disrespect other players.");
	SendClientMessage(playerid, COLOR_WHITE, "4.Do not spam or else you'll be muted/kicked!");
	SendClientMessage(playerid, COLOR_WHITE, "5.Hacks are not allowed here, except handling lines, BUT DRIFT ONLY!");
	SendClientMessage(playerid, COLOR_WHITE, "6.Respect the other players, and admins too.");
	SendClientMessage(playerid, COLOR_WHITE, "7.Please follow all the rules and have fun! :)");
	SendClientMessage(playerid, COLOR_GREEN, "=================The Laws of The Land==================");
}
	if(strcmp("/help", cmdtext, true, 10) == 0)
	
	SendClientMessage(playerid, COLOR_GREEN, "====================Drift World==================");
	SendClientMessage(playerid, COLOR_WHITE, "/teles /report /rules");
	SendClientMessage(playerid, COLOR_WHITE, "Yeah thats basically it.");
	SendClientMessage(playerid, COLOR_GREEN, "====================Drift World==================");
}
    if(strcmp("/teles", cmdtext, true, 10) == 0)

	SendClientMessage(playerid, COLOR_GREEN, "==============Drift World Telelports=============");
	SendClientMessage(playerid, COLOR_WHITE, "/spawn /drift /drift2 /drift3 /drift4 /drift5 /drift6");
	SendClientMessage(playerid, COLOR_WHITE, "/drift7 /drift8 /drift9 /tune /tune2 /SFAdrift       ");
 	SendClientMessage(playerid, COLOR_WHITE, "/drifttrack1 /driftcanyon                            ");
  	SendClientMessage(playerid, COLOR_GREEN, "==============Drift World Telelports=================");

	return 1;
}
Does anyone have any ideas?
Reply
#2

Quote:
Originally Posted by xXitsgodzillaXx
Посмотреть сообщение
hey guys i was making some commands for my server i tried to compile it and i get this.

Код:
C:\Documents and Settings\Administrator\Desktop\gta sa server\gamemodes\DDPDRIFT.pwn(3789) : error 010: invalid function or declaration
C:\Documents and Settings\Administrator\Desktop\gta sa server\gamemodes\DDPDRIFT.pwn(3791) : error 021: symbol already defined: "SendClientMessage"
C:\Documents and Settings\Administrator\Desktop\gta sa server\gamemodes\DDPDRIFT.pwn(3796) : error 010: invalid function or declaration
C:\Documents and Settings\Administrator\Desktop\gta sa server\gamemodes\DDPDRIFT.pwn(3798) : error 021: symbol already defined: "SendClientMessage"
C:\Documents and Settings\Administrator\Desktop\gta sa server\gamemodes\DDPDRIFT.pwn(3804) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
and this is what im trying to do.

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(strcmp("/rules", cmdtext, true, 10) == 0)

	SendClientMessage(playerid, COLOR_GREEN, "=================The Laws of The Land==================");
	SendClientMessage(playerid, COLOR_WHITE, "1.No Death Matching");
	SendClientMessage(playerid, COLOR_WHITE, "2.Car Jacking is not allowed");
	SendClientMessage(playerid, COLOR_WHITE, "3.Do not disrespect other players.");
	SendClientMessage(playerid, COLOR_WHITE, "4.Do not spam or else you'll be muted/kicked!");
	SendClientMessage(playerid, COLOR_WHITE, "5.Hacks are not allowed here, except handling lines, BUT DRIFT ONLY!");
	SendClientMessage(playerid, COLOR_WHITE, "6.Respect the other players, and admins too.");
	SendClientMessage(playerid, COLOR_WHITE, "7.Please follow all the rules and have fun! :)");
	SendClientMessage(playerid, COLOR_GREEN, "=================The Laws of The Land==================");
}
	if(strcmp("/help", cmdtext, true, 10) == 0)
	
	SendClientMessage(playerid, COLOR_GREEN, "====================Drift World==================");
	SendClientMessage(playerid, COLOR_WHITE, "/teles /report /rules");
	SendClientMessage(playerid, COLOR_WHITE, "Yeah thats basically it.");
	SendClientMessage(playerid, COLOR_GREEN, "====================Drift World==================");
}
    if(strcmp("/teles", cmdtext, true, 10) == 0)

	SendClientMessage(playerid, COLOR_GREEN, "==============Drift World Telelports=============");
	SendClientMessage(playerid, COLOR_WHITE, "/spawn /drift /drift2 /drift3 /drift4 /drift5 /drift6");
	SendClientMessage(playerid, COLOR_WHITE, "/drift7 /drift8 /drift9 /tune /tune2 /SFAdrift       ");
 	SendClientMessage(playerid, COLOR_WHITE, "/drifttrack1 /driftcanyon                            ");
  	SendClientMessage(playerid, COLOR_GREEN, "==============Drift World Telelports=================");

	return 1;
}
Does anyone have any ideas?
Which are the lines 3789 to 3804?
Reply
#3

Quote:
Originally Posted by Faisal_khan
Посмотреть сообщение
Which are the lines 3789 to 3804?
okay i narrowed it down to just error "010: invalid function or declaration" i forgot to add the "{". and lines 3789 to 3804 are at "if(strcmp("/help", cmdtext, true, 10) == 0)" and end at "return 1;"
Reply
#4

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/rules", cmdtext, true, 10) == 0)
    {
    SendClientMessage(playerid, COLOR_GREEN, "=================The Laws of The Land==================");
    SendClientMessage(playerid, COLOR_WHITE, "1.No Death Matching");
    SendClientMessage(playerid, COLOR_WHITE, "2.Car Jacking is not allowed");
    SendClientMessage(playerid, COLOR_WHITE, "3.Do not disrespect other players.");
    SendClientMessage(playerid, COLOR_WHITE, "4.Do not spam or else you'll be muted/kicked!");
    SendClientMessage(playerid, COLOR_WHITE, "5.Hacks are not allowed here, except handling lines, BUT DRIFT ONLY!");
    SendClientMessage(playerid, COLOR_WHITE, "6.Respect the other players, and admins too.");
    SendClientMessage(playerid, COLOR_WHITE, "7.Please follow all the rules and have fun! :)");
    SendClientMessage(playerid, COLOR_GREEN, "=================The Laws of The Land==================");
    return 1;
    }
}
    if(strcmp("/help", cmdtext, true, 10) == 0)
    {
    SendClientMessage(playerid, COLOR_GREEN, "====================Drift World==================");
    SendClientMessage(playerid, COLOR_WHITE, "/teles /report /rules");
    SendClientMessage(playerid, COLOR_WHITE, "Yeah thats basically it.");
    SendClientMessage(playerid, COLOR_GREEN, "====================Drift World==================");
    return 1;
    }
}
    if(strcmp("/teles", cmdtext, true, 10) == 0)
    {
    SendClientMessage(playerid, COLOR_GREEN, "==============Drift World Telelports=============");
    SendClientMessage(playerid, COLOR_WHITE, "/spawn /drift /drift2 /drift3 /drift4 /drift5 /drift6");
    SendClientMessage(playerid, COLOR_WHITE, "/drift7 /drift8 /drift9 /tune /tune2 /SFAdrift       ");
    SendClientMessage(playerid, COLOR_WHITE, "/drifttrack1 /driftcanyon                            ");
    SendClientMessage(playerid, COLOR_GREEN, "==============Drift World Telelports=================");
    return 1;
    }
    return 0;
}
Try this and dont forget to + rep if i helped you!

BEST OF LUCK!
Reply
#5

pawn Код:
public OnPlayerCommandText( playerid, cmdtext[ ] )
{
    if( strcmp( "/rules", cmdtext, true, 6 ) == 0 )
    {
        SendClientMessage( playerid, COLOR_GREEN, "=================The Laws of The Land==================" );
        SendClientMessage( playerid, COLOR_WHITE, "1.No Death Matching" );
        SendClientMessage( playerid, COLOR_WHITE, "2.Car Jacking is not allowed" );
        SendClientMessage( playerid, COLOR_WHITE, "3.Do not disrespect other players." );
        SendClientMessage( playerid, COLOR_WHITE, "4.Do not spam or else you'll be muted/kicked!" );
        SendClientMessage( playerid, COLOR_WHITE, "5.Hacks are not allowed here, except handling lines, BUT DRIFT ONLY!" );
        SendClientMessage( playerid, COLOR_WHITE, "6.Respect the other players, and admins too." );
        SendClientMessage( playerid, COLOR_WHITE, "7.Please follow all the rules and have fun! :)" );
        SendClientMessage( playerid, COLOR_GREEN, "=================The Laws of The Land==================" );
        return 1;
    }
    if( strcmp( "/help", cmdtext, true, 5 ) == 0 )
    {
        SendClientMessage( playerid, COLOR_GREEN, "====================Drift World==================" );
        SendClientMessage( playerid, COLOR_WHITE, "/teles /report /rules" );
        SendClientMessage( playerid, COLOR_WHITE, "Yeah thats basically it." );
        SendClientMessage( playerid, COLOR_GREEN, "====================Drift World==================" );
        return 1;
    }
    if(strcmp( "/teles", cmdtext, true, 6 ) == 0 )
    {
        SendClientMessage( playerid, COLOR_GREEN, "==============Drift World Telelports=============" );
        SendClientMessage( playerid, COLOR_WHITE, "/spawn /drift /drift2 /drift3 /drift4 /drift5 /drift6" );
        SendClientMessage( playerid, COLOR_WHITE, "/drift7 /drift8 /drift9 /tune /tune2 /SFAdrift       " );
        SendClientMessage( playerid, COLOR_WHITE, "/drifttrack1 /driftcanyon                            " );
        SendClientMessage( playerid, COLOR_GREEN, "==============Drift World Telelports=================" );
        return 1;
    }
    return 0;
}
Quote:
Originally Posted by Faisal_khan
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/rules", cmdtext, true, 10) == 0)
    {
    SendClientMessage(playerid, COLOR_GREEN, "=================The Laws of The Land==================");
    SendClientMessage(playerid, COLOR_WHITE, "1.No Death Matching");
    SendClientMessage(playerid, COLOR_WHITE, "2.Car Jacking is not allowed");
    SendClientMessage(playerid, COLOR_WHITE, "3.Do not disrespect other players.");
    SendClientMessage(playerid, COLOR_WHITE, "4.Do not spam or else you'll be muted/kicked!");
    SendClientMessage(playerid, COLOR_WHITE, "5.Hacks are not allowed here, except handling lines, BUT DRIFT ONLY!");
    SendClientMessage(playerid, COLOR_WHITE, "6.Respect the other players, and admins too.");
    SendClientMessage(playerid, COLOR_WHITE, "7.Please follow all the rules and have fun! :)");
    SendClientMessage(playerid, COLOR_GREEN, "=================The Laws of The Land==================");
    return 1;
    }
}
    if(strcmp("/help", cmdtext, true, 10) == 0)
    {
    SendClientMessage(playerid, COLOR_GREEN, "====================Drift World==================");
    SendClientMessage(playerid, COLOR_WHITE, "/teles /report /rules");
    SendClientMessage(playerid, COLOR_WHITE, "Yeah thats basically it.");
    SendClientMessage(playerid, COLOR_GREEN, "====================Drift World==================");
    return 1;
    }
}
    if(strcmp("/teles", cmdtext, true, 10) == 0)
    {
    SendClientMessage(playerid, COLOR_GREEN, "==============Drift World Telelports=============");
    SendClientMessage(playerid, COLOR_WHITE, "/spawn /drift /drift2 /drift3 /drift4 /drift5 /drift6");
    SendClientMessage(playerid, COLOR_WHITE, "/drift7 /drift8 /drift9 /tune /tune2 /SFAdrift       ");
    SendClientMessage(playerid, COLOR_WHITE, "/drifttrack1 /driftcanyon                            ");
    SendClientMessage(playerid, COLOR_GREEN, "==============Drift World Telelports=================");
    return 1;
    }
    return 0;
}
Try this and dont forget to + rep if i helped you!

BEST OF LUCK!
Let's start!
First of all, you closed more bracket than those you opened. Also, the lenght is totally wrong.

Quote:
Originally Posted by Amit_B
Посмотреть сообщение
@Faisal_khan: I can't see any point of asking for lines of code which its errors are prominent more than the code itself.

And for the solution:
You've forgot(?) to use some { or } in the code, which cause it to be out of OnPlayerCommandText, while you can't insert such code out of function. Try to find your mistakes in the correct code:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/rules", cmdtext, true, 10) == 0)
    {
    SendClientMessage(playerid, COLOR_GREEN, "=================The Laws of The Land==================");
    SendClientMessage(playerid, COLOR_WHITE, "1.No Death Matching");
    SendClientMessage(playerid, COLOR_WHITE, "2.Car Jacking is not allowed");
    SendClientMessage(playerid, COLOR_WHITE, "3.Do not disrespect other players.");
    SendClientMessage(playerid, COLOR_WHITE, "4.Do not spam or else you'll be muted/kicked!");
    SendClientMessage(playerid, COLOR_WHITE, "5.Hacks are not allowed here, except handling lines, BUT DRIFT ONLY!");
    SendClientMessage(playerid, COLOR_WHITE, "6.Respect the other players, and admins too.");
    SendClientMessage(playerid, COLOR_WHITE, "7.Please follow all the rules and have fun! :)");
    SendClientMessage(playerid, COLOR_GREEN, "=================The Laws of The Land==================");
    return 1;
}
    if(strcmp("/help", cmdtext, true, 10) == 0)
    {
    SendClientMessage(playerid, COLOR_GREEN, "====================Drift World==================");
    SendClientMessage(playerid, COLOR_WHITE, "/teles /report /rules");
    SendClientMessage(playerid, COLOR_WHITE, "Yeah thats basically it.");
    SendClientMessage(playerid, COLOR_GREEN, "====================Drift World==================");
    return 1;
}
    if(strcmp("/teles", cmdtext, true, 10) == 0)
    {
    SendClientMessage(playerid, COLOR_GREEN, "==============Drift World Telelports=============");
    SendClientMessage(playerid, COLOR_WHITE, "/spawn /drift /drift2 /drift3 /drift4 /drift5 /drift6");
    SendClientMessage(playerid, COLOR_WHITE, "/drift7 /drift8 /drift9 /tune /tune2 /SFAdrift       ");
    SendClientMessage(playerid, COLOR_WHITE, "/drifttrack1 /driftcanyon                            ");
    SendClientMessage(playerid, COLOR_GREEN, "==============Drift World Telelports=================");

    return 1;
}
return 0;
}
make sure that this part:
pawn Код:
return 0;
}
is the end of OnPlayerCommandText (already written in the correct code).
Oh, Great!
Onother one person who doesn't know how to count how many characters a command has.

The lenght is optional, so it's better not use it.
Reply
#6

Quote:
Originally Posted by xXitsgodzillaXx
Посмотреть сообщение
okay i narrowed it down to just error "010: invalid function or declaration" i forgot to add the "{". and lines 3789 to 3804 are at "if(strcmp("/help", cmdtext, true, 10) == 0)" and end at "return 1;"
Post the code.
Reply
#7

@Faisal_khan: I can't see any point of asking for lines of code which its errors are prominent more than the code itself.

And for the solution:
You've forgot(?) to use some { or } in the code, which cause it to be out of OnPlayerCommandText, while you can't insert such code out of function. Try to find your mistakes in the correct code:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/rules", cmdtext, true, 10) == 0)
    {
    SendClientMessage(playerid, COLOR_GREEN, "=================The Laws of The Land==================");
    SendClientMessage(playerid, COLOR_WHITE, "1.No Death Matching");
    SendClientMessage(playerid, COLOR_WHITE, "2.Car Jacking is not allowed");
    SendClientMessage(playerid, COLOR_WHITE, "3.Do not disrespect other players.");
    SendClientMessage(playerid, COLOR_WHITE, "4.Do not spam or else you'll be muted/kicked!");
    SendClientMessage(playerid, COLOR_WHITE, "5.Hacks are not allowed here, except handling lines, BUT DRIFT ONLY!");
    SendClientMessage(playerid, COLOR_WHITE, "6.Respect the other players, and admins too.");
    SendClientMessage(playerid, COLOR_WHITE, "7.Please follow all the rules and have fun! :)");
    SendClientMessage(playerid, COLOR_GREEN, "=================The Laws of The Land==================");
    return 1;
}
    if(strcmp("/help", cmdtext, true, 10) == 0)
    {
    SendClientMessage(playerid, COLOR_GREEN, "====================Drift World==================");
    SendClientMessage(playerid, COLOR_WHITE, "/teles /report /rules");
    SendClientMessage(playerid, COLOR_WHITE, "Yeah thats basically it.");
    SendClientMessage(playerid, COLOR_GREEN, "====================Drift World==================");
    return 1;
}
    if(strcmp("/teles", cmdtext, true, 10) == 0)
    {
    SendClientMessage(playerid, COLOR_GREEN, "==============Drift World Telelports=============");
    SendClientMessage(playerid, COLOR_WHITE, "/spawn /drift /drift2 /drift3 /drift4 /drift5 /drift6");
    SendClientMessage(playerid, COLOR_WHITE, "/drift7 /drift8 /drift9 /tune /tune2 /SFAdrift       ");
    SendClientMessage(playerid, COLOR_WHITE, "/drifttrack1 /driftcanyon                            ");
    SendClientMessage(playerid, COLOR_GREEN, "==============Drift World Telelports=================");

    return 1;
}
return 0;
}
make sure that this part:
pawn Код:
return 0;
}
is the end of OnPlayerCommandText (already written in the correct code).


Modify:
Sorry, the replying speed of users here is really fast. Dwane's code will work.
Reply
#8

Quote:
Originally Posted by Amit_B
Посмотреть сообщение
@Faisal_khan: I can't see any point of asking for lines of code which its errors are prominent more than the code itself.
Yo man i was asking him about the second error he got after my post. I wanted to know on which line he got the error.
Reply
#9

Quote:
Originally Posted by Dwane
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText( playerid, cmdtext[ ] )
{
    if( strcmp( "/rules", cmdtext, true, 6 ) == 0 )
    {
        SendClientMessage( playerid, COLOR_GREEN, "=================The Laws of The Land==================" );
        SendClientMessage( playerid, COLOR_WHITE, "1.No Death Matching" );
        SendClientMessage( playerid, COLOR_WHITE, "2.Car Jacking is not allowed" );
        SendClientMessage( playerid, COLOR_WHITE, "3.Do not disrespect other players." );
        SendClientMessage( playerid, COLOR_WHITE, "4.Do not spam or else you'll be muted/kicked!" );
        SendClientMessage( playerid, COLOR_WHITE, "5.Hacks are not allowed here, except handling lines, BUT DRIFT ONLY!" );
        SendClientMessage( playerid, COLOR_WHITE, "6.Respect the other players, and admins too." );
        SendClientMessage( playerid, COLOR_WHITE, "7.Please follow all the rules and have fun! :)" );
        SendClientMessage( playerid, COLOR_GREEN, "=================The Laws of The Land==================" );
        return 1;
    }
    if( strcmp( "/help", cmdtext, true, 5 ) == 0 )
    {
        SendClientMessage( playerid, COLOR_GREEN, "====================Drift World==================" );
        SendClientMessage( playerid, COLOR_WHITE, "/teles /report /rules" );
        SendClientMessage( playerid, COLOR_WHITE, "Yeah thats basically it." );
        SendClientMessage( playerid, COLOR_GREEN, "====================Drift World==================" );
        return 1;
    }
    if(strcmp( "/teles", cmdtext, true, 6 ) == 0 )
    {
        SendClientMessage( playerid, COLOR_GREEN, "==============Drift World Telelports=============" );
        SendClientMessage( playerid, COLOR_WHITE, "/spawn /drift /drift2 /drift3 /drift4 /drift5 /drift6" );
        SendClientMessage( playerid, COLOR_WHITE, "/drift7 /drift8 /drift9 /tune /tune2 /SFAdrift       " );
        SendClientMessage( playerid, COLOR_WHITE, "/drifttrack1 /driftcanyon                            " );
        SendClientMessage( playerid, COLOR_GREEN, "==============Drift World Telelports=================" );
        return 1;
    }
    return 0;
}

Let's start!
First of all, you closed more bracket than those you opened. Also, the lenght is totally wrong.


Oh, Great!
Onother one person who doesn't know how to count how many characters a command has.

The lenght is optionalm, so it's better not use it.
Oh lol sorry i forgot it. but anyway thnx for editing.
Reply
#10

okay i fixed it all lol. and also @dwayne you should try to be more polite. so what? a person makes a mistake. ITS NORMAL. and also thanks for the help guys!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)