Plugin developement - Printable Version +- Cuberite Forum (https://forum.cuberite.org) +-- Forum: Plugins (https://forum.cuberite.org/forum-1.html) +--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html) +--- Thread: Plugin developement (/thread-857.html) |
RE: Plugin developement - NiLSPACE - 04-15-2013 maybe you can also add a /tpahere and a /tprefuse. RE: Plugin developement - tonibm19 - 04-15-2013 (04-15-2013, 03:12 AM)STR_Warrior Wrote: maybe you can also add a /tpahere and a /tprefuse.Ok, I will see what I can do. Remember that I started with Lua today so I'm a noob. I'll investigate the code you write and I'll try to add /tpahere RE: Plugin developement - NiLSPACE - 04-15-2013 well it should be pretty easy (i think.) just change the Destination[Player]. EDIT nevermind that won't work. you would then just teleport to yourself ;P RE: Plugin developement - tonibm19 - 04-15-2013 (04-15-2013, 03:58 AM)STR_Warrior Wrote: well it should be pretty easy (i think.) just change the Destination[Player].I did it, I added /tpahere and /tpahereaccept. I thing there is a bug. To test it, I have 2 minecraft windows open, my account tonibm and test. When test send a tpahere request to tonibm, with /tpahereaccept tonibm is teleported to test. But if tonibm sends a tpahere request to test, and then test types /tpahereaccept, nothing happen. RE: Plugin developement - NiLSPACE - 04-15-2013 does "test" has the right permissions? RE: Plugin developement - tonibm19 - 04-15-2013 (04-15-2013, 04:46 AM)STR_Warrior Wrote: does "test" has the right permissions?Yes, it's in Admin But It don't say "Unknow command", only that nothing happen. RE: Plugin developement - NiLSPACE - 04-15-2013 could you post the code again? and if you do it in this form it would be easier to see whats wrong RE: Plugin developement - tonibm19 - 04-15-2013 (04-15-2013, 04:52 AM)STR_Warrior Wrote: could you post the code again? and if you do it inthis form it would be easier to see whats wrong function HandleTPAHERECommand( Split, Player ) if Split[2] == nil then Player:SendMessage( cChatColor.Green .. "Usage: /tpahere [Player]" ) return true end local loopPlayer = function( OtherPlayer ) if OtherPlayer:GetName() == Split[2] then OtherPlayer:SendMessage( cChatColor.Green .. Player:GetName() .. " send a teleport request to you" ) Player:SendMessage( cChatColor.Green .. "You send a teleport request to " .. OtherPlayer:GetName() ) Destination[OtherPlayer:GetName()] = Player:GetName() end end local loopWorlds = function( World ) World:ForEachPlayer( loopPlayer ) end cRoot:Get():ForEachWorld( loopWorlds ) return true end function HandleTPAHerecceptCommand( Split, Player ) if Destination[Player:GetName()] == nil then Player:SendMessage( cChatColor.Green .. "Nobody has send you a teleport request" ) return true end local loopPlayer = function( OtherPlayer ) if Destination[OtherPlayer:GetName()] == Player:GetName() then if OtherPlayer:GetWorld():GetName() ~= Player:GetWorld():GetName() then OtherPlayer:MoveToWorld( Player:GetWorld():GetName() ) end Player:TeleportToEntity( OtherPlayer ) Player:SendMessage( cChatColor.Green .. OtherPlayer:GetName() .. " teleported to you" ) OtherPlayer:SendMessage( cChatColor.Green .. "You teleported to " .. Player:GetName() ) Destination[Player:GetName()] = nil end end local loopWorlds = function( World ) World:ForEachPlayer( loopPlayer ) end cRoot:Get():ForEachWorld( loopWorlds ) return true end EDIT FakeTruth: He means use Code: [shcode=lua]code here inside SHcode tags, not regular code tags. sh stands for Syntax Highlighted or something :D[/shcode] RE: Plugin developement - NiLSPACE - 04-15-2013 well since i can't find the problem by looking at it i'l have to try it myself :S lol it seems like there is no need for a /tpahereaccept command becouse /tpaccept works fine for me both with /tpa and /tpahere. EDIT: Nope was mistaken.. :S RE: Plugin developement - tonibm19 - 04-16-2013 (04-15-2013, 05:12 AM)STR_Warrior Wrote: well since i can't find the problem by looking at it i'l have to try it myself :Sfor me, if you type /tpaccept, it's like /tpa, no /tpahere. You have to type /tpahereaccept. But I have all /tpa commands in the same lua |