Author Topic: 2 slightly related questions  (Read 901 times)

Hard to sum up into subject so:

How do you make it so when you enter a command, it displays a chat message, you enter something, then the command finishes? Take for example the scale changer, enter the command, it asks a scale, you put "2 2 2" or something and it sets it to that.

And:

How do you include 2 variables? Example: *enters /register* "Name?" *enters name* "Job?" *enters job* "Your name is now: [name] and your job is [job]. Congrats!"

The second one is more complex, I'll answer that. The first question just involves removing a lot of things from the second.

Code: [Select]
package Accounts
{
 function servercmdRegister(%client)
 {
  if(%client.isRegistering)
  {
   messageclient(%client,'',"\c4You are already registering.");
   return;
  }
  %client.isRegistering = 1;
  messageclient(%client,'',"\c4Enter a \c1name\c4 for your account.");
 }

 function servercmdMessageSent(%client,%text)
 {
  if(!%client.isRegistering)
  {
   Parent::servercmdMessageSent(%client,%text);
   return;
  }
  if(%client.isRegistering $= "1")
  {
   %client.regName = %text;
   %client.isRegistering = 2;
   messageclient(%client,'',"\c4Enter a \c1Job for your account, \c1" @ %text);
   return;
  }
  if(%client.isRegistering $= "2")
  {
   %client.regJob = %text;
   %client.isRegistering = 0;
   messageclient(%client,'',"\c4Your \c1Job\c4 is now \c1\"" @ %text @ "\"\c4, \c1" @ %client.regname);
   return;
  }
 }
};activatePackage(Accounts);

Quote
> /register
Enter a name for your account.
> /register
You are already registering.
> Generic
Enter a Job for your account, Generic.
> Civilian
Your Job is now "Civilian", Generic.