View Single Post
  #8  
Old 01-25-2010, 07:23 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by Grey View Post
It makes it less than ideal to store objects in arrays as you can't use .index() and other built in functions (because an array of objects will all have the name ""). Would have to run through the array checking .name for each element.
You can with player objects, so I'm not too sure how valid your statement actually is..

PHP Code:
echo(allplayers.index(findplayer("account"))); 
I've also done checks like..

PHP Code:
if (findplayer("account"in players) {
  
// stuff
}

if (
findweapon("-System"in player.weapons) {
  
// stuff

Edit: Further testing..

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
temp.= new TStaticVar();
  
temp.a.val 2;
  
temp.= new TStaticVar();
  
temp.b.val 1;
  
temp.= new TStaticVar();
  
temp.c.val 3;
  
temp.objs.add(temp.a);
  
temp.objs.add("LOL MESSING U UP"); // It doesn't :)
  
temp.objs.add(temp.b);
  
temp.objs.add(temp.c);
  echo(
temp.objs.index(temp.b));
  if (
temp.c in temp.objs) {
    echo(
"this also works..");
  }

Now we all benefit for not having to use loops to compare objects
__________________
Quote:

Last edited by fowlplay4; 01-25-2010 at 07:34 AM..
Reply With Quote