View Single Post
  #1  
Old 01-28-2009, 04:14 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Multi-Dimensional Arrays

It would be great if there was a way to get all index out of a multi-dimensional array. I don't really know how to word this ...

For example,

PHP Code:
temp.staff = {
                    {
"cbk1994""Scripter"},
                    {
"PepperTheCat""Management"}
                  };

temp.staffIndex staff.getIndexes[0].index(@ player.account);
if (
staffIndex > -1) {
  
temp.position staff[staffIndex[1]];
  
player.chat "You are staff:" SPC position;

Instead, something like this has to be used:

PHP Code:
temp.staff = {
                    {
"cbk1994""Scripter"},
                    {
"PepperTheCat""Management"}
                  };

temp.staffIndex null;

for (
temp.member staff) {
  if (
member[0] == player.account) {
    
staffIndex staff.index(@ member);
  }
}

if (
staffIndex > -1) {
  
temp.position staff[staffIndex[1]];
  
player.chat "You are staff:" SPC position;

I thought there was a way to do this, but Skyld didn't know of one, and neither did any of the other people I asked.
__________________
Reply With Quote