MagicCarpet Fixes [SEE DESC]
+ Version 2! * Fixed loading plugin + Now uses Core messaging functions
This commit is contained in:
parent
21b23ff1e7
commit
a171757f1a
@ -1,18 +1,18 @@
|
||||
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 +33,17 @@ end
|
||||
|
||||
function HandleCarpetCommand( Split, Player )
|
||||
Carpet = Carpets[ Player ]
|
||||
PluginManager = cPluginManager:Get()
|
||||
local Core = PluginManager:GetPlugin("Core")
|
||||
|
||||
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!" )
|
||||
Core:Call("SendMessageSuccess", Player, "You're on a magic carpet!")
|
||||
Core:Call("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!" )
|
||||
Core:Call("SendMessage", Player, "The carpet vanished!")
|
||||
end
|
||||
|
||||
return true
|
||||
|
Loading…
Reference in New Issue
Block a user