View Single Post
  #2  
Old 05-02-2008, 02:33 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
PHP Code:
function onCreated() {
  
with(findnpc("DB_Bank")) {
    for(
temp.pl 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
__________________

Last edited by Chompy; 05-02-2008 at 07:16 AM..
Reply With Quote