Author Topic: ServerCmd script problem: Don't know where something goes  (Read 877 times)

I'm not sure if this works, can someone tell me if this works? I want it to let a super admin fkaekill all of the bricks in the server.

Code: [Select]
{     functionservercmdfakekillall (%client)
     findclientbyname(%name);
     if(!%client.isSuperAdmin)
     brick.fakekillbrick (stuff 0 0 0 20)
}     MessageAll(' ',"/c0run into your builds!");

// this is supposed to let a super admin fakekill bricks on a server. Did I do it right? Probably not, since that was my first// time scripting.

Also, Not sure what to put where stuff is. Any help?
« Last Edit: August 27, 2009, 01:20:20 AM by BobSevenSevens »

Wasn't Trader making some sort of "fake kill everything on a baseplate" wand? Might work better with trust etc. so it isn't annoying to others.

The areas that are blue are your mistakes.

The areas that are purple are things you should take out.

The areas that are red are things I added that you forgot to put in.

{     function*servercmdfakekillall (**%client)
{
     findclientbyname(%name***);
     if(!%client.isSuperAdmin)****
     brick.fakekillbrick (stuff 0 0 0 20)*****
}     MessageAll(' ',"/c0run into your builds!");******



* No space between function and the servercmd.



** You don't need a space separating the parenthesis from the command.



*** You can't do that unless %name is after %client in the command.



**** Why is there a ! there? if you had done: if(%client != SuperAdmin);, it would have been the same as saying DOES NOT EQUAL.



***** 1. You forgot to pt a %before brick.

          2. Even if you did put a % before brick it still wouldn't work seeing as you have yet to justify it as a local variable.

          3. You can't fakekill something that isn't there.

          4. That little parenthesis there won't do stuff.

          5. You forgot to put a ; at the end.



****** Don't, just don't.











I'm not going to take the time to tell you how to fix the script and make it work, I'll let Space Guy do that, I'm pretty sure he'll post here, he posts in almost every thread in coding help. Oh he already did. :P Good luck anyway.
« Last Edit: August 27, 2009, 04:47:26 AM by Gamefandan »

This won't really work, most people will lag too much from the sudden mass fakekill and their physics will disable. All they'll see is their build dropping through the floor.

I hae the updated version that Annoying Orangeetfan helped me with on a servercmd tutorial here:

Code: [Select]
functionservercmdfakekillall (%client)
{
         if(!%client.isSuperAdmin)
         {
             %clientBrickCount = %client.brickgroup.getGroup();
              %brick.fakekillbrick ("0 0 0 20");
            MessageAll(,'',"\c4Run into your builds!");
         }
}

// this is supposed to let a super admin fakekill bricks on a server.// Did I do it right? Probably not, since that was my first time //scripting.

Aslo, I thought this would be good for my zombie server where I have buildings that the bricks are big enough that the zombies wont fakekill them, but I don't want to enable terrain destroying, because I hate that.

Think about it: you're sitting in a small, zombie-proof base, when suddenly, Boom your base is destroyed! D: That sounds fun to me.

That still won't work, as you haven't define %brick and it will only call the cmd if your NOT super admin... You need a space after function. You don't need a space after killall.

This won't do anything
Code: [Select]
function servercmdfakekillall (%client)
{
         if(%client.isSuperAdmin)
         {
             %BrickCount = %client.brickgroup.getCount();
              if(%BrickCount > 0) //Fake killing 0 bricks is useless
             {
                for(%i=0;%i<%BrickCount;%i++)
               {
                  %Brickgroup = %Client.brickgroup;
                  %brick = %Brickgroup.getObject(%i);
                  %brick.fakekillbrick ("0 0 0 20");
               }
            }
         }
}
Or something like that. I don't really feel like making this >.>
« Last Edit: August 27, 2009, 10:03:44 AM by AGlass0fMilk »

Well, this is my first try at scripting, so... I failed.

Code: [Select]
function ServerCmdFakeKillAllBricks(%client) {
 if(!%client.isSuperAdmin)
  return;
 %brickCount = %client.brickGroup.getCount();
 %brickGroup = %client.brickGroup;
 for(%i = 0; %i < %brickCount;%i++) {
  %brick = %brickGroup.getObject(%i);
  if(%brick.getClassName $= "fxDTSBrick")
   %brick.schedule(%i, fakeKillBrick, "0 0 0", 20);
    // If I'm not mistakin', fxDTSBrick::fakeKillBrick goes something like the following:
    // fxDTSBrick::fakeKillBrick(string made up of ( int x velocity to be killed in SPACE int y velocity to be killed in SPACE int z direction to be killed in SPACE miliseconds to be killed for))
 }
}
This, (if it works, I'm making it up as I go along,) would be fun to use with physics.
« Last Edit: August 28, 2009, 06:03:41 AM by BobAndRob »

Thanks, BobAndRob, I hat the fourth number set to 20.

I'm making it up as I go along.

Now I happen to have tried it, please read my edited version.

Cause you'll probably miss it:
%brick.schedule(%i, fakeKillBrick, "0 0 0" SPC 20000 - (%brickCount - %i));
changed to
%brick.schedule(%i, fakeKillBrick, "0 0 0", 20);
« Last Edit: August 28, 2009, 06:04:24 AM by BobAndRob »


Um, even after you get this down, what good will come out of this script? Like Ephi said, it'll just lag, physics will temporarily stop, and the earth will explode. God damnit, you blew up the planet.

Um, even after you get this down, what good will come out of this script? Like Ephi said, it'll just lag, physics will temporarily stop, and the earth will explode. God damnit, you blew up the planet.
I thought this would be good for my zombie server where I have buildings that the bricks are big enough that the zombies wont fakekill them, but I don't want to enable terrain destroying, because I hate that.

Think about it: you're sitting in a small, zombie-proof base, when suddenly, Boom your base is destroyed! D: That sounds fun to me.

The problem is too many bricks fake killed = Physics stop working = Builds fall through the floor