Quote:
Originally Posted by Grey
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.a = new TStaticVar();
temp.a.val = 2;
temp.b = new TStaticVar();
temp.b.val = 1;
temp.c = 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
