Thread Tools Display Modes
05-11-09, 11:31 PM   #1
Tbdsamman
A Defias Bandit
Join Date: May 2009
Posts: 3
Determine if Player Exists

Is there a way to determine if a player (by their name) exists on the server?

The only way I've found so far is with AddFriend(name) but it isn't a very good solution.
  Reply With Quote
05-12-09, 01:20 AM   #2
Exawatt
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Feb 2009
Posts: 36
Originally Posted by Tbdsamman View Post
Is there a way to determine if a player (by their name) exists on the server?

The only way I've found so far is with AddFriend(name) but it isn't a very good solution.
This has been discussed before. Short of a /who request, the only other way is trying to directly access that character is via tell, SendAddonMessage() or AddFriend() (as you suggested).

[/who and SendAddonMessage] only work if when player is online. /who only works if they're part of your faction.

I use the /who method myself.

Last edited by Exawatt : 05-12-09 at 10:19 AM. Reason: I was wrong. My bad.
  Reply With Quote
05-12-09, 01:53 AM   #3
Shirik
Blasphemer!
Premium Member
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2007
Posts: 818
AddFriend() should work regardless of whether the player is online or not.

For such a requirement, that really is your best solution, hacky as it is.
__________________
たしかにひとつのじだいがおわるのお
ぼくはこのめでみたよ
だけどつぎがじぶんおばんだってことわ
しりたくなかったんだ
It's my turn next.

Shakespeare liked regexes too!
/(bb|[^b]{2})/
  Reply With Quote
05-12-09, 08:32 AM   #4
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Correct. When you try to add someone as a friend who is not online, it works just peachy. If that person is of the opposing faction, you get a message stating that you cannot add that person as a friend. If the character name does not exist, you get a message saying so.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
05-12-09, 09:55 AM   #5
Tbdsamman
A Defias Bandit
Join Date: May 2009
Posts: 3
SendAddonMessage seems to be the best option because it won't blow up in your face if the player has the maximum number of friends.

What would be the best way of capturing the output when it fails? It's been a while since I played around with writing addons and I know you could intercept chat messages.
How can you make sure you only capture the response from the proper chat window?
And is there a way to make it synchronous? Being able to call PlayerExists("Tbdsamman") would be really sweet.
  Reply With Quote
05-12-09, 11:19 AM   #6
Tbdsamman
A Defias Bandit
Join Date: May 2009
Posts: 3
Originally Posted by Tbdsamman View Post
SendAddonMessage seems to be the best option because it won't blow up in your face if the player has the maximum number of friends.

What would be the best way of capturing the output when it fails? It's been a while since I played around with writing addons and I know you could intercept chat messages.
How can you make sure you only capture the response from the proper chat window?
And is there a way to make it synchronous? Being able to call PlayerExists("Tbdsamman") would be really sweet.
Actually, I'll have to use AddFriend since SendAddonMessage doesn't work if they are offline (just tested and then reread what someone said earlier, I feel a little dumb now).
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Determine if Player Exists


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off