Blockland Forums > Modification Help

Scripting

Pages: (1/6) > >>

BlockStar:

Hey so im working on this script where you can disable some emotes for everybody on the server this is what i have so far:  

--- Code: --- //Lights

 function serverCmdLight(%client)
 {
       if(%client.isAdmin)
       {
             if(%client.isLightPlayer)
             {
                   %client.isLightPlayer = 0;
                   messageClient(%client,'',"\c3Light is now\c6OFF");
                  
                   %client.updateLight();
      
             }
             eles
             {
                   %client.isLightPlayer = 1;
                   %client.oldLight = %client.light;
                   %client.light = "°";
                   messageClient(%client,''<"\c3 Light is now\c6ON");
 
                   %client.updateLight();
             }
        }
 }
--- End code ---


phflack:

you mispelt else, if that helps, in line 15

-Jetz-:

That doesn't look like "everybody" so much as it looks like "non-admins."
Unless you're trying to make it so admins can toggle it on and off, in which case you should be making a new function for the toggle. Either way, you'll need to utilize the package system.

MegaScientifical:


--- Code: ---package adminOnlyLight {
function serverCmdLight(%client) {
if(%client.isAdmin)
Parent::serverCmdLight(%client);
}
};
activatePackage(adminOnlyLight);
--- End code ---

Majorly reduces code. Only thing is it doesn't tell you if the light is on or off...

Butler:

Isn't there already a defult /light command.

Pages: (1/6) > >>

Go to full version