Blockland Forums > Modification Help
I need help with a script.
<< < (2/3) > >>
TheStranger:

--- Quote from: otto-san on April 14, 2011, 05:57:02 PM ---
--- Code: ---$pCt = -1;

function serverCmdsetupStuff(%client, %first, %second)
{
  $player[$pCt++] = findClientByName(%first).player;
  $player[$pCt++] = findClientByName(%second).player;
}

function serverCmdrecallStuff(%client, %num)
{
  messageClient(%client,'',"\c6"@$player[%num].client.name SPC $player[%num]);
}
--- End code ---

something like that?

--- End quote ---

Actually, I took what you said, and instead of using two arrays and the value being bool, I used only one array and made the value what the second array was. I haven't tested it yet, but hopefully it works...
Nexus:

--- Quote from: TheStranger on April 14, 2011, 06:02:23 PM ---Actually, I kind of worded it terribly. Here's what my code looks like:

--- Code: ---function serverCmdtest(%client, %text)
{
%name = %client.getPlayerName();
$var[%name,%text] = true;
}
--- End code ---

As you can see in line 3, I placed both the name and the text in the same array. Can I still call both of them in a separate function, or should I remove one string because I messed up?


--- End quote ---

It looks like what you are trying to do is to store data in an array, but right now you have the data being stored as part of the name.  Also, you cannot have multiple arguments in an array, such as $var[%arg1, %arg2], but you can have multiple words, such as $var[%arg1 SPC %arg2], but then you cannot export the array and execute it without getting a syntax error, since it is saved as "$vararg1 arg2" which has incorrect syntax.  Anyway, what I think you should do is have something more like $var[%someidentifyingterm] = %name TAB %text; However, if all you are trying to do is test to see if someone with a specific name has used that text in this servercmd, then you are doing it fine, minus the multiple argument array thing.

Destiny/Zack0Wack0:

--- Quote from: Nexus on April 17, 2011, 12:24:34 PM ---Also, you cannot have multiple arguments in an array, such as $var[%arg1, %arg2], but you can have multiple words, such as $var[%arg1 SPC %arg2], .

--- End quote ---
You can. Both of those compute to the exact same thing. $var%arg1_%arg2
Iban:
Never put spaces in a Global Variable array name.
Mr. Wallet:
RULE 1
Navigation
Message Index
Next page
Previous page

Go to full version