Author Topic: What am I doing wrong?  (Read 2664 times)

It seems fine, has all the functions worked out, and I thought I finally had it fixed.

Why wont it work?
RTB_registerPref("Restriction Level","ClearGhostBricks","OAA::AdminLevel","list Admin 1 SuperAdmin 2","Server_Clearghostbricks",1,0,0);
function serverCmdClearGhostBricks(%client)
{
if(
    (!%client.isAdmin
    && $OAA::AdminLevel == 1)
    ||
    (!%client.isSuperAdmin
    && $OAA::AdminLevel == 2)
) {
    messageClient(%client, ''<color:00ffff>Server<color:ffffff>: You don't have permission to clear ghost bricks.'');

    return;
}
for(%i = 0; %i < %count; %i++)
   {
      serverCmdCancelBrick(clientGroup.getObject(%i));
   }
}

Because in your for loops, you don't have %count defined, so it runs the loop through literally nothing. Try either putting the actual .getCount() of the client group in the for loop, or defining %count as the clientGroup's count.

If I read correctly (Since im new to this) you said to do this?

}
for(%i = 0; %i < %getCount(); %i++)
   {
      serverCmdCancelBrick(clientGroup.getObject(%i));
   }
}

Doing %getCount(); won't return any value at all like that. With the way you're doing it you need to define %count as the amount of players in the server.

Doing %getCount(); won't return any value at all like that. With the way you're doing it you need to define %count as the amount of players in the server.
Yes. You have to define %count as ClientGroup.getCount();.

um

{
if(
    (!%client.isAdmin
    && $OAA::AdminLevel == 1)
    ||
    (!%client.isSuperAdmin
    && $OAA::AdminLevel == 2)
) {
    messageClient(%client, ''<color:00ffff>Server<color:ffffff>: You don't have permission to clear ghost bricks.'');

    return;
}
for(%i = 0; %i < %clientGroup.getObject; %i++)
   {
      serverCmdCancelBrick(clientGroup.getObject(%i));
   }
}

?


um

{
if(
    (!%client.isAdmin
    && $OAA::AdminLevel == 1)
    ||
    (!%client.isSuperAdmin
    && $OAA::AdminLevel == 2)
) {
    messageClient(%client, ''<color:00ffff>Server<color:ffffff>: You don't have permission to clear ghost bricks.'');

    return;
}
for(%i = 0; %i < %clientGroup.getObject; %i++)
   {
      serverCmdCancelBrick(clientGroup.getObject(%i));
   }
}

?


No.
Yes. You have to define %count as ClientGroup.getCount();.
Define, as in describing the value of. So defining %count as Clientgroup.getCount(); would be %count = ClientGroup.getCount();.

RTB_registerPref("Restriction Level","ClearGhostBricks","OAA::AdminLevel","list Admin 1 SuperAdmin 2","Server_Clearghostbricks",1,0,0);
function serverCmdClearGhostBricks(%client)
{
if(
    (!%client.isAdmin
    && $OAA::AdminLevel == 1)
    ||
    (!%client.isSuperAdmin
    && $OAA::AdminLevel == 2)
) {
    messageClient(%client, ''<color:00ffff>Server<color:ffffff>: You don't have permission to clear ghost bricks.'');

    return;
}
for(%i = 0; %i < %count = ClientGroup.getCount(); %i++)
   {
      serverCmdCancelBrick(clientGroup.getObject(%i));
   }
}


I thought this was right but apparently not.


for (%i = 0; %i < ClientGroup.getCount(); %i++)
{
   %clients = ClientGroup.getObject(%i);
   if(%clients.player.tempbrick)
   {
      %clients.player.tempbrick.delete();
   }
}

I'm pretty sure you also had a typo in your messageclient

Code: [Select]
messageClient(%client, '' , "<color:00ffff>Server<color:ffffff>: You don't have permission to clear ghost bricks.'');
That's how it's supposed to be

I'm pretty sure you also had a typo in your messageclient

Code: [Select]
messageClient(%client, '' , "<color:00ffff>Server<color:ffffff>: You don't have permission to clear ghost bricks.'');
That's how it's supposed to be
You can also use the escape sequences for the colors, like \c6 for white.
messageClient(%client, '', "\c6Hello!");

Code: [Select]
messageClient(%client, '' , "<color:00ffff>Server<color:ffffff>: You don't have permission to clear ghost bricks.");
Fixed your fix for ya. You had
Code: [Select]
''In there instead of
Code: [Select]
"at the end.
I put it in code blocks so it's easier to see the difference.

RTB_registerPref("Restriction Level","ClearGhostBricks","OAA::AdminLevel","list Admin 1 SuperAdmin 2","Server_Clearghostbricks",1,0,0);
function serverCmdClearGhostBricks(%client)
{
if(
    (!%client.isAdmin
    && $OAA::AdminLevel == 1)
    ||
    (!%client.isSuperAdmin
    && $OAA::AdminLevel == 2)
) {
    messageClient(%client, '' , "<color:00ffff>Server<color:ffffff>: You don't have permission to clear ghost bricks.");

    return;
}
for (%i = 0; %i < ClientGroup.getCount(); %i++)
{
   %clients = ClientGroup.getObject(%i);
   if(%clients.player.tempbrick)
   {
      %clients.player.tempbrick.delete();
   }
}


Seems like it is right but doesnt work.

quote from console

Loading Add-On: Server_ClearGhostBricks (CRC:1972222884)
Add-Ons/Server_ClearGhostBricks/server.cs Line: 22 - Syntax error.
>>> Some error context, with ## on sides of error halt:
    messageClient(%client, '' , "<color:00ffff>Server<color:ffffff>: You don't have permission to clear ghost bricks.");

    return;

}

for (%i = 0; %i < ClientGroup.getCount(); %i++)

{

   %clients = ClientGroup.getObject(%i);

   if(%clients.player.tempbrick)

   {

      %clients.player.tempbrick.delete();

   }

}

##
>>> Error report complete.

ADD-ON "Server_ClearGhostBricks" CONTAINS SYNTAX ERRORS
« Last Edit: September 06, 2014, 10:22:21 PM by Ducky duck »

You're not closing the function, you need a }