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 12-14-2008, 01:32 PM
Pelikano Pelikano is offline
Registered User
Pelikano's Avatar
Join Date: Oct 2008
Posts: 1,133
Pelikano has a little shameless behaviour in the past
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?
Reply With Quote
  #2  
Old 12-14-2008, 01:36 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
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";
  } 
Reply With Quote
  #3  
Old 12-14-2008, 01:43 PM
Pelikano Pelikano is offline
Registered User
Pelikano's Avatar
Join Date: Oct 2008
Posts: 1,133
Pelikano has a little shameless behaviour in the past
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
Reply With Quote
  #4  
Old 12-14-2008, 01:55 PM
Soala Soala is offline
Ideas on Fire
Soala's Avatar
Join Date: Jun 2007
Location: In my head
Posts: 3,208
Soala is a jewel in the roughSoala is a jewel in the rough
Quote:
Originally Posted by Pelikano View Post
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
Reply With Quote
  #5  
Old 12-14-2008, 01:55 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Sorry, I misread. Use allplayer instead.
Reply With Quote
  #6  
Old 12-14-2008, 01:57 PM
Pelikano Pelikano is offline
Registered User
Pelikano's Avatar
Join Date: Oct 2008
Posts: 1,133
Pelikano has a little shameless behaviour in the past
Oh.
So for (temp.pl : allplayers)

I'm such an idiot xD

Thank you
Reply With Quote
  #7  
Old 12-14-2008, 02:26 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
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 
__________________
Reply With Quote
  #8  
Old 12-14-2008, 02:32 PM
Pelikano Pelikano is offline
Registered User
Pelikano's Avatar
Join Date: Oct 2008
Posts: 1,133
Pelikano has a little shameless behaviour in the past
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?
Reply With Quote
  #9  
Old 12-14-2008, 02:36 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Quote:
Originally Posted by Pelikano View Post
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.
Reply With Quote
  #10  
Old 12-14-2008, 02:54 PM
Pelikano Pelikano is offline
Registered User
Pelikano's Avatar
Join Date: Oct 2008
Posts: 1,133
Pelikano has a little shameless behaviour in the past
Oh I see
Thanks
Reply With Quote
  #11  
Old 12-14-2008, 09:13 PM
Deas_Voice Deas_Voice is offline
Deas
Deas_Voice's Avatar
Join Date: Jun 2007
Location: Sweden
Posts: 2,264
Deas_Voice is a jewel in the roughDeas_Voice is a jewel in the rough
Send a message via AIM to Deas_Voice Send a message via MSN to Deas_Voice Send a message via Yahoo to Deas_Voice
so what doas player.isexternal do?
__________________
.
WTF is real life, and where do I Download it?
There is no Real Life, just AFK!
since 2003~
I Support~
ღAeonღ | ღTestbedღ | ღDelteriaღ

if you are going to rep me, don't be an idiot, leave your name!
I got nothing but love for you
Reply With Quote
  #12  
Old 12-14-2008, 09:23 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Deas_Voice View Post
so what doas player.isexternal do?
isexternal means if it is an IRC, a player from another server etc.
__________________
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 07:13 PM.


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