error 030: compound statement not closed at the end of file
#1

Well guys, i need a little help in my Filterscript, that i can't solve anyway.

Well, there is the codes:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/lift1d", true))
    {
 	MoveObject(uss1, -779.39, 3196.35, 9.69, 15000);
}else{

 if(!strcmp(cmdtext, "/lift2d", true))
	{
	MoveObject(uss2, -821.67, 3181.70, 9.89, 15000);
	 	    
}else{

	if(!strcmp(cmdtext, "/lift1u", true))
	{
	MoveObject(uss1, -779.39, 3196.35, 16.80, 15000);
	    }else{

	if(!strcmp(cmdtext, "/lift2u", true))  < This is the line 42
	{
	MoveObject(uss2, -821.67, 3181.70, 17.03, 15000);
    return 0;
}
#endif
Now the error:

Код:
C:\SA-MP\filterscripts\sacarrier.pwn(48) : error 030: compound statement not closed at the end of file (started at line 42)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
I Can't reveal all the code, because it's a surprise to Map Sections
Reply
#2

Your code, properly indented, looks like this:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/lift1d", true))
    {
        MoveObject(uss1, -779.39, 3196.35, 9.69, 15000);
    }
    else
    {
        if(!strcmp(cmdtext, "/lift2d", true))
        {
            MoveObject(uss2, -821.67, 3181.70, 9.89, 15000);
        }
        else
        {
            if(!strcmp(cmdtext, "/lift1u", true))
            {
                MoveObject(uss1, -779.39, 3196.35, 16.80, 15000);
            }
            else
            {
                if(!strcmp(cmdtext, "/lift2u", true))  < This is the line 42
                {
                    MoveObject(uss2, -821.67, 3181.70, 17.03, 15000);
    return 0;
}
Which makes it very clear that you are missing loads of brackets. Not to mention the rather questionable structure of the callback as a whole.
Reply
#3

Well, what i can do?
Reply
#4

Bump?
Reply
#5

add the braces!

https://sampforum.blast.hk/showthread.php?tid=406343
Reply
#6

I'm sorry, but i don't understood, i'm a newbie in pawn, and i need that ready ASAP
Reply
#7

Quote:
Originally Posted by RStyle
Посмотреть сообщение
I'm sorry, but i don't understood, i'm a newbie in pawn, and i need that ready ASAP
read the link in my previous post, along with indentation it briefly explains scope and code-blocks.
Reply
#8

arbit, i swear that i read that a lot of times, but i still not understanding, i don't know what to do next, i really need help here.
Reply
#9

A callback is an 'event'. When something happens, the code between the brackets/braces is executed:

pawn Код:
public OnPlayerSpawn(playerid)
{ // START OF THE CALLBACK.
    // Code between the { and } is executed when a player spawns
} // END OF THE CALLBACK.
This also applies for if() statements etc.:

pawn Код:
if(something)
{
    // do something
}
You need to END the 'compound block' ('piece of code' I guess).

Plus your if-else structure is questionable.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{ // When a player types a command the code from this point will be executed
    if(!strcmp(cmdtext, "/lift1d", true)) // If they typed /lift1d
    { // Start of code that will be executed when typing /lift1d
        MoveObject(uss1, -779.39, 3196.35, 9.69, 15000); // Move the object
    } // End of code that will be executed when typing /lift1d
    else if(!strcmp(cmdtext, "/lift2d", true))
    {
        MoveObject(uss2, -821.67, 3181.70, 9.89, 15000);
    }
    else if(!strcmp(cmdtext, "/lift1u", true))
    {
        MoveObject(uss1, -779.39, 3196.35, 16.80, 15000);
    }
    else if(!strcmp(cmdtext, "/lift2u", true))
    {
        MoveObject(uss2, -821.67, 3181.70, 17.03, 15000);
    }
    return 0;
}
I added comments to the first one for you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)