Blockland Forums > Modification Help

Is this script written correctly?

Pages: (1/2) > >>

Parallel:

I recently took a scripting class, and was taught how write a /kill command script. This is what I got:


--- Code: ---function serverCmdKill(%c,%n)
{
    findClientbyname(%n);
    if(%c.isAdmin && !%n.isAdmin)
    {
       %n.player.kill();
    }
else
    {
      messageClient(%c,'',"You are not admin, you cannot kill this player");
    }
  }
--- End code ---

Is that written right?

Kalphiter:

%n is just a string.
It makes no sense.

Parallel:


--- Quote from: Kalphiter on June 26, 2010, 09:40:59 PM ---%n is just a string.
It makes no sense.

--- End quote ---
I was told %c is the client and %n is the victim.

Kalphiter:

%c is sent as the person who typed the command's client, but %n is just a string of letters.

Parallel:


--- Quote from: Kalphiter on June 26, 2010, 09:46:11 PM ---%c is sent as the person who typed the command's client, but %n is just a string of letters.

--- End quote ---
Would %player work as the victim instead of %n?

And was it spaced properly?

Pages: (1/2) > >>

Go to full version