Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Tech Support (https://forums.graalonline.com/forums/forumdisplay.php?f=7)
-   -   Resolved: for (pl: allplayers) { Problem? (https://forums.graalonline.com/forums/showthread.php?t=63610)

hotrian 01-21-2006 03:43 PM

Resolved: for (pl: allplayers) { Problem?
 
1 Attachment(s)
NPC Code:
	          new GuiPopUpMenuCtrl(H_AW_Selecter) {
profile = "DefaultMenuProfile";
x = 5;
y = 23;
width = 120;
height = 20;
text = "Account";
thiso.catchevent("H_AW_Selecter","onSelect","onSel ectaccount");
i=0;
for (pl: allplayers) {addtext(@pl,i);i++;}
}




Rc gives no errors and
when using that with my GUI, it lists 20 objects (See Attached Picture)
1 of which is a player (myself, im the only player on)
1 of which is the Npc server (thats not a player!)
and the other 18 are IRC channels T.T

But using
NPC Code:
for (i=0;i<=allplayerscounts;i++) {addtext(@players[i].account,i);}



Works just fine, only lists real players (just me at the time);

Server : Soakath
Weapon : H/Test

Sorry if this is a known bug
Am I just using it wrong?

Admins 01-21-2006 04:22 PM

allplayers[] are all players, including virtual players (channels, chatters, players from other servers), basicly everything you see on the playerlist, you have flags like player.ischannel, player.isexternal

players[] is the list of players in the current level, which are max 1 map part away from you (on gmap)

Lance 01-22-2006 12:00 AM

Quote:

Originally Posted by hotrian
NPC Code:
for (i=0;i<=allplayerscounts;i++)



[...]
Am I just using it wrong?

You are using that wrong. It is 'allplayerscount', not 'allplayerscounts'.

hotrian 01-22-2006 03:51 PM

I typed that for here, on the server it says allplayerscount
Thats not what I was asking if I was using wrong, that part of the NPC works fine
I was talking about
i=0;
for (pl: allplayers) {addtext(@pl,i);i++;}

Yen 01-22-2006 07:05 PM

pl is predefined as the current player.
Change it to 'p' or something, I'm pretty sure that's the problem.

Rick 01-22-2006 07:25 PM

Quote:

Originally Posted by Yen
pl is predefined as the current player.
Change it to 'p' or something, I'm pretty sure that's the problem.

No.

Lance 01-23-2006 01:18 AM

Quote:

Originally Posted by Yen
pl is predefined as the current player.
Change it to 'p' or something, I'm pretty sure that's the problem.

Stop posting bad advice.

If I have to warn you again, you are not going to like the outcome.


All times are GMT +2. The time now is 02:28 PM.

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