Author Topic: Ending a script?  (Read 694 times)

Ok so I have a script and I tested it but it doesn't work. Sense all the code is correct I think I might have ended it wrong.

There's 5 different lines of code that end with the {. Then I closed it like this:
Code: [Select]
                                                    }
                                          }
                                }
                      }
            };

Did I do it wrong?

EDIT: I know my spacing is perfect, TAB doesn't work here.
« Last Edit: October 07, 2011, 06:55:56 PM by BlockStar »


Post the whole code

Here, Also don't ask about it, I was board.

Code: [Select]
function serverCmdTalkas(%client, %player,  %var1, %var2, %var3, %var4, %var5, %var6, %var7, %var8, %var9, %var10, %var11, %var12, %var13, %var14, %var15, %var16, %var17, %var18, %var19, %var20)
{
for(%a = 1; %a < 21; %a++)
{
if(%var[%a] !$= "")
{
%words = %words SPC %var[%a];
{
if(%client.isSuperAdmin)
{
messageAll(","\c3" @ %player @ "\c6: @ %words @");
}
else
{
messageClient(%client, '', "\c6You must be a super admin to use this command.");
}
}
}
}
};

Functions don't end with ;

You also have random brackets after '%words = %words SPC %var[%a];' and having the messageAll/Client inside the for loop will spam the chat with 20 messages

Code: [Select]
function serverCmdTalkas(%client, %player,  %var1, %var2, %var3, %var4, %var5, %var6, %var7, %var8, %var9, %var10, %var11, %var12, %var13, %var14, %var15, %var16, %var17, %var18, %var19, %var20)
{
for(%a = 1; %a < 21; %a++)
{
if(%var[%a] !$= "")
{
%words = %words SPC %var[%a];
}
}

if(%client.isSuperAdmin)
{
messageAll(","\c3" @ %player @ "\c6: @ %words @");
}
else
{
messageClient(%client, '', "\c6You must be a super admin to use this command.");
}
}
« Last Edit: October 08, 2011, 02:11:41 AM by Headcrab Zombie »

Functions don't end with ;

You also have random brackets after '%words = %words SPC %var[%a];' and having the messageAll/Client inside the for loop will spam the chat with 20 messages

-snip-
That will work then right?

It should. But I'd replace
Code: [Select]
for(%a = 1; %a < 21; %a++)
{
if(%var[%a] !$= "")
{
%words = %words SPC %var[%a];
}
}

with
Code: [Select]
%words = trim(%var1 SPC %var2 SPC %var3 SPC %var4 SPC %var5 SPC %var6 SPC %var7 SPC %var8 SPC %var9 SPC %var10 SPC %var11 SPC %var12 SPC %var13 SPC %var14 SPC %var15 SPC %var16 SPC %var17 SPC %var18 SPC %var19 SPC %var20);
You don't have to, that's just how I like to do it.