Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Question (https://forums.graalonline.com/forums/showthread.php?t=84993)

MysticX2X 04-04-2009 11:44 PM

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 ^^.

napo_p2p 04-05-2009 12:00 AM

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); 


oo_jazz_oo 04-05-2009 12:07 AM

Argh. I was jsut about to post. -_- Beat me to it. lol
But yeah, do what nap said to do...*mumbles*

MysticX2X 04-05-2009 12:10 AM

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?

oo_jazz_oo 04-05-2009 12:13 AM

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.

MysticX2X 04-05-2009 12:45 AM

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 :(.

fragman85 04-05-2009 12:59 PM

You could also check the kills on login of a player... :o


All times are GMT +2. The time now is 09:25 AM.

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