Blockland Forums > Modification Help
command swtich
<< < (2/5) > >>
Fluff-is-back:
Do you mean this?


--- Code: ---switch$(%something)
{
    case "something":
        //dostuff

    case "somethingElse":
        //dostuff
}

--- End code ---

I don't think you can use switches with serverCmds.

An alternative would be to use a base command and use a switch on an argument, like this:


function serverCmdSetOrb(%client, %type)
{
    switch$(%type)
    {
         case "bubble":
              Particle.setBitmap("Add-ons/Client_InterAdminOrbs/bubble.cs");

         case "chunk":
              Particle.setBitmap("Add-ons/Client_InterAdminOrbs/chunk.cs");
         //etc
    }
}

The use would then type:
/setOrb bubble
or
/setOrb chunk
to change it.
Hope this helps :)
Nexus:
also having an if(!%client.isadmin)return; can't hurt either
Cubelands:

--- Quote ---function serverCmdSetOrb(!%client.isadmin)return; correct? for host, superadmin and admin.
{
    switch$(%type)
    {
         case "bubble":
              Particle.setBitmap("Add-ons/Client_InterAdminOrbs/bubble.cs");

         case "chunk":
              Particle.setBitmap("Add-ons/Client_InterAdminOrbs/chunk.cs");
         //etc
    }
}
--- End quote ---
Wordy:

--- Code: ---function serverCmdSetOrb(%client) //%client is the argument which finds the %client
{
           if(!%client.isAdmin)  //now it's seeing if the client is not an admin. ! is basically saying if the client is not admin, otherwise if the ! wasn't in, it'd check for the client for being admin..
   {
            return;
           }

switch$(%type)
    {
         case "bubble":
              Particle.setBitmap("Add-ons/Client_InterAdminOrbs/bubble.cs");

         case "chunk":
              Particle.setBitmap("Add-ons/Client_InterAdminOrbs/chunk.cs");
         //etc
    }
}
--- End code ---
Fluff-is-back:

function serverCmdSetOrb(%client, %type)
{
    if(!%client.isAdmin)
      return;
   switch$(%type)
    {
         case "bubble":
              Particle.setBitmap("Add-ons/Client_InterAdminOrbs/bubble.cs");

         case "chunk":
              Particle.setBitmap("Add-ons/Client_InterAdminOrbs/chunk.cs");
         //etc
    }
}
Navigation
Message Index
Next page
Previous page

Go to full version