View Single Post
  #3  
Old 05-02-2008, 02:46 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
Quote:
Originally Posted by Chompy View Post
PHP Code:
function onCreated() {
  
with(findnpc("DB_Bank")) {
    for(
temp.pl this.getstringkeys("this.acc_")) {
      
temp.makevar("this.acc_" pl);

      echo(
"Player "pl @" has "a[0] @" money!");
    }
  }

This should echo all the players and what they have in rc (Those who have a this.acc_<account> variable in the database)

Now, how can we use this to find for example, those who have more then 50,000?

PHP Code:
function onCreated() {
  
temp.check 50000// What to check for
  
temp.0;

  
with(findnpc("DB_Bank")) {
    for(
temp.pl this.getstringkeys("this.acc_")) {
      
temp.makevar("this.acc_"pl);
      if (
a[0] >= check) {
        
p.add(pl);
      }
    }
  }
  
/*
    All the players who have 50,000 or more would be listed in the
    array 'p'
  */

Hope this helps

PS: I made these scripts on the go, so I don't know if they work properly or not
Those look like how I'd do it, though what's the difference between getstringkeys() and getdynamicvarnames()?
__________________
Reply With Quote