Author Topic: Syntax Error Help?  (Read 778 times)

Can someone please try to spot out the syntax error in here?

Code: [Select]
package Killstreaks
{
        function gameConnection::onDeath(%client, %killerPlayer, %killer, %damageType, %a)
               
                //Parent everything out.
                Parent::onDeath(%client, %killerPlayer, %killer, %damageType, %a);

                //Kill Streaks
                if(1 == 1)
                {
                        if(%client.kills >= 3)
                        {
                                messageAll('',"\c3"@%killer.name@"\c6 has a \c0ADDICTION TO MURDER\c6!");
                        }
                        %client.kills=0;
                        %killer.kills++;
                        if(%killer.kills == 3)
                        {
                                messageAll('',"\c3"@%killer.name@"\c6 has \c0THREE KILLS IN A ROW\c6!");
                        }
                        else if(%killer.kills == 4)
                        {
                                messageAll('',"\c3"@%killer.name@"\c6 has \c0FOUR KILLS IN A ROW\c6!");
                        }
                        else if(%killer.kills == 5)
                        {
                                messageAll('',"\c3"@%killer.name@"\c6 has \c0FIVE KILLS IN A ROW\c6!");
                        }

Firstly, the function does not have an opening bracket after it is declared.
Secondly,
Code: [Select]
if(1 == 1)

What
Why do you need to check if 1 is equal to 1? Remove that.
« Last Edit: February 17, 2013, 08:35:34 PM by Electrk »

Firstly, the function does not have an opening bracket after it is declared.
Secondly,
Code: [Select]
if(1 == 1)

What
Why do you need to check if 1 is equal to 1?

Thirdly, there is no closing bracket for if(1 == 1) or the function or the package.

I understand 3, this isnt the full code, the syntax error says its somewhere in line 17...

You are missing a { bracket after the function is declared.

I understand 3, this isnt the full code, the syntax error says its somewhere in line 17...

There's no opening bracket for the function.

You are missing a { bracket after the function is declared.

Where would i place that.

function gameConnection::onDeath(%client, %killerPlayer, %killer, %damageType, %a)
{

Where would i place that.
You know what, forget it, I'm just going to spoonfeed you because I can't take anymore of this stuff, lol.

Code: [Select]
package Killstreaks
{
        function gameConnection::onDeath(%client, %killerPlayer, %killer, %damageType, %a)
        { //THIS IS AN OPENING BRACKET, YOU FORGOT THIS
                //Parent everything out.
                Parent::onDeath(%client, %killerPlayer, %killer, %damageType, %a);

                //Kill Streaks
                if(1 == 1)//YOU SHOULD REMOVE THIS CONDITION BECAUSE IT'S LITERALLY USELESS
                {
                        if(%client.kills >= 3)
                        {
                                messageAll('',"\c3"@%killer.name@"\c6 has a \c0ADDICTION TO MURDER\c6!");
                        }
                        %client.kills=0;
                        %killer.kills++;
                        if(%killer.kills == 3)
                        {
                                messageAll('',"\c3"@%killer.name@"\c6 has \c0THREE KILLS IN A ROW\c6!");
                        }
                        else if(%killer.kills == 4)
                        {
                                messageAll('',"\c3"@%killer.name@"\c6 has \c0FOUR KILLS IN A ROW\c6!");
                        }
                        else if(%killer.kills == 5)
                        {
                                messageAll('',"\c3"@%killer.name@"\c6 has \c0FIVE KILLS IN A ROW\c6!");
                        }
               }//THIS IS A CLOSING BRACKET, YOU FORGOT THIS TOO
       }//THIS IS AN CLOSING BRACKET, YOU FORGOT THIS ASWELL
};//THIS IS A CLOSING BRACKET, YOU ALSO FORGOT THIS ONE!
activatePackage("Killstreaks");

Also, for the love of god can you remove the useless conditional statement on line nine? It doesn't make your code complex.
« Last Edit: February 17, 2013, 08:55:19 PM by Eepos2 »


You know what, forget it, I'm just going to spoonfeed you because I can't take anymore of this stuff, lol.

Code: [Select]
package Killstreaks
{
        function gameConnection::onDeath(%client, %killerPlayer, %killer, %damageType, %a)
        { //THIS IS AN OPENING BRACKET, YOU FORGOT THIS
                //Parent everything out.
                Parent::onDeath(%client, %killerPlayer, %killer, %damageType, %a);

                //Kill Streaks
                if(1 == 1)//YOU SHOULD REMOVE THIS CONDITION BECAUSE IT'S LITERALLY USELESS
                {
                        if(%client.kills >= 3)
                        {
                                messageAll('',"\c3"@%killer.name@"\c6 has a \c0ADDICTION TO MURDER\c6!");
                        }
                        %client.kills=0;
                        %killer.kills++;
                        if(%killer.kills == 3)
                        {
                                messageAll('',"\c3"@%killer.name@"\c6 has \c0THREE KILLS IN A ROW\c6!");
                        }
                        else if(%killer.kills == 4)
                        {
                                messageAll('',"\c3"@%killer.name@"\c6 has \c0FOUR KILLS IN A ROW\c6!");
                        }
                        else if(%killer.kills == 5)
                        {
                                messageAll('',"\c3"@%killer.name@"\c6 has \c0FIVE KILLS IN A ROW\c6!");
                        }
               }//THIS IS A CLOSING BRACKET, YOU FORGOT THIS TOO
       }//THIS IS AN CLOSING BRACKET, YOU FORGOT THIS ASWELL
};//THIS IS A CLOSING BRACKET, YOU ALSO FORGOT THIS ONE!
activatePackage("Killstreaks");

Also, for the love of god can you remove the useless conditional statement on line nine? It doesn't make your code complex.



I have this
Code: [Select]
}//THIS IS A CLOSING BRACKET, YOU FORGOT THIS TOO
       }//THIS IS AN CLOSING BRACKET, YOU FORGOT THIS ASWELL
};//THIS IS A CLOSING BRACKET, YOU ALSO FORGOT THIS ONE!
activatePackage("Killstreaks");


Its useless to show because the syntax error said the error was on one of the beginning lines

Its useless to show because the syntax error said the error was on one of the beginning lines
Then why didn't you state so in your first post?



I have this
Code: [Select]
}//THIS IS A CLOSING BRACKET, YOU FORGOT THIS TOO
       }//THIS IS AN CLOSING BRACKET, YOU FORGOT THIS ASWELL
};//THIS IS A CLOSING BRACKET, YOU ALSO FORGOT THIS ONE!
activatePackage("Killstreaks");


Its useless to show because the syntax error said the error was on one of the beginning lines

Ok, remove them then, see what happens.