Merge branch 'magicalcarpets' of git://github.com/tigerw/MCServer into tigerw-magicalcarpets
This commit is contained in:
commit
06c8217b65
19
MCServer/Plugins/MagicCarpet/coremessaging.lua
Normal file
19
MCServer/Plugins/MagicCarpet/coremessaging.lua
Normal file
@ -0,0 +1,19 @@
|
||||
Core = cPluginManager:Get():GetPlugin("Core")
|
||||
|
||||
function SendMessage(a_Player, a_Message)
|
||||
if (Core ~= nil) then
|
||||
Core:Call("SendMessage", a_Player, a_Message)
|
||||
end
|
||||
end
|
||||
|
||||
function SendMessageSuccess(a_Player, a_Message)
|
||||
if (Core ~= nil) then
|
||||
Core:Call("SendMessageSuccess", a_Player, a_Message)
|
||||
end
|
||||
end
|
||||
|
||||
function SendMessageFailure(a_Player, a_Message)
|
||||
if (Core ~= nil) then
|
||||
Core:Call("SendMessageFailure", a_Player, a_Message)
|
||||
end
|
||||
end
|
@ -1,18 +1,16 @@
|
||||
local PLUGIN = {}
|
||||
local Carpets = {}
|
||||
|
||||
function Initialize( Plugin )
|
||||
PLUGIN = Plugin
|
||||
|
||||
Plugin:SetName( "MagicCarpet" )
|
||||
Plugin:SetVersion( 1 )
|
||||
Plugin:SetVersion( 2 )
|
||||
|
||||
cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_MOVING, OnPlayerMoving)
|
||||
cPluginManager.AddHook(cPluginManager.HOOK_DISCONNECT, OnDisconnect)
|
||||
|
||||
local PluginManager = cPluginManager:Get()
|
||||
PluginManager:BindCommand("/mc", "magiccarpet", HandleCarpetCommand, " - Spawns a magical carpet");
|
||||
|
||||
LOG( "Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion() )
|
||||
LOG( "Initialised " .. Plugin:GetName() .. " v." .. Plugin:GetVersion() )
|
||||
return true
|
||||
end
|
||||
|
||||
@ -33,14 +31,15 @@ end
|
||||
|
||||
function HandleCarpetCommand( Split, Player )
|
||||
Carpet = Carpets[ Player ]
|
||||
|
||||
if( Carpet == nil ) then
|
||||
Carpets[ Player ] = cCarpet:new()
|
||||
Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "You're on a magic carpet!" )
|
||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Look straight down to descend. Jump to ascend!" )
|
||||
SendMessageSuccess(Player, "You're on a magic carpet!")
|
||||
SendMessage(Player, "Look straight down to descend. Jump to ascend.")
|
||||
else
|
||||
Carpet:remove()
|
||||
Carpets[ Player ] = nil
|
||||
Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "The carpet vanished!" )
|
||||
SendMessageSuccess(Player, "The carpet vanished!")
|
||||
end
|
||||
|
||||
return true
|
||||
|
Loading…
Reference in New Issue
Block a user