diff --git a/Plugins/Core.lua b/Plugins/Core.lua index 5b98fcbaa..5090dcf95 100644 --- a/Plugins/Core.lua +++ b/Plugins/Core.lua @@ -45,6 +45,7 @@ function CorePlugin:Initialize() self:AddCommand("/ban", " - [Player] - Ban a player", "core.ban") self:AddCommand("/unban", " - [Player] - Unban a player", "core.unban") self:AddCommand("/top", " - Teleport yourself to the top most block", "core.top") + self:AddCommand("/gm", " - [Gamemode (0|1)] - Change your gamemode", "core.changegm") self:BindCommand( "/help", "core.help", HandleHelpCommand ) self:BindCommand( "/pluginlist","core.pluginlist", HandlePluginListCommand ) @@ -63,6 +64,7 @@ function CorePlugin:Initialize() self:BindCommand( "/ban", "core.ban", HandleBanCommand ) self:BindCommand( "/unban", "core.unban", HandleUnbanCommand ) self:BindCommand( "/top", "core.top", HandleTopCommand ) + self:BindCommand( "/gm", "core.changegm", HandleChangeGMCommand ) local IniFile = cIniFile("settings.ini") if ( IniFile:ReadFile() == true ) then @@ -408,6 +410,17 @@ function HandleTPCommand( Split, Player ) return true end +function HandleChangeGMCommand( Split, Player ) + if( #Split ~= 2 ) then + Player:SendMessage( cChatColor.Green .. "Usage: /gm [GameMode (0|1)]" ) + return true + end + + Player:SetGameMode(Split[2]) + + return true +end + function CorePlugin:OnPlayerJoin( Player ) ShowMOTDTo( Player ) return false