Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-30-2006, 11:54 PM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
Looping through every player serverside

Hello, i'm trying to loop through each player on the serverside in a database npc.

I tried this:

PHP Code:
for (pplayers) {
  
this.playernames.add(p.account);
 } 
however, for some reason it doesn't store all the players accounts.

Heres how i'm using it:

PHP Code:
db findnpc("DBNPC");
playernames db.getPlayerNames(); 
All this is serverside, then I send the playernames array, along with some other info to the clientside using triggeractions.

However...

If i'm in a level with more than 1 person I get the names of the people in the same level as me and my account name.
If i'm in a level on my own I just get my own account name.

Can anyone explain this? It's all being done serverside so why it doesnt always show every account on the server is puzzling.

Any ideas? Thanks.

Last edited by JkWhoSaysNi; 08-31-2006 at 12:21 AM..
Reply With Quote
  #2  
Old 08-31-2006, 12:36 AM
Luigi203 Luigi203 is offline
Hamma Time
Luigi203's Avatar
Join Date: Mar 2003
Location: North East PA
Posts: 285
Luigi203 is on a distinguished road
Send a message via AIM to Luigi203
allplayers = the playercount of the server
playerscount = the playercount of the level
__________________


CAUTION
Reply With Quote
  #3  
Old 08-31-2006, 12:41 AM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
I take it then that players is just the players on the level...

but that makes no sense because players[int] can find any player on the server.
Reply With Quote
  #4  
Old 08-31-2006, 12:50 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by JkWhoSaysNi
I take it then that players is just the players on the level...

but that makes no sense because players[int] can find any player on the server.
True, but do this and it will work:

PHP Code:
for (pallplayers) {
  
this.playernames.add(p);

No need for p.account either, just use p.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #5  
Old 08-31-2006, 04:00 AM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
thanks, that did it
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 04:50 PM.


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