Quantcast

Now anyone that uses it will play the song when they see the yell!

Kevin Carpenter [04-18-13 - 04:24]
Now anyone that uses it will play the song when they see the yell!
Filename
BennyHill.lua
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