08-30-2015, 04:59 AM
![[Image: errrr.png]](http://vcraft.pl/hosting/errrr.png)
PHP Code:
function Initialize(Plugin)
    Plugin:SetName("RandomTP")
    Plugin:SetVersion(1)
    cPluginManager.BindCommand("/rtp", "randomTP.rtp", Randomtp, " ~ Random Teleport");
    LOG("Initialised " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
    return true
end
function Randomtp(Split, Player)
    if (#Split ~= 1) then
        Player:SendMessage("Usage: /rtp")
        return true
    else
        local X = math.random(-2000, 2000)
        local Z = math.random(-2000, 2000)
        local _, Height
         
        local World = Player:GetWorld()
        World:ChunkStay({{math.floor(X / 16), math.floor(Z / 16)}}, nil,  
            function()
                _, Height = World:TryGetHeight(X, Z)
            end
        )
        Player:TeleportToCoords(X, Height, Z)
        Player:SendMessage(cChatColor.Yellow .. "Cords")
        Player:SendMessage("X: " .. X)
        Player:SendMessage("Y: " .. Height)
        Player:SendMessage("Z: " .. Z)
    end
    return true
end 
![[Image: errrrr.png]](http://vcraft.pl/hosting/errrrr.png)