Author Topic: Client sided questions  (Read 1462 times)

How would I get every player name in the server(client side)?
Also how would I put all of the names in a list?
Example:
Code: [Select]
%list = [apple,banana,orange];
if("banana" in %list)
    //docode

TorqueScript does not have support for lists.
In any case, get them from the player list GUI.

TorqueScript does not have support for lists.
Damn, Torquescript doesn't have support for almost anything :c
In any case, get them from the player list GUI.
Any idea how to do that?

To get all the players into a 'list' use this:
Code: [Select]
function getPlayerList()
{
for(%i=0;(%row=NPL_List.getrowtext(%i))!$="";%i++)
{
%name = getField(%row,1);
if(%list$="")
%list = %name;
else
%list = %list TAB %name;
}
return %list;
}

Then to search the string made by that function use this:
Code: [Select]
function findField(%sourceString,%searchString,%offset)
{
%count = getFieldCount(%sourceString);
if(%offset > %count || %offset $= "")
%offset = 0;
for(%i=%offset;%i<%count;%i++)
{
%field = getField(%sourceString,%i);
if(%field $= %searchString)
return %i;
}
return -1;
}

Hope that helped and sorry for spoon feeding, I was bored..

%list = "apple" SPC "banana" SPC "orange";
%list2 = strReplace(%list,"apple"," ");
if (%list != %list2)
{
echo("an apple is in the list");
}


go nuts

:/

function isWordInList(%list, %word)
{ return striPos(" "@%list@" ", %word) != -1; }



EDIT:

-codethatobviouslywasnevertested-

Also, please figure out why that's wrong before trying to help others further. :u

TorqueScript does not have support for lists.
It does too. %list = new GuiTextListCtrl(); Just don't add it to any guis and it works fine as a list object.

It does too. %list = new GuiTextListCtrl(); Just don't add it to any guis and it works fine as a list object.
well isn't that nifty

works with servers too?


It does too. %list = new GuiTextListCtrl(); Just don't add it to any guis and it works fine as a list object.

Go ahead and compare the performance of using strings as lists and using something that isn't meant for storing data at all.

I also seem to recall that even making a new GUI element will crash a dedicated server.

I also seem to recall that even making a new GUI element will crash a dedicated server.

It would seem that is not the case
I lauched a dedicated server and typed this into it:

Go ahead and compare the performance of using strings as lists and using something that isn't meant for storing data at all.
Well, first, guiTextListCtrls are meant for storing data, second I never said that it was efficient. I said that it exists.

I also seem to recall that even making a new GUI element will crash a dedicated server.
Nexus is right, it doesn't crash, that's why I said that it does work on dedicated servers.