From 46e2fb36af7aaf3ccce4774ef0fd7e053fbff0d4 Mon Sep 17 00:00:00 2001 From: Kevin Carpenter Date: Wed, 17 Apr 2013 23:24:28 -0500 Subject: [PATCH] Now anyone that uses it will play the song when they see the yell! --- BennyHill.lua | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/BennyHill.lua b/BennyHill.lua index 2feb525..5d42f33 100644 --- a/BennyHill.lua +++ b/BennyHill.lua @@ -11,12 +11,29 @@ function SlashCmdList_AddSlashCommand(name, func, ...) end SlashCmdList_AddSlashCommand('BENNY_HILL', function(msg) - - PlaySoundFile("Interface\\AddOns\\BennyHill\\benny_hill.mp3"); + if UnitName("Player") == "Nakazz" then + SendChatMessage("My name's Nakazz and I hit stuff with other stuff", "YELL") + elseif UnitName("Player") == "Portapotion" then + SendChatMessage("My name's Portapotion and I'm gonna do pet battles", "YELL", "THALASSIAN") + elseif UnitName("Player") == "Farmform" then + SendChatMessage("My name's Farmform and I farm things.", "YELL", "TAURAHE") + else + SendChatMessage("This is sheer craziness!", "YELL") + end + ChatFrame1:AddMessage("|cFFFF2222Benny Hill time!|r") + PlaySoundFile("Interface\\AddOns\\BennyHill\\benny_hill.mp3", "Music"); end, 'bennyhill', 'bh') -local frame = CreateFrame("Frame") -frame:RegisterEvent("PLAYER_LOGIN") +local frame = CreateFrame("FRAME") +frame:RegisterEvent("CHAT_MSG_YELL") + frame:SetScript("OnEvent", function(self, event, ...) - ChatFrame1:AddMessage(UnitName("Player") ..' has logged in.') + --ChatFrame1:AddMessage("Testing") + -- msg, author, lang, chatline, guid + local msg = select(1, ...) + local author = select(2, ...) + --ChatFrame1:AddMessage(msg .. " was said by " .. author) + if msg == "This is sheer craziness!" and UnitName("Player") ~= author then + PlaySoundFile("Interface\\AddOns\\BennyHill\\benny_hill.mp3", "Music"); + end end) \ No newline at end of file -- 1.7.9.5