Author Topic: Something wrong  (Read 632 times)

I tried whipping up a rule script with very little experience from TorqueScript.
After i activated the add-on, players can't spawn any longer; what's wrong?

Code: [Select]
function GameConnection::OnClientEnterGame(%this)
{
parent::OnClientEntergame(%this);
                messageClient(%this,"","\c21. Rule1");
messageClient(%this,"","\c22. Rule2");
messageClient(%this,"","\c23. Rule3");
messageClient(%this,"","\c24. Rule4");
messageClient(%this,"","\c25. Rule5");
messageClient(%this,"","\c26. Rule6");
}

function ServerCmdRulesAll(%client)
{
if(%client.isSuperAdmin)
{
messageAll("","\c21. Rule1");
messageAll("","\c22. Rule2");
messageAll("","\c23. Rule3");
messageAll("","\c24. Rule4");
messageAll("","\c25. Rule5");
messageAll("","\c26  Rule6");
}
else
{
messageclient(%client,"","\c0You are not Super admin. Please type \c3/rules \c0for the server rules.");
return;
}
parent::serverCmdmessageSent(%client);
}

Thanks.

« Last Edit: April 08, 2009, 11:20:44 AM by Protokol »

Insert

parent::OnClientEnterGame(%this);

Inside the first function.


You're overwriting a function without letting it go to the main game code(Or other add-ons that use that function)

Are either of these in a package?

Why are you putting "parent::serverCmdmessageSent(%client);" in the rules command? You haven't actually provided a message argument so it's like you're trying to say "" nothing - which is pointless.

Nevermind, i got it working.

Code: [Select]
package Rules
{
function GameConnection::OnClientEnterGame(%client)
        {
                messageClient(%client,"","\c5<font:impact:40>Protokol's serv0r rules:");
                messageClient(%client,"","\c21. Do not ask for admin.");
messageClient(%client,"","\c22. No brick or chatspam.");
messageClient(%client,"","\c23. If you are just going to plant a few bricks, clean after you.");
messageClient(%client,"","\c24. Don't act like/be a moron.");
messageClient(%client,"","\c25. Obey the admins.");
messageClient(%client,"","\c2<font:impact:40>By bisobeying these rules you will normally be kicked/banned/flamed.");
                Parent::OnClientEnterGame(%client);
         }
};
activatePackage(Rules);