Author Topic: Need help with a server command  (Read 1993 times)

I would like to know what is wrong with this part of a script i made, it should make it so if you aren't admin, it says "you must be admin to use this command" but for some reason, it says nothing. This is my first script (other than sounds) so take it easy on me please. Also, on the topic of scripting, what are the c0-c9? I think they are colors but i don't know.

package secret
{   
   function servercmdsecret(%client, %user)
{
   if(%client.isSuperAdmin == false || %client.isAdmin == false)
   {
   
   messageClient(%client, '', "\c6You must be admin to use this command.');
   
   return;
   }

What is with every new scripter and trying to place EVERYTHING into a package and yet failing at it?

What is with every new scripter and trying to place EVERYTHING into a package and yet failing at it?


I'm -_- so... sorry

by the way you DIDN'T HELP AT ALL!

You cant expect me to do much more than point out issues.

Also is this the entire code or just an excerpt?

If its an excerpt then why the forget aren't you posting the entire thing?

If its the entire code then I don't even know where to begin.

You don't need to package everything, unless...uhhh i forgot what things you should package ._.

You don't need to package everything, unless...uhhh i forgot what things you should package ._.
http://forum.blockland.us/index.php?topic=21811.0

Code: [Select]
activatepackage(packagenamehere);
Well since it's in a package did you remember to put this line of code in?

Yes gamefandan, I already read the package tutorial, I put that code at the end of it, it is supposed to be in a package, and yes, this is an excerpt Ill post the whole  thing even though the console told me the problem was in that general area...

oh and rkynick, get out of this post, fall in a hole somewhere....

gamefandan no offense to you but, you are also new to scripting, you can't be giving me advice =P
« Last Edit: February 28, 2009, 11:39:44 AM by AGlass0fMilk »

package secret
{   
   function servercmdsecret(%client, %user)
{
   if(%client.isSuperAdmin == false || %client.isAdmin == false)
   {
   
   messageClient(%client, '', "\c6You must be admin to use this command.');   
      return;
   }
      if(%user !$= "")
   {
      %target = findClientByName(%user).player;
      %targetC = findClientByName(%user);
      %target.secret();
      messageClient(%client, '', '\c2%1 secret', %targetC.name);
      messageClient(%targetC, '', '\c6secret', %user);
   } else {
      %client.player.secret();
      messageClient(%client, '', '\c6secret', %user);   
      }      
   }
};
ActivatePackage(secret);

You obviously didn't read the tutorial... a package is to alter a pre-defined function. Take it out of the package.

Edit: 1. Your calling %client.player.secret();, you haven't even defined that function.
2. Message client args are %client,%clientMessageString,%message,%arg1,%arg2,etc
At the moment, your trying to call a client command "\c2%1 secret". Use it like this:
messageClient(%client,'','\c2Secret.');
« Last Edit: February 13, 2009, 08:59:57 PM by Destiny/Zack0Wack0 »

I am not a dumbass, I already read the package tutorial, I put that code at the end of it, it is supposed to be in a package, and yes, this is an excerpt Ill post the whole  thing even though the console told me the problem was in that general area...

oh and rkynick, get out of this post, fall in a hole somewhere....

gamefandan no offense to you but, you are also new to scripting, you can't be giving me advice =P
Oh how nice. Gamefandan shows a higher understanding of torquescript than you do and yet you turn him away. You tell me to "fall in a hole somewhere" when I ask for things that can be used to help you(i.e the entire code instead of the first 7 or so lines).

Do you want help, or what?


Anyways Destiny summed it up.

Idk if this is anything but "\c6You must be admin to use this command.'

One is " and the other is '

Oh how nice. Gamefandan shows a higher understanding of torquescript than you do and yet you turn him away. You tell me to "fall in a hole somewhere" when I ask for things that can be used to help you(i.e the entire code instead of the first 7 or so lines).

Do you want help, or what?


Anyways Destiny summed it up.

I am sorry... you sound like you hate me for being new to scripting. I said not to be hard on me.
« Last Edit: February 17, 2009, 07:31:08 PM by AGlass0fMilk »

Isn't it easier to do this:

 if(!%client.isAdmin)

Than

 if(%client.isSuperAdmin == false || %client.isAdmin == false)

?