Last active
March 18, 2021 20:22
-
-
Save Krilliac/7d5ca39cf44a62f80dface56604c11bc to your computer and use it in GitHub Desktop.
Core GM Commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--GameMaster Chat Commands | |
--ToDo: Allow only authorized GM/Admins to access and use this command | |
--GameMaster Chat Commands | |
--ToDo: Allow only authorized GM/Admins to access and use this command | |
local commandlist = {"!commands", "!invisible", "!visible", "!fly", "!walk", "!speed"} | |
local invisMsg = "%s is now invisible" | |
local visMsg = "%s is now visible" | |
local flyMsg = "%s is now flying" | |
local walkMsg = "%s is now walking" | |
local newWalkSpeedMsg = "%s is now moving faster" | |
local dieMsg = "%s Dead" | |
local commands = { | |
commands = function(speaker) | |
Chat.BroadcastMessage("Command List: "..table.concat(commandlist, ", ")) | |
end, | |
invisible = function(speaker) | |
speaker:SetVisibility(false) | |
Chat.BroadcastMessage(string.format(invisMsg, speaker)) | |
end, | |
visible = function(speaker) | |
speaker:SetVisibility(true) | |
Chat.BroadcastMessage(string.format(visMsg, speaker)) | |
end, | |
fly = function(speaker) | |
speaker:ActivateFlying(true) | |
Chat.BroadcastMessage(string.format(flyMsg, speaker)) | |
end, | |
walk = function(speaker) | |
speaker:ActivateWalking(true) | |
Chat.BroadcastMessage(string.format(walkMsg, speaker)) | |
end, | |
speed = function(speaker, speed) | |
speaker.maxWalkSpeed = tonumber(speed) or 1300 | |
Chat.BroadcastMessage(string.format(newWalkSpeedMsg, speaker)) | |
end, | |
die = function(speaker, player) | |
speaker.Die = (string.format(player(name))) | |
Chat.BroadcastMessage(string.format(dieMsg, speaker)) | |
end | |
} | |
Chat.receiveMessageHook:Connect(function(speaker, params) | |
local command = params.message:match("^!(%S+)"):lower() | |
if commands[command] then | |
commands[command](speaker, select(2, CoreString.Split(params.message))) | |
end | |
end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment