View Single Post
08-05-17, 12:35 PM   #8
Eragon_Edward
A Murloc Raider
Join Date: Aug 2017
Posts: 5
Originally Posted by Fizzlemizz View Post
I'm not sure if that was an actual question but if so, something like:
Lua Code:
  1. local msgList = {
  2.     { "GUILD", "Message 1" },
  3.     { "YELL", "Message 2" },
  4.     { "PARTY", "Message 3" },
  5. }
  6. local function PrintList()
  7.     print("Help commands = /ph or /sph\nOption = Send - Message:")
  8.     for i=1, #msgList do
  9.         print(i, "=", msgList[i][1], "-", msgList[i][2])
  10.     end
  11. end
  12.  
  13. SLASH_PHRASE1 = "/ph";
  14. SLASH_PHRASE2 = "/sph";
  15. SlashCmdList["PHRASE"] = function(msg)
  16.     if msg == "" then
  17.         PrintList()
  18. ----------------------------------------------------------------------------------------------------
  19.     else
  20.         local cmd = tonumber(msg)
  21.         if msgList[cmd] then
  22.             SendChatMessage(msgList[cmd][2], msgList[cmd][1])
  23.         else
  24.             print("Not a valid option")
  25.         end
  26.     end
  27. end
  28. ----------------------------------------------------------------------------------------------------
Ok now I got it! (the first part) , thank you , now i could not understand all the rest of the code (the one between the lines) exactly how it works down there? ,if you are so kind to explain it for a really dummy :P
  Reply With Quote