![]() |
findplayerbycommunityname
Hi,
so when should you use findplayer and when findplayerbycommunityname? o.o |
Well, instead of saying.. uhm
'/join Graal884675' to join Graal884675's party, you send his community name serverside, then use findplayerbycommityname().account just an example tho :p This is how I use it atm |
findplayer() will work no matter what, but only on account names. If you want to make something that is more friendly to the players, generally you would go with findplayerbycommunityname(). Keep in mind, though, that this will not work for players who have not yet set a community name.
Nowadays, it is good to use both. For example, I found that with text-based commands, it is sometimes hard to go searching for the actual account name. Here's a function that allows you to use the 'account' that you see in the profile of the player: PHP Code:
|
I tend to use findPlayerByCommunityName() more often, now, since even if your account is Pre-Graal12345 and is an actual account name, it still uses that as your community name, and won't negatively affect finding of the target.
Biggest issue: It's way too long, even to assign once to a "pl" or what-have-you variable. |
Quote:
For example: PHP Code:
There's a chance I'm wrong. I don't have the opportunity to test this at the moment :(. |
Quote:
|
It should be findPBCN(); :P
|
Quote:
|
player.communityname never returns null as far as I know, never ever did for me on Zodiac. I believe it returns your account name if you haven't chosen a communityname yet.
|
Quote:
|
findplayerbycommunityname() is actually first checking for the account (because that is faster), and then trying to find a player with the community name matching the parameter. So it should work in any case - finds players by account name exactly like findplayer(), but also works if you provide a community name. May be findplayer() could be changed to do that as well, might only need to optimize it a little bit.
|
| All times are GMT +2. The time now is 01:52 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.