Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-04-2009, 11:44 PM
MysticX2X MysticX2X is offline
Prince
MysticX2X's Avatar
Join Date: Sep 2005
Posts: 2,529
MysticX2X will become famous soon enough
Question w/ player scanning

Well I kind of want to be able to scan and index players and have a chat return with the player with the most of this variable. Such as If I want to say /checkkills, it would return the player with the most kills.

I tried using for (pl : players) but I couldn't get any farther from there. I realize it has to be on serverside and all and realize pl : players only scans the level.

Help is appreciated .
__________________
-Mystic

former acc: mystic2k


RIP Matt (NBK)

Last edited by MysticX2X; 04-04-2009 at 11:55 PM..
Reply With Quote
  #2  
Old 04-05-2009, 12:00 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
The allplayers array is an array that contains all the players logged in.

Here's a snippet that'll do what you want for player kills. You can easily modify it yourself for other variables.

PHP Code:
temp.most null;  //Variable that holds player with highest kill count
  
for (temp.pallplayers) {
  if (
temp.p.kills temp.most.kills) {
    
temp.most temp.p;
  }
}
  
player.chat format("%s (%d)"temp.most.accounttemp.most.kills); 
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #3  
Old 04-05-2009, 12:07 AM
oo_jazz_oo oo_jazz_oo is offline
Jazz teh Awesome
oo_jazz_oo's Avatar
Join Date: Jul 2006
Location: California
Posts: 596
oo_jazz_oo is a jewel in the roughoo_jazz_oo is a jewel in the rough
Send a message via MSN to oo_jazz_oo
Argh. I was jsut about to post. -_- Beat me to it. lol
But yeah, do what nap said to do...*mumbles*
__________________

Reply With Quote
  #4  
Old 04-05-2009, 12:10 AM
MysticX2X MysticX2X is offline
Prince
MysticX2X's Avatar
Join Date: Sep 2005
Posts: 2,529
MysticX2X will become famous soon enough
Thank's Napo, and thanks Jazz for at least trying .

Does there happen to be a function to scan offline players as well or does that require much more?
__________________
-Mystic

former acc: mystic2k


RIP Matt (NBK)
Reply With Quote
  #5  
Old 04-05-2009, 12:13 AM
oo_jazz_oo oo_jazz_oo is offline
Jazz teh Awesome
oo_jazz_oo's Avatar
Join Date: Jul 2006
Location: California
Posts: 596
oo_jazz_oo is a jewel in the roughoo_jazz_oo is a jewel in the rough
Send a message via MSN to oo_jazz_oo
The last time I checked to get offline variables, you would have to search through the accounts/ folder...and to do that through script, the npc server needs r accounts/*/* rights.
__________________

Reply With Quote
  #6  
Old 04-05-2009, 12:45 AM
MysticX2X MysticX2X is offline
Prince
MysticX2X's Avatar
Join Date: Sep 2005
Posts: 2,529
MysticX2X will become famous soon enough
Had a bit of trouble. I'm having trouble getting it to work with another variable (such as this.example). Yeah i suck at this .
__________________
-Mystic

former acc: mystic2k


RIP Matt (NBK)
Reply With Quote
  #7  
Old 04-05-2009, 12:59 PM
fragman85 fragman85 is offline
Banned
Join Date: Mar 2009
Location: Switzerland
Posts: 261
fragman85 is on a distinguished road
You could also check the kills on login of a player... :o
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:19 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.