Author Topic: I keep getting Syntax errors in my script.  (Read 834 times)

Here is the server.cs file. Ask for description.txt if you need it.
Code: [Select]
functionservercmdfakekillall(%client)
{
    if(!%client.isSuperAdmin)
    {
        %clientBrickCount = %client.brickgroup.getGroup();
        if(%BrickCount > 0)
        {
            for(%i=0;%i<%BrickCount;%i++)
            {
                %Brickgroup = %client.brickgroup;
                %brick = %BrickGroup.getObject(%i);
                %brick.fakekill ("0 0 0", 20)
            }
        }
    }
}

//this is supposed to let a super admin fakekill bricks on a server.

                %brick.fakekill ("0 0 0", 20)
Should be:
                %brick.fakekill("0 0 0", 20);
You had a space in between the method name and the parenthesis and missing a semi-colon at the end.

It also should be %brick.fakeKillBrick not %brick.fakeKill.
You're checking %BrickCount which is always equal to zero, since you haven't defined it.
%clientBrickCount is being set to the brick group containing the client's brick group, or MainBrickGroup, rather than the brick count.
« Last Edit: September 02, 2009, 02:06:31 AM by Space Guy »

btw, I would change the "if(!%client.isSuperAdmin)" to "if(%client.isSuperAdmin)"

Thanks guys. So, it should look like this now:

Code: [Select]
functionservercmdfakekillall(%client)
{
    if(%client.isSuperAdmin)
    {
        %clientBrickCount = %client.brickgroup.getGroup();
        if(%BrickCount > 0)
        {
            for(%i=0;%i<%BrickCount;%i++)
            {
                %Brickgroup = %client.brickgroup;
                %brick = %BrickGroup.getObject(%i);
                %brick.fakeKillBrick("0 0 0", 20);
            }
        }
    }
}

//this is supposed to let a super admin fakekill bricks on a server.

You're checking %BrickCount which is always equal to zero, since you haven't defined it.
%clientBrickCount is being set to the brick group containing the client's brick group, or MainBrickGroup, rather than the brick count.

Code: [Select]
functionservercmdfakekillall(%client)
{
    if(%client.isSuperAdmin)
    {
        %clientBrickCount = %client.brickgroup.getGroup();
        if(%clientBrickCount > 0)
        {
            for(%i=0;%i<%clientBrickCount;%i++)
            {
                %Brickgroup = %client.brickgroup;
                %brick = %BrickGroup.getObject(%i);
                %brick.fakeKillBrick("0 0 0", 20);
            }
        }
    }
}

//this is supposed to let a super admin fakekill bricks on a server.
This is the fixed one^^

I am pretty sure you also wanna do %client.brickgroup.getCount()  as opposed to getGroup().

Also, my console says the script is a nested add-on. What does that mean?

Also, in the add-ons tab, there are two Script_FakeKillAlls. Any help with that?
« Last Edit: September 02, 2009, 10:02:42 AM by BobSevenSevens »

Also, my console says the script is a nested add-on. What does that mean?

Also, in the add-ons tab, there are two Script_FakeKillAlls. Any help with that?
Do you have two FakeKillAll folders?
Or one folder and one zip?

This is the fixed one^^

Not quite:

Code: [Select]
function serverCmdFakeKillAll(%client)
{
// If they are not a super admin, exit out of the function.
if(!%client.isSuperAdmin)
return;

// Loop through each brick in the brickGroup of the client.
%brickGroup = %client.brickGroup;
for(%i = 0; %i < %brickGroup.getCount(); %i++)
{
%brick = %brickGroup.getObject(%i);

// Only fakeKill the brick if it's planted (not ghost bricks)
if(%brick.isPlanted)
%brick.fakeKillBrick("0 0 0",20);
}
}

Do you have two FakeKillAll folders?
Or one folder and one zip?

In my Blockland add-ons folder, I have just the zip, and if you double-click the zip, it shows the server.cs and description.txt.

Edit: thanks, will try tomorrow.
« Last Edit: September 02, 2009, 08:25:40 PM by BobSevenSevens »

In my Bloockland add-ons folder, I have just the zip, and if you double-click the zip, it shows the server.cs and description.txt.

Edit: thanks, will try tomorrow.
lol Sorry Cant Help.