Thread: realid aiv
View Single Post
12-13-10, 06:13 AM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
weasoug, I think you need to bookmark wowpedia.org and wowprogramming.org, and refer to them frequently for information about WoW API functions. This is at least the third thread I've seen today where you posted code that just made me go .

Originally Posted by weasoug View Post
Code:
		if not accept then
			for index = 1, GetRealmName() do
				if BNGetFriendToonInfo(index) == name then
					accept = true
					break
				end
			end
		end
GetRealmName() returns a string value, not a number, and will trigger a Lua error in the context you're using it. I'm not even sure why you're checking the realm name anyway; if someone invites you to a party, they are obviously on your realm.

BNGetFriendToonInfo requires two arguments, one of which you don't have without calling some other functions. BNGetFriendInfo is the function you want.

Try this:

Code:
		if not accept then
			for index = 1, BNGetNumFriends() do
				local _, _, _, toonName = BNGetFriendInfo(index)
				if toonName == name then
					accept = true
					break
				end
			end
		end
  Reply With Quote