Blockland Forums > Modification Help

Is this script written correctly?

Pages: << < (2/2)

Placid:

I'm assuming you didn't get the spacing part very much..
oo, found error in what i taught lawls


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


Kalphiter:

Wrong.
%n is still a string.

HellsHero:

Needs more %n = findClientByName(%n);

MegaScientifical:


--- Code: ---function serverCmdKill(%c, %n) {
    %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 ---

That's better...

Plornt:


--- Quote from: Parallel on June 26, 2010, 09:48:21 PM ---Would %player work as the victim instead of %n?

And was it spaced properly?

--- End quote ---
you can name it what ever you want as long as you are consistent with that name and findclientbyname(%n); returns another value so you have to assign it to another variable
like: %n = findclientbyname(%n);

Pages: << < (2/2)

Go to full version