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 = {}
|
local Carpets = {}
|
||||||
|
|
||||||
function Initialize( Plugin )
|
function Initialize( Plugin )
|
||||||
PLUGIN = Plugin
|
|
||||||
|
|
||||||
Plugin:SetName( "MagicCarpet" )
|
Plugin:SetName( "MagicCarpet" )
|
||||||
Plugin:SetVersion( 1 )
|
Plugin:SetVersion( 2 )
|
||||||
|
|
||||||
cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_MOVING, OnPlayerMoving)
|
cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_MOVING, OnPlayerMoving)
|
||||||
cPluginManager.AddHook(cPluginManager.HOOK_DISCONNECT, OnDisconnect)
|
cPluginManager.AddHook(cPluginManager.HOOK_DISCONNECT, OnDisconnect)
|
||||||
|
|
||||||
|
local PluginManager = cPluginManager:Get()
|
||||||
PluginManager:BindCommand("/mc", "magiccarpet", HandleCarpetCommand, " - Spawns a magical carpet");
|
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
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -33,14 +31,15 @@ end
|
|||||||
|
|
||||||
function HandleCarpetCommand( Split, Player )
|
function HandleCarpetCommand( Split, Player )
|
||||||
Carpet = Carpets[ Player ]
|
Carpet = Carpets[ Player ]
|
||||||
|
|
||||||
if( Carpet == nil ) then
|
if( Carpet == nil ) then
|
||||||
Carpets[ Player ] = cCarpet:new()
|
Carpets[ Player ] = cCarpet:new()
|
||||||
Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "You're on a magic carpet!" )
|
SendMessageSuccess(Player, "You're on a magic carpet!")
|
||||||
Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "Look straight down to descend. Jump to ascend!" )
|
SendMessage(Player, "Look straight down to descend. Jump to ascend.")
|
||||||
else
|
else
|
||||||
Carpet:remove()
|
Carpet:remove()
|
||||||
Carpets[ Player ] = nil
|
Carpets[ Player ] = nil
|
||||||
Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "The carpet vanished!" )
|
SendMessageSuccess(Player, "The carpet vanished!")
|
||||||
end
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
Loading…
Reference in New Issue
Block a user