Author Topic: Restricting Baseplates to Admin Script?  (Read 1579 times)

I tried making one but I got an error stating this:
Code: [Select]
Add-Ons/RP_RealEstate/bricks.cs Line: 50 - Syntax error.
>>> Some error context, with ## on sides of error halt:
^^if (%brick.getDatablock().getID() == brick64x64FData.getID() &&!%client.isAdmin)

^^{

^^^commandToClient(%client, 'centerPrint', "<color:ffffff>You must be an <color:ff0000>admin<color:ffffff> to plant this brick.", 3);

^^^

^^^%brick.schedule(0, "delete");

^^}

};##
##
RPRegPackage(RP_RealEstate_Bricks);
>>> Error report complete.

I'm thinking it has something to do with the == and the && being in the same statement.

send the whole script please, that console data isn't really getting me anywhere

You're missing a } before the package close.
send the whole script please, that console data isn't really getting me anywhere
note the closing if statement then ending package. - no closing function!

Didn't scratch try and fail to do this? Seems like a useless mod to me

You're missing a } before the package close.note the closing if statement then ending package.
yeah i only just saw that a minute before you posted, i got my coffee instead of changing that message shh

Code: [Select]
f (isPackage(RP_RealEstate_Bricks))
deactivatePackage(RP_RealEstate_Bricks);

package RP_RealEstate_Bricks
{
// RP Plant Brick
function fxDTSBrick::PlantBrick(%brick)
{
Parent::PlantBrick(%brick);

if (!isObject(%brick))
return;

%brickGroup = getBrickGroupFromObject(%brick);
%client = %brickGroup.client;
%datablock = %brick.getDatablock();

//Baseplates for Admins only
if (%brick.getDatablock().getID() == brick16x16FData.getID() &&!%client.isAdmin)
{
commandToClient(%client, 'centerPrint', "<color:ffffff>You must be an <color:ff0000>admin<color:ffffff> to plant this brick.", 3);

%brick.schedule(0, "delete");
}

if (%brick.getDatablock().getID() == brick16x32FData.getID() &&!%client.isAdmin)
{
commandToClient(%client, 'centerPrint', "<color:ffffff>You must be an <color:ff0000>admin<color:ffffff> to plant this brick.", 3);

%brick.schedule(0, "delete");
}

if (%brick.getDatablock().getID() == brick32x32FData.getID() &&!%client.isAdmin)
{
commandToClient(%client, 'centerPrint', "<color:ffffff>You must be an <color:ff0000>admin<color:ffffff> to plant this brick.", 3);

%brick.schedule(0, "delete");
}

if (%brick.getDatablock().getID() == brick64x64FData.getID() &&!%client.isAdmin)
{
commandToClient(%client, 'centerPrint', "<color:ffffff>You must be an <color:ff0000>admin<color:ffffff> to plant this brick.", 3);

%brick.schedule(0, "delete");
}
};
RPRegPackage(RP_RealEstate_Bricks);

You're missing a } before the package close.note the closing if statement then ending package. - no closing function!

I see it, I didn't close the function. I'll try it, thanks.

Code: [Select]
if (isPackage(RP_RealEstate_Bricks))
deactivatePackage(RP_RealEstate_Bricks);

package RP_RealEstate_Bricks
{
// RP Plant Brick
function fxDTSBrick::PlantBrick(%brick)
{
Parent::PlantBrick(%brick);

if (!isObject(%brick))
return;

%brickGroup = getBrickGroupFromObject(%brick);
%client = %brickGroup.client;
%datablock = %brick.getDatablock();

//Baseplates for Admins only
if (%brick.getDatablock().getID() == brick16x16FData.getID() &&!%client.isAdmin)
{
commandToClient(%client, 'centerPrint', "<color:ffffff>You must be an <color:ff0000>admin<color:ffffff> to plant this brick.", 3);

%brick.schedule(0, "delete");
}

if (%brick.getDatablock().getID() == brick16x32FData.getID() &&!%client.isAdmin)
{
commandToClient(%client, 'centerPrint', "<color:ffffff>You must be an <color:ff0000>admin<color:ffffff> to plant this brick.", 3);

%brick.schedule(0, "delete");
}

if (%brick.getDatablock().getID() == brick32x32FData.getID() &&!%client.isAdmin)
{
commandToClient(%client, 'centerPrint', "<color:ffffff>You must be an <color:ff0000>admin<color:ffffff> to plant this brick.", 3);

%brick.schedule(0, "delete");
}

if (%brick.getDatablock().getID() == brick64x64FData.getID() &&!%client.isAdmin)
{
commandToClient(%client, 'centerPrint', "<color:ffffff>You must be an <color:ff0000>admin<color:ffffff> to plant this brick.", 3);

%brick.schedule(0, "delete");
}
        }
};
RPRegPackage(RP_RealEstate_Bricks);

fixed closing bracket and you forgot the i at the if statement at the top

Code: [Select]
-snip-;
fixed closing bracket and you forgot the i at the if statement at the top

What I? Can you Bold it or Highlight it please?

What I? Can you Bold it or Highlight it please?
You had
Code: [Select]
f (isPackage(RP_RealEstate_Bricks))he just added an I.

Oh thanks guys. What a helpful community, cookies for all! :cookie: :cookie: :cookie: :cookie: :cookie: :cookie: :cookie: :cookie: :cookie: :cookie:

I've never seen a coding topic get so many replies in a short amount of time, surprising.

I think he actually just failed to copy the i...

I did forget

EDIT: Everything works, finally tested it and thanks guys, if you want to see it in action (which you probably don't want to) then come visit Gordo12699's [G]RPG
« Last Edit: December 24, 2012, 05:32:56 PM by Gordo12699 »