From f65115ef9f200aa882d517c3ade53919a0e57114 Mon Sep 17 00:00:00 2001 From: "lapayo94@gmail.com" Date: Mon, 26 Dec 2011 16:43:45 +0000 Subject: GameMode Switch added to Core Functions (/gm 0 | /gm 1) needs permission core.changegm git-svn-id: http://mc-server.googlecode.com/svn/trunk@123 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- Plugins/Core.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 -- cgit v1.2.3