View Single Post
  #8  
Old 08-08-2010, 12:12 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
Try multi-dimensional arrays instead.

PHP Code:
temp.myArray = null;

myArray.add({"1", "2", "3"});
myArray.add({"4", "5", "6"});

echo(
myArray[0][0]); // echoes 1
echo(myArray[0][2]); // echoes 3

echo(myArray[1][0]); // echoes 4 
Then when adding a buff you can do something like

PHP Code:
public function addBuff(skill, time, option) {
  
player.clientr.buff.add({skill, option, time});
} 
and when decreasing the timer

PHP Code:
for (temp.i = player.clientr.buff.size() - 1; i >= 0; i --) {
  
player.clientr.buff[i][2] -= 1;
  if (
player.clientr.buff[i][2] <= 0) {
    
player.client.buff.delete(i); // remove the buff, ≤ 0 time
  
}
} 
__________________
Reply With Quote