View Single Post
03/06/23, 12:09 PM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
for memberIndex = 1, GetPlayerGuildMemberIndex(guildId) do
makes no sense as GetPlayerGuildMemberIndex(guildId) will always return your own player's memberIndex in that guild.
So this will always be YOU (ME).
-> "Player" = always YOUR currently logged in character (or account).

If you want to loop the guildIds members and check it's NOT you just use GetPlayerGuildMemberIndex(guildId) once to get your own index and exclude it from the loop then, and for all other entries found do check the zones.


Untested!
Lua Code:
  1. for guildIndex = 1, GetNumGuilds() do
  2.         local guildId = GetGuildId(guildIndex)
  3.         local numMembers, numOnline = GetGuildInfo(guildId)
  4.  
  5.         local myPlayerMemberIndex = GetPlayerGuildMemberIndex(guildId)
  6.  
  7.         for memberIndex = 1, numMembers, 1 do --instead of numMembers you coudl use GetNumGuildMembers(guildId) too, but numMembers is already there so reuse it
  8.             if memberIndex ~= myPlayerMemberIndex then
  9.                 --local memberIndex = GetPlayerGuildMemberIndex(guildId)
  10.                 local memberName, _, _, memberStatus = GetGuildMemberInfo(guildId, memberIndex)
  11.                 local _, _, memberZone = GetGuildMemberCharacterInfo(guildId, memberIndex)
  12.                 if memberName ~= GetUnitDisplayName("player") then
  13.                     if memberZone == GetUnitZone("player") and memberStatus ~= PLAYER_STATUS_OFFLINE then
  14.                         df("|c6666FF[RidinDirty]|r Traveling to " .. memberName .. " locally")----temp test chat
  15.  
  16.                     end
  17.  
  18.                 end
  19.             end
  20.         end
  21.     end
  Reply With Quote