Author Topic: Something missing? (Resolved)  (Read 739 times)

I'm trying to do a little help thing for my server based off of another little script, but it won't work because something's wrong/missing and I can't figure out what it is.

Code: [Select]
package SpawnHelp
{
function serverCmdMessageSent(%cl,%msg)
{
if(%msg $= "!help")
messageClient(%cl,'',"\c4The current server commands are:");
messageClient(%cl,'',"\c2!kill \c1Displays kill count.");
messageclient(%cl,'',"\c2!help \c1Displays this menu.");
messageclient(%cl,'',"\c4For any additional help, ask a server Admin.");
else
Parent::serverCmdMessageSent(%cl,%msg);
}
};
activatePackage(SpawnHelp);

It works fine if there's only one message sent to the client, so I assume I'm doing that wrong? I looked around and couldn't figure out how other add-ons did it with my low scripting knowledge.

Console says

Code: [Select]
else
##
##Parent::serverCmdMessageSent(%cl,%msg);

Is the problem. Can someone point me in at least the right direction? Thanks. Sorry if it's painfully obvious or something, but I'm slowly learning.
« Last Edit: January 18, 2010, 02:26:26 AM by Regulith »

Truce has informed me I needed braces around it if it's more than one line.

i.e.

Code: [Select]
package SpawnHelp
{
function serverCmdMessageSent(%cl,%msg)
{
if(%msg $= "!help")
{
messageClient(%cl,'',"\c4The current server commands are:");
messageClient(%cl,'',"\c2!kill \c1Displays kill count.");
messageclient(%cl,'',"\c2!help \c1Displays this menu.");
messageclient(%cl,'',"\c4For any additional help, ask a server Admin.");
}
else
Parent::serverCmdMessageSent(%cl,%msg);
}
};
activatePackage(SpawnHelp);

Case closed, but I won't lock this because Ephialtes will probably just unlock it again if I do. :P

Why do you need the "!" marker for it? Wouldn't it work better and be easier to understand as a slash command like every other mod?


Why do you need the "!" marker for it? Wouldn't it work better and be easier to understand as a slash command like every other mod?
Alas, mine ! marker hath been redundafied.

Code: [Select]
function serverCmdMessageSent(%cl,%msg)

Did you define your variables?

Code: [Select]
function serverCmdMessageSent(%cl,%msg)

Did you define your variables?
You know what serverCmdMessageSent is right?