Graal Forums

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

sssssssssss 12-02-2009 03:34 AM

pl:allplayers
 
is there a way to get all players in a loop like that, but for members of a guild only?

i tried passing params and putting
PHP Code:

if (player.guild == params[5]) 

before and in the loop, didnt work either way.

oo_jazz_oo 12-02-2009 03:38 AM

PHP Code:

for (pl:allplayers) {
  if (
pl.guild == params[5])
    
pl.chat "I'm in that guild!";


Like such?

sssssssssss 12-02-2009 03:45 AM

ha, im dumb. yeah.

Kyranki 12-02-2009 05:14 AM

Quote:

Originally Posted by oo_jazz_oo (Post 1541849)
PHP Code:

for (pl:allplayers) {
  if (
pl.guild == params[5])
    
pl.chat "I'm in that guild!";


Like such?

Ugh, I think even if it's one line of code, not using brackets is in bad taste. >_<

cbk1994 12-02-2009 05:22 AM

Quote:

Originally Posted by Kyranki (Post 1541871)
Ugh, I think even if it's one line of code, not using brackets is in bad taste. >_<

Agreed, it just confuses people and makes it a pain to change later, especially in old code like is on many popular servers, where the indents have all been lost.

DustyPorViva 12-02-2009 05:30 AM

I don't use brackets for one line, but I keep it on the same line as the check to keep it organized.

Crow 12-02-2009 05:31 PM

Been discussed, basically. It's all about preference. Personally, I don't use brackets for single lines. I just don't see the need to do it. My code is readable perfectly fine, and if anything breaks the indents, it's not my fault.

Chompy 12-02-2009 05:38 PM

If it's a single line and it's short enough, I usually just stack them both into one line
HTML Code:

if (a)
  b

if (a) b


sssssssssss 12-02-2009 06:24 PM

I prefer brackets, although my head doesn't always remind me so sometimes it doesn't happen. xD

Tigairius 12-02-2009 06:32 PM

It really depends on the statement for me, but if it's a little more complex, I'll usually use brackets. (Even if I could fit either instance on one line, it's more about readability than trying to condense your code)


All times are GMT +2. The time now is 03:16 PM.

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