The latest script update changes how coordinates are handled: it now glides smoothly to the destination instead of jumping directly there. Is there any advantage to this new method? Also, I’ve made some tweaks to the pre-defined teleport settings. Here’s my method:
- Usage: Press '1' to teleport to the previous location, press '2' to teleport to the next location
Code: Select all
{$lua}
if syntaxcheck then return end
[ENABLE]
-- coords
coords = {
{-434.0650634765625, 196.7327880859375, 125.8191909790039},
{-442.434326171875, 196.92933654785156, 126.36478424072266},
{-435.1515808105469, 196.59423828125, 114.17571258544922},
{-428.2901306152344, 196.90032958984375, 106.10945892333984},
{-431.1561584472656, 197.1288604736328, 118.88468170166016},
{-422.8909912109375, 196.61524963378906, 119.42495727539062},
{-427.2716369628906, 197.09629821777344, 120.89807891845703},
{-420.4129333496094, 196.7722625732422, 110.73902893066406},
{-416.8428039550781, 197.6248779296875, 117.3946762084961},
{-414.08978271484375, 198.43763732910156, 113.90576171875},
{-31.244253158569336, 157.44467163085938, 123.84048461914062},
{-25.177522659301758, 149.2626495361328, 113.31632232666016},
{-17.872663497924805, 156.8743438720703, 39.101139068603516},
{-20.580171585083008, 158.94158935546875, 26.917245864868164},
{1.4737073183059692, 150.24215698242188, 78.46833038330078},
{7.607182502746582, 151.29530334472656, 58.5430908203125},
{44.61483383178711, 156.4333953857422, 81.00585174560547},
{45.74073028564453, 156.81103515625, 90.36058807373047},
{50.310909271240234, 157.7774200439453, 82.3095703125},
{62.438663482666016, 160.93963623046875, 81.02312469482422},
{50.33897018432617, 156.07421875, 111.83123779296875},
{20.319795608520508, 172.40145874023438, 104.788330078125},
{23.90431022644043, 156.40342712402344, 109.71389770507812},
{1.2447913885116577, 162.6338348388672, 148.1076202392578},
{6.675168991088867, 162.28199768066406, 144.3789520263672},
{15.7, 155.2, 102.8},
{-28.314294815063477, 148.69432067871094, 125.12788391113281},
{27.84032440185547, 175.02781677246094, 106.41901397705078},
{5.677907943725586, 163.42144775390625, 159.9477081298828}
}
currentIndex = 1
keyPressed = false
function teleportToCoords(index)
local coord = coords[index]
writeFloat("[p_coord]+00", coord[3]) -- X
writeFloat("[p_coord]+04", coord[2]) -- Y
writeFloat("[p_coord]+08", coord[1]) -- Z
speak("Teleported to coordinates " .. index)
end
function checkKeys()
if isKeyPressed(VK_1) and not keyPressed then
currentIndex = currentIndex - 1
if currentIndex < 1 then
currentIndex = #coords
end
teleportToCoords(currentIndex)
keyPressed = true
elseif isKeyPressed(VK_2) and not keyPressed then
currentIndex = currentIndex + 1
if currentIndex > #coords then
currentIndex = 1
end
teleportToCoords(currentIndex)
keyPressed = true
elseif not (isKeyPressed(VK_1) or isKeyPressed(VK_2)) then
keyPressed = false
end
end
t = createTimer(nil)
timer_setInterval(t, 10)
timer_onTimer(t, checkKeys)
timer_setEnabled(t, true)
[DISABLE]
timer_setEnabled(t, false)