Originally Posted by sinnereso
im working on additional feature for my addon and having issues with the "GetFriendInfo()". Im looking to find a specific friend in friends list and check if they're online before executing code. im currently messing with this sort of thing.
Code:
local savedPlayer = xxx.savedVariables.savedPlayer
if not IsPlayerInGroup(savedPlayer) and IsFriend(savedPlayer) then
for iD = 1, GetNumFriends() do
if GetFriendInfo(iD) == (savedPlayer, nil, PLAYER_STATUS_ONLINE, nil) then
the formatting of these keeps messing me up.. ive tried in brackets etc. Any suggestions for something I've missed?
|
That's not valid Lua syntax.
You need to store each return value you want to compare into a local variable and then compare each of them separately:
Lua Code:
local savedPlayer = xxx.savedVariables.savedPlayer
if not IsPlayerInGroup(savedPlayer) and IsFriend(savedPlayer) then
for iD = 1, GetNumFriends() do
local friendName, _, status = GetFriendInfo(iD)
if friendName == savedPlayer and status == PLAYER_STATUS_ONLINE then