Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   for (temp.pl : players) (https://forums.graalonline.com/forums/showthread.php?t=83152)

Pelikano 12-14-2008 01:32 PM

for (temp.pl : players)
 
Well, I am currently making an Eventy System, and a problem popped up:

As example here:

PHP Code:

  if (params[0] == "EventStart") {
    for (
temp.pl players) {
      
findPlayerbycommunityname(temp.pl).chat "Event" SPC serverr.eventmsg SPC "has started! Say :join to join it!";
    }
    
serverr.event true;
  } 


I want that all the players on the server's chat get changed, but only the chat of the players that are in the same level as I am gets changed.
I think I am using for(tmp.pl : players) wrong or something :o

Any suggestions?

Codein 12-14-2008 01:36 PM

I think it's possible to do something like this:

PHP Code:

  for (temp.pl players) {
    
pl.chat "Event" SPC etc;
  } 

I think this can be done because players is an array of objects.

To get your script to work, you have to use this:

PHP Code:

  for (temp.pl players) {
    
findPlayer(pl.account).chat "Stuff";
  } 


Pelikano 12-14-2008 01:43 PM

Oh.
I'll try that

Well, it still doesn't work.

PHP Code:

if (params[0] == "EventStart") {
    for (
temp.pl players) {
      
findPlayerbycommunityname(pl.account).chat "Event" SPC serverr.eventmsg SPC "has started! Say :join to join it!";
    }
    
serverr.event true;
  } 


Hmm

Soala 12-14-2008 01:55 PM

Quote:

Originally Posted by Pelikano (Post 1449242)
Oh.
I'll try that

Well, it still doesn't work.

PHP Code:

if (params[0] == "EventStart") {
    for (
temp.pl players) {
      
findPlayerbycommunityname(pl.account).chat "Event" SPC serverr.eventmsg SPC "has started! Say :join to join it!";
    }
    
serverr.event true;
  } 


Hmm

If you really want the whole server's players chat to be changed, use allplayers

Codein 12-14-2008 01:55 PM

Sorry, I misread. Use allplayer instead.

Pelikano 12-14-2008 01:57 PM

Oh.
So for (temp.pl : allplayers)

I'm such an idiot xD

Thank you

Chompy 12-14-2008 02:26 PM

Just do a check so if their level is NULL just jump over them..

PHP Code:

for(temp.pl allplayers) {
  if (
pl.isexternal || pl.level.name == "") continue;
  
// script here 


Pelikano 12-14-2008 02:32 PM

Hm
Well, what does it mean if someone's level is NULL?
NULL = Nothing at all, right?

So how can someone's level be NULL?

Codein 12-14-2008 02:36 PM

Quote:

Originally Posted by Pelikano (Post 1449249)
Hm
Well, what does it mean if someone's level is NULL?
NULL = Nothing at all, right?

So how can someone's level be NULL?

RCs.

Pelikano 12-14-2008 02:54 PM

Oh I see :D
Thanks

Deas_Voice 12-14-2008 09:13 PM

so what doas player.isexternal do?

Chompy 12-14-2008 09:23 PM

Quote:

Originally Posted by Deas_Voice (Post 1449328)
so what doas player.isexternal do?

isexternal means if it is an IRC, a player from another server etc.


All times are GMT +2. The time now is 09:18 PM.

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