local COMMAND_PREFIX = {"!", "/"} COMMANDS = { { name = "difficulty", takes_argument = true, func = DifficultyCmd -- name of the function only } } -- yes i copied this from stackoverflow, how can you tell? function string.simplesplit(inputstr, sep) if sep == nil then sep = "%s" end local t = {} for str in string.gmatch(inputstr, "([^" .. sep .. "]+)") do table.insert(t, str) end return t end local function ProcCommand(player, cmd) local cmdprefix = (type(COMMAND_PREFIX) == "table") and COMMAND_PREFIX or {COMMAND_PREFIX} cmd = string.lower(cmd) for _, p in ipairs(cmdprefix) do for _, c in ipairs(COMMANDS) do if string.match(cmd, "^" .. p .. c.name) then if c.takes_argument then argument = string.simplesplit(cmd)[1] or nil c.func(player, argument) return else c.func(player) return end end end end end local function DifficultyCmd(player, addarg) if addarg then if addarg == "serene" or addarg == "easy" then player:DisplayTextChat("DETAILS ABOUT THE DIFFICULTY: \x071FDB32Serene\x07FFFFFF (Easy)") player:DisplayTextChat("- Zombies have reduced health and move speed.") player:DisplayTextChat("- The double damage for zombies at Wave 17+ is disabled.") elseif addarg == "staple" or addarg == "normal" then player:DisplayTextChat("DETAILS ABOUT THE DIFFICULTY: \x071FDB32Staple\x07FFFFFF (Normal)") player:DisplayTextChat("- Zombies have normal health and move speed.") player:DisplayTextChat("- Zombie damage is doubled from Wave 17 onwards.") player:DisplayTextChat("- Selected by default if no votes were made after 15 seconds.") elseif addarg == "struggle" or addarg == "hard" then player:DisplayTextChat("DETAILS ABOUT THE DIFFICULTY: \x079209B8Struggle\x07FFFFFF (Hard)") player:DisplayTextChat("- Zombies have increased health and move speed.") player:DisplayTextChat("- Zombie damage is increased to +50% at Waves 8 - 12, then +100% at Waves 13 - 16, and +167% from Wave 17 onwards.") player:DisplayTextChat("- Bonus weight for scam and weakening penalties is increased to 5.") player:DisplayTextChat("- SOLO MODE ONLY: Permanent Mini-Crits on the solo player.") elseif addarg == "sanguine" or addarg == "expert" then player:DisplayTextChat("DETAILS ABOUT THE DIFFICULTY: \x07941406Sanguine\x07FFFFFF (Expert)") player:DisplayTextChat("- Zombies have even higher health and much faster move speed.") player:DisplayTextChat("- Zombie damage is increased every wave. Milestones include: +50% at Wave 8, +100% at Wave 13, +167% at Wave 17, and +200% at Wave 20.") player:DisplayTextChat("- Bonus weight for scam and weakening penalties is increased to 10.") player:DisplayTextChat("- Mannpowers are binding, cannot be removed, and disappear on death/drop. Snatchers copy Mannpowers instead of stealing them.") player:DisplayTextChat("- SOLO MODE ONLY: Permanent Mini-Crits on the solo player.") end else player:DisplayTextChat("Available Difficulties: Serene (Easy), Staple (Normal), Struggle (Hard), Sanguine (Expert)") player:DisplayTextChat("Type !difficulty in chat to read about each difficulty in detail.") end end function OnPlayerChat(player, chat) print("YES THIS WORKS") ProcCommand(player, chat) end