diff options
Diffstat (limited to 'MCServer/Plugins/MagicCarpet/plugin.lua')
-rw-r--r-- | MCServer/Plugins/MagicCarpet/plugin.lua | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/MCServer/Plugins/MagicCarpet/plugin.lua b/MCServer/Plugins/MagicCarpet/plugin.lua index 22604c9d9..2c9fb9160 100644 --- a/MCServer/Plugins/MagicCarpet/plugin.lua +++ b/MCServer/Plugins/MagicCarpet/plugin.lua @@ -8,16 +8,19 @@ function Initialize( Plugin ) Plugin:SetVersion( 1 )
PluginManager = cRoot:Get():GetPluginManager()
- PluginManager:AddHook( Plugin, cPluginManager.E_PLUGIN_PLAYER_MOVE)
- PluginManager:AddHook( Plugin, cPluginManager.E_PLUGIN_DISCONNECT)
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_MOVING)
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_DISCONNECT)
- Plugin:AddCommand("/mc", " - Spawns a magical carpet!", "magiccarpet")
- Plugin:BindCommand( "/mc", "magiccarpet", HandleCarpetCommand )
+ PluginManager:BindCommand("/mc", "magiccarpet", HandleCarpetCommand, " - Spawns a magical carpet");
Log( "Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion() )
return true
end
+
+
+
+
function OnDisable()
Log( PLUGIN:GetName() .. " v." .. PLUGIN:GetVersion() .. " is shutting down..." )
for i, Carpet in pairs( Carpets ) do
@@ -25,6 +28,10 @@ function OnDisable() end
end
+
+
+
+
function HandleCarpetCommand( Split, Player )
Carpet = Carpets[ Player ]
if( Carpet == nil ) then
@@ -39,6 +46,10 @@ function HandleCarpetCommand( Split, Player ) return true
end
+
+
+
+
function OnDisconnect( Reason, Player )
local Carpet = Carpets[ Player ]
if( Carpet ~= nil ) then
@@ -47,14 +58,18 @@ function OnDisconnect( Reason, Player ) Carpets[ Player ] = nil
end
-function OnPlayerMove( Player )
+
+
+
+
+function OnPlayerMoving(Player)
local Carpet = Carpets[ Player ]
if( Carpet == nil ) then
return
end
if( Player:GetPitch() == 90 ) then
- Carpet:moveTo( cLocation:new( Player:GetPosX(), Player:GetPosY()-1, Player:GetPosZ() ) )
+ Carpet:moveTo( cLocation:new( Player:GetPosX(), Player:GetPosY() - 1, Player:GetPosZ() ) )
else
if( Player:GetPosY() < Carpet:getY() ) then
LOGINFO("Fell tru mc!")
@@ -62,4 +77,7 @@ function OnPlayerMove( Player ) end
Carpet:moveTo( cLocation:new( Player:GetPosX(), Player:GetPosY(), Player:GetPosZ() ) )
end
-end
\ No newline at end of file +end
+
+
+
|