Author Topic: command swtich  (Read 2581 times)

I want write this script. Admin orbs allowed swtich other the particles. and I did test it, nothing work. :C
In server.cs
Code: [Select]
function serverCmdbubble(%client)
{
Particle.setBitmap("Add-ons/Client_InterAdminOrbs/bubble.cs");
}

function serverCmdchunk(%client)
{
Particle.setBitmap("Add-ons/Client_InterAdminOrbs/chunk.cs");
}

function serverCmdcloud(%client)
{
Particle.setBitmap("Add-ons/Client_InterAdminOrbs/cloud.cs");
}

function serverCmddot(%client)
{
Particle.setBitmap("Add-ons/Client_InterAdminOrbs/dot.cs");
}

function serverCmdheart(%client)
{
Particle.setBitmap("Add-ons/Client_InterAdminOrbs/heart.cs");
}

function serverCmdnut(%client)
{
Particle.setBitmap("Add-ons/Client_InterAdminOrbs/nut.cs");
}

function serverCmdring(%client)
{
Particle.setBitmap("Add-ons/Client_InterAdminOrbs/ring.cs");
}

function serverCmdstar1(%client)
{
Particle.setBitmap("Add-ons/Client_InterAdminOrbs/star.cs");
}

function serverCmdthinring(%client)
{
Particle.setBitmap("Add-ons/Client_InterAdminOrbs/thinring.cs");
}
If I want swtich use admin orb bubble, I have type in the chat box and say /bubble or /nut something like that. I forget add it something?

Firstly, have you created an object named Particle?
Secondly, I doubt there is a function named setBitmap on particle datablocks.
Thirdly, you cannot use .cs scripts as particle bitmaps.
Fourthly, you are not transmitting the changes to clients.
Fifthly, you are mentioning the "admin orb bubble". The datablock of the admin orb bubble is not named Particle.
« Last Edit: April 09, 2012, 10:30:05 AM by Port »

Have you created an object named Particle? Secondly, I doubt there is a function named setBitmap on particle datablocks. Thirdly, you cannot use .cs scripts as particle bitmaps. Fourthly, you are not transmitting the changes to clients. Fifthly, you are mentioning the "admin orb bubble". The datablock of the admin orb bubble is not named Particle.
I should rename it, like client_bubble.cs etc ? I did wrote 8 of cs inside of each particles, correct?

Why is their a %client arguement? It looks like it isn't needed.

Why is their a %client arguement? It looks like it isn't needed.
How I am going write command swtich script? please tell me what I do? If you want test my mod. I can link here. If you want to.

Do you mean this?

Code: [Select]
switch$(%something)
{
    case "something":
        //dostuff

    case "somethingElse":
        //dostuff
}

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 :)

also having an if(!%client.isadmin)return; can't hurt either

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
    }
}

Code: [Select]
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
    }
}
« Last Edit: April 09, 2012, 03:55:14 PM by Wordy »


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
    }
}


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
    }
}

thank you! and how I can test myself see at the orb?

You would have to do something like this
CameraParticleA.textureName = "Add-ons/Server_AdminOrbSwitch/bubble.png"
1. Particle is not defined you must use CameraParticleA which is the admin orb emmiter datablock
2. there is no "setBitmap" use texturename
3. you can't set a texture to a cs it must be a png
4. this will probably crash all the other people who don't have Client_InterAdminOrbs


datablock DecalData(AdminBubbleSwitch)
{
   textureName = "Add-Ons/Server_AdminOrbSwitch/Bubble.png";
};

Add it as a decal data so people don't crash and make sure its a Server mod not a Client


« Last Edit: April 09, 2012, 08:50:04 PM by swollow »

well if he makes it a DecalData it'll download it for them

well if he makes it a DecalData it'll download it for them
he'll have to change it to a sever mod
Edit: added the decal data above ^^
« Last Edit: April 09, 2012, 08:51:02 PM by swollow »

You would have to do something like this
CameraParticleA.textureName = "Add-ons/Client_InterAdminOrbs/bubble.png"
1. Particle is not defined you must use CameraParticleA which is the admin orb emmiter datablock
2. there is no "setBitmap" use texturename
3. you can't set a texture to a cs it must be a png
4. this will probably crash all the other people who don't have Client_InterAdminOrbs

Code: [Select]
"CameraParticleA.textureName= ("./base/data/particle/anyname.png");
he'll have to change it to a sever mod
I did that already.
« Last Edit: April 09, 2012, 08:51:53 PM by Cubelands »