Actually, looking at your code there is an extra ')' in the guildie check.
-- If that doesn't help then the following debug steps may help narrow down the problem.
Do a print(total) after setting total and make sure that it is returning a value other than 0 or 1. The for loop doing the work won't do anything if that value isn't set.
Also, assuming it gets in that loop and sets the table up, add a print(event,unit) in the "NAME_PLATE_UNIT_ADDED" event code block to make sure it is being executed. To stop it from doing it tons of time put a counter at the top of the file and increment it each time the event is called and only print the event and unit values up to a certain count.
Then, assuming that works as expected, put a print(UnitGUID(unit)) before the play sound to see that there is a value. If this prints and the sound doesn't happen, the sound is the problem. If it doesn't print the check isn't working as expected.
As a side note for more details, once everything is working, you could try the following to get their name etc.
local localizedClass, englishClass, localizedRace, englishRace, sex, name, realm = GetPlayerInfoByGUID(guid)
I'm going to give this a quick spin though to make sure it works minus the guild checking side of things as my guildies are rarely on at the same time as me.
Last edited by Xrystal : 05-02-21 at 11:17 AM.
|