require 'lib.moonloader'
local inicfg = require 'inicfg'
local HLcfg = inicfg.load({}, "stp.ini")
inicfg.save(HLcfg, "stp.ini")
function save()
inicfg.save(HLcfg, "stp.ini")
end
local currId = 1
function main()
while not isSampLoaded() do wait(100) end
sampRegisterChatCommand("choose_tp", function(id)
if id <= #HLcfg then
currId = id
sampAddChatMessage('switched on '..id, -1)
end
end)
sampRegisterChatCommand('set_tp', function(id)
if HLcfg[id] ~= nil then
local curr = {getCharCoordinates(playerPed)}
HLcfg[id].x, HLcfg[id].y, HLcfg[id].z = curr[1], curr[2], curr[3]
else
sampAddChatMessage('didnt existed', -1)
end
end)
sampRegisterChatCommand('add_tp', function()
local curr = {getCharCoordinates(playerPed)}
table.insert(HLcfg, {x = curr[1], y = curr[2], z = curr[3]})
save()
end)
sampRegisterChatCommand('tp', function(id)
if HLcfg[id] ~= nil then
setCharCoordinates(playerPed, HLcfg[id].x, HLcfg[id].y, HLcfg[id].z)
end
end)
wait(-1)
end