Plugin developement
#21
maybe you can also add a /tpahere and a /tprefuse.
Reply
Thanks given by:
#22
(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
Reply
Thanks given by:
#23
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
Reply
Thanks given by:
#24
(04-15-2013, 03:58 AM)STR_Warrior Wrote: 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
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.
Reply
Thanks given by:
#25
does "test" has the right permissions?
Reply
Thanks given by:
#26
(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.
Reply
Thanks given by:
#27
could you post the code again? Wink and if you do it in
this form it would be easier to see whats wrong
Reply
Thanks given by:
#28
(04-15-2013, 04:52 AM)STR_Warrior Wrote: could you post the code again? Wink and if you do it in
this 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]
Reply
Thanks given by:
#29
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
Reply
Thanks given by: tonibm19
#30
(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 :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
for 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
Reply
Thanks given by:




Users browsing this thread: 1 Guest(s)