08-30-2015, 06:53 AM
before error is -1227 nil 1235
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)
print(X, Height, Z)
end
)
print(X, Height, Z)
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
Its a madness. Values are great, teleportation should work :/