- 283
- 90
- Версия MoonLoader
- .026-beta
Не работает код. посмотрите пж. возможно енд не там поставил
moonloader.log
Lua:
script_name("{ff4500}Teleport_Master")
script_author("c0rt_quw1n")
local inicfg = require 'inicfg'
local sampfuncs = require 'sampfuncs'
local sampev = 'lib.samp.events'
local raknet = 'lib.samp.raknet'
local imgui = require('imgui')
local encoding = require('encoding')
local rkeys = require('rkeys')
local vk = require('vkeys')
local inicfg = require('inicfg')
imgui.HotKey = require('imgui_addons').HotKey
encoding.default = 'CP1251'
local u8 = encoding.UTF8
local menu = imgui.ImBool(false)
local tag = "{00FF7F}[{ffffff}Teleport Master{00FF7F}] {FFFFFF}"
local id = select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))
local nickname = sampGetPlayerNickname(id)
local clientId = sampGetPlayerIdByCharHandle(playerPed)
local res, clientName = sampGetPlayerNickname(clientId)
local _, id = sampGetPlayerIdByCharHandle(playerPed)
local main_window_state = imgui.ImBool(false)
local test_text_buffer = imgui.ImBuffer(256)
local tabSize = imgui.ImVec2(100, 20)
local selectedTab = 1
local frontX, frontY, frontZ, camX, camY, camZ = 0, 0, 0, 0, 0, 0
function samp_create_sync_data(sync_type, copy_from_player)
local ffi = require 'ffi'
local sampfuncs = require 'sampfuncs'
-- from SAMP.Lua
local raknet = require 'samp.raknet'
require 'samp.synchronization'
copy_from_player = copy_from_player or true
local sync_traits = {
player = {'PlayerSyncData', raknet.PACKET.PLAYER_SYNC, sampStorePlayerOnfootData},
vehicle = {'VehicleSyncData', raknet.PACKET.VEHICLE_SYNC, sampStorePlayerIncarData},
passenger = {'PassengerSyncData', raknet.PACKET.PASSENGER_SYNC, sampStorePlayerPassengerData},
aim = {'AimSyncData', raknet.PACKET.AIM_SYNC, sampStorePlayerAimData},
trailer = {'TrailerSyncData', raknet.PACKET.TRAILER_SYNC, sampStorePlayerTrailerData},
unoccupied = {'UnoccupiedSyncData', raknet.PACKET.UNOCCUPIED_SYNC, nil},
bullet = {'BulletSyncData', raknet.PACKET.BULLET_SYNC, nil},
spectator = {'SpectatorSyncData', raknet.PACKET.SPECTATOR_SYNC, nil}
}
local sync_info = sync_traits[sync_type]
local data_type = 'struct ' .. sync_info[1]
local data = ffi.new(data_type, {})
local raw_data_ptr = tonumber(ffi.cast('uintptr_t', ffi.new(data_type .. '*', data)))
-- copy player's sync data to the allocated memory
if copy_from_player then
local copy_func = sync_info[3]
if copy_func then
local _, player_id
if copy_from_player == true then
_, player_id = sampGetPlayerIdByCharHandle(PLAYER_PED)
else
player_id = tonumber(copy_from_player)
end
copy_func(player_id, raw_data_ptr)
end
end
-- function to send packet
local func_send = function()
local bs = raknetNewBitStream()
raknetBitStreamWriteInt8(bs, sync_info[2])
raknetBitStreamWriteBuffer(bs, raw_data_ptr, ffi.sizeof(data))
raknetSendBitStreamEx(bs, sampfuncs.HIGH_PRIORITY, sampfuncs.UNRELIABLE_SEQUENCED, 1)
raknetDeleteBitStream(bs)
end
-- metatable to access sync data and 'send' function
local mt = {
__index = function(t, index)
return data[index]
end,
__newindex = function(t, index, value)
data[index] = value
end
}
return setmetatable({send = func_send}, mt)
end
function main()
if not isSampfuncsLoaded() or not isSampLoaded() then return end
while not isSampAvailable() do wait(100) end
menu = 1
sampAddChatMessage(tag.. "Запущен!", -1)
sampRegisterChatCommand("tpm", cmd_tpm)
imgui.Process = false
while true do
wait(0)
if show_main_window.v == false then
imgui.Process = false
end
end
end
function imgui.TextQuestion(text)
imgui.TextDisabled(u8'(?)')
if imgui.IsItemHovered() then
imgui.BeginTooltip()
imgui.PushTextWrapPos(450)
imgui.TextUnformatted(text)
imgui.PopTextWrapPos()
imgui.EndTooltip()
end
end
function imgui.OnDrawFrame()
if not main_window_state.v then
imgui.Process = false
end
if main_window_state.v then
local xw, yw = getScreenResolution()
imgui.SetNextWindowSize(imgui.ImVec2(500, 300), imgui.Cond.FirstUseEver)
imgui.SetNextWindowPos(imgui.ImVec2(xw / 2, yw / 2), imgui.Cond.FirstUseEver)
imgui.Begin('Teleport Master', menu, imgui.WindowFlags.NoResize)
imgui.BeginChild('##tabs', imgui.ImVec2(-1, 20))
if imgui.ButtonActivated(selectedTab == 1, u8'Работы для новичков', tabSize) then
selectedTab = 1
end
imgui.SameLine()
if imgui.ButtonActivated(selectedTab == 2, u8'Банк г.Арзамас', tabSize) then
selectedTab = 2
end
if imgui.ButtonActivated(selectedTab == 3, u8'Автолюбителям', tabSize) then
selectedTab = 3
end
if imgui.ButtonActivated(selectedTab == 4, u8'Важные места', tabSize) then
selectedTab = 4
end
if imgui.ButtonActivated(selectedTab == 5, u8'Базы организаций', tabSize) then
selectedTab = 5
end
if imgui.ButtonActivated(selectedTab == 6, u8'Торговля и финансы', tabSize) then
selectedTab = 6
end
if imgui.ButtonActivated(selectedTab == 7, u8'Разное', tabSize) then
selectedTab = 7
end
if imgui.ButtonActivated(selectedTab == 8, u8'Развлечения', tabSize) then
selectedTab = 8
end
imgui.EndChild()
imgui.Separator()
imgui.BeginChild('##options', imgui.ImVec2(-1, -1))
if selectedTab == 1 then
if imgui.Button('Шахта') then
-- -2596.11 -1243.61 9.62
local data = samp_create_sync_data('player')
data.position.x = -2596.11
data.position.y = -1243.61
data.position.z = 9.62
data.send()
end
if imgui.Button('Порт') then
-- 3047.75 -351.42 3.00
local data = samp_create_sync_data('player')
data.position.x = 3047.75
data.position.y = -351.42
data.position.z = 3.00
data.send()
end
if imgui.Button('Леспилка') then
-- 1586.33 -844.28 40.08
local data = samp_create_sync_data('player')
data.position.x = 1586.33
data.position.y = -844.28
data.position.z = 40.08
data.send()
end
if imgui.Button('Водолаз') then
-- 2813.88 -2554.99 10.47
local data = samp_create_sync_data('player')
data.position.x = 2813.88
data.position.y = -2554.99
data.position.z = 10.47
data.send()
end
if imgui.Button('Маривана') then
-- -228.07 -1139.96 41.05
local data = samp_create_sync_data('player')
data.position.x = -228.07
data.position.y = -1139.96
data.position.z = 41.05
data.send()
end
if imgui.Button('Батыревское ясо') then
-- 2242.07 1439.99 11.56
local data = samp_create_sync_data('player')
data.position.x = 2242.07
data.position.y = 1439.99
data.position.z = 11.56
data.send()
end
if selectedTab == 2 then
if imgui.Button('Банк г.Арзамас') then
-- 358.67 759.07 12.00
local data = samp_create_sync_data('player')
data.position.x = 358.67
data.position.y = 759.07
data.position.z = 12.00
data.send()
end
end
if selectedTab == 3 then
if imgui.Button('Семейный автосалон') then
-- 2480.31 -723.00 12.37
local data = samp_create_sync_data('player')
data.position.x = 2480.31
data.position.y = -723.00
data.position.z = 12.37
data.send()
end
if imgui.Button('Авторынок Арзамаса') then
-- 806.18 727.00 12.00
local data = samp_create_sync_data('player')
data.position.x = 806.18
data.position.y = 727.00
data.position.z = 12.00
data.send()
end
if imgui.Button('Элитный авторынок') then
-- -2505.91 2040.42 53.01
local data = samp_create_sync_data('player')
data.position.x = -2505.91
data.position.y = 2040.42
data.position.z = 53.01
data.send()
end
if imgui.Button('СТО') then
-- 2120.51 -1830.42 18.82
local data = samp_create_sync_data('player')
data.position.x = 2120.51
data.position.y = -1830.42
data.position.z = 18.82
data.send()
end
end
if selectedTab == 4 then
if imgui.Button('Автошкола') then
-- 633.59 680.72 12.07
local data = samp_create_sync_data('player')
data.position.x = 633.59
data.position.y = 680.72
data.position.z = 12.07
data.send()
end
if imgui.Button('Военкомат') then
-- 2583.89 -1795.37 12.96
local data = samp_create_sync_data('player')
data.position.x = 2583.89
data.position.y = -1795.37
data.position.z = 12.96
data.send()
end
if imgui.Button('Общага') then
-- -197.91 627.50 12.00
local data = samp_create_sync_data('player')
data.position.x = -197.91
data.position.y = 627.50
data.position.z = 12.00
data.send()
end
end
if selectedTab == 5 then
if imgui.Button('Больница Арзамаса') then
-- -285.50 588.72 12.18
local data = samp_create_sync_data('player')
data.position.x = -285.50
data.position.y = 588.72
data.position.z = 12.18
data.send()
end
if imgui.Button('Больница Южного')
-- 2113.20 -2386.42 21.94
local data = samp_create_sync_data('player')
data.position.x = 2113.20
data.position.y = -2386.42
data.position.z = 21.94
data.send()
end
if imgui.Button('ИК') then
-- -1698.04 -2799.42 13.39
local data = samp_create_sync_data('player')
data.position.x = -1698.04
data.position.y = -2799.42
data.position.z = 13.39
data.send()
end
if imgui.Button('СВ') then
-- -900.71 1952.01 45.85
local data = samp_create_sync_data('player')
data.position.x = -900.71
data.position.y = 1952.01
data.position.z = 45.85
data.send()
end
if imgui.Button('ППC') then
-- -462.61 961.59 12.19
local data = samp_create_sync_data('player')
data.position.x = -462.61
data.position.y = 961.59
data.position.z = 12.19
data.send()
end
if imgui.Button('Радиоцентр') then
-- 2141.22 -2020.47 18.81
local data = samp_create_sync_data('player')
data.position.x = 2141.22
data.position.y = -2020.47
data.position.z = 18.81
data.send()
end
if imgui.Button('ГИБДД') then
-- 2584.43 -2403.15 22.01
local data = samp_create_sync_data('player')
data.position.x = 2584.43
data.position.y = -2403.15
data.position.z = 22.01
data.send()
end
if imgui.Button('ФСБ') then
-- 2381.86 -1863.93 21.95
local data = samp_create_sync_data('player')
data.position.x = 2381.86
data.position.y = -1863.93
data.position.z = 21.95
data.send()
end
if imgui.Button('КБ') then
-- -2409.63 160.79 21.17
local data = samp_create_sync_data('player')
data.position.x = -2409.63
data.position.y = 160.79
data.position.z = 21.17
data.send()
end
if imgui.Button('ББ') then
-- 1896.04 2154.35 15.86
local data = samp_create_sync_data('player')
data.position.x = 1896.04
data.position.y = 2154.35
data.position.z = 15.86
data.send()
end
if imgui.Button('ЛБ') then
-- 2469.30 2829.91 37.61
local data = samp_create_sync_data('player')
data.position.x = 2469.30
data.position.y = 2829.91
data.position.z = 37.61
data.send()
end
if imgui.Button('ВБ') then
-- 89.54 2886.77 1.19
local data = samp_create_sync_data('player')
data.position.x = 89.54
data.position.y = 2886.77
data.position.z = 1.19
data.send()
end
if imgui.Button('МЧС') then
-- 2132.94 1802.03 12.05
local data = samp_create_sync_data('player')
data.position.x = 2132.94
data.position.y = 1802.03
data.position.z = 12.05
data.send()
end
if imgui.Button('ВМФ') then
-- 532.37 2812.57 2.04
local data = samp_create_sync_data('player')
data.position.x = 532.37
data.position.y = 2812.57
data.position.z = 2.04
data.send()
end
if imgui.Button('Сепары') then
-- -1929.23 -570.81 40.88
local data = samp_create_sync_data('player')
data.position.x = -1929.23
data.position.y = -570.81
data.position.z = 40.88
data.send()
end
if imgui.Button('Сепары') then
-- 1955.93 -2949.40 10.01
local data = samp_create_sync_data('player')
data.position.x = 1955.93
data.position.y = -2949.40
data.position.z = 10.01
data.send()
end
end -- selectedTab конец 5
if selectedTab == 6 then
if imgui.Button('Торговый рынок') then
-- 1894.49 1885.27 13.22
local data = samp_create_sync_data('player')
data.position.x = 1894.49
data.position.y = 1885.27
data.position.z = 13.22
data.send()
end
if imgui.Button('Биржа') then
-- 1852.49 2053.27 15.55
local data = samp_create_sync_data('player')
data.position.x = 1852.49
data.position.y = 2053.27
data.position.z = 15.55
data.send()
end
if imgui.Button('Агенство недвижимости') then
-- 2199.96 -1714.46 22.01
local data = samp_create_sync_data('player')
data.position.x = 2199.96
data.position.y = -1714.46
data.position.z = 22.01
data.send()
end
end -- конец 6 selectedTab
if selectedTab == 7 then
if imgui.Button('Веселая лавка') then
-- 2202.35 -224.38 2.70
local data = samp_create_sync_data('player')
data.position.x = 2202.35
data.position.y = -224.38
data.position.z = 2.70
data.send()
end
if imgui.Button('Ночной клуб') then
-- 1851.69 2187.43 15.89
local data = samp_create_sync_data('player')
data.position.x = 1851.69
data.position.y = 2187.43
data.position.z = 15.89
data.send()
end
end -- конец 7 selectedTab
if selectedTab == 7 then
if imgui.Button('комп. клуб арз') then
-- 252.96 463.41 12.00
local data = samp_create_sync_data('player')
data.position.x = 252.96
data.position.y = 463.41
data.position.z = 12.00
data.send()
end
if imgui.Button('Казино Арзамас') then
-- -110.91 981.78 12.15
local data = samp_create_sync_data('player')
data.position.x = -110.91
data.position.y = 981.78
data.position.z = 12.15
data.send()
end
if imgui.Button('Контейнеры') then
-- 3103.03 -442.22 2.33
local data = samp_create_sync_data('player')
data.position.x = 3103.03
data.position.y = -442.22
data.position.z = 2.33
data.send()
end
end -- конец 8 selectedTab
imgui.EndChild()
imgui.End()
end
end
end
function main()
while true do
wait(0)
if wasKeyPressed(key.VK_J) then
main_window_state.v = not main_window_state.v
end
imgui.Process = main_window_state.v
end
end
function cmd_tpm(arg)
show_main_window.v = not show_main_window.v
imgui.Process = show_main_window.v end
function imgui.TextColoredRGB(string)
local style = imgui.GetStyle()
local colors = style.Colors
local clr = imgui.Col
local function color_imvec4(color)
if color:upper() == 'SSSSSS' then return colors[clr.Text] end
local color = type(color) == 'number' and ('%X'):format(color):upper() or color:upper()
local rgb = {}
for i = 1, #color/2 do rgb[#rgb+1] = tonumber(color:sub(2*i-1, 2*i), 16) end
return imgui.ImVec4(rgb[1]/255, rgb[2]/255, rgb[3]/255, rgb[4] and rgb[4]/255 or colors[clr.Text].w)
end
local function render_text(string)
local text, color = {}, {}
local m = 1
while string:find('{......}') do
local n, k = string:find('{......}')
text[#text], text[#text+1] = string:sub(m, n-1), string:sub(k+1, #string)
color[#color+1] = color_imvec4(string:sub(n+1, k-1))
local t1, t2 = string:sub(1, n-1), string:sub(k+1, #string)
string = t1..t2
m = k-7
end
if text[0] then
for i, _ in ipairs(text) do
imgui.TextColored(color[i] or colors[clr.Text], u8(text[i]))
imgui.SameLine(nil, 0)
end
imgui.NewLine()
else imgui.Text(u8(string)) end
end
render_text(string)
end
function imgui.CenterTextColoredRGB(text)
local width = imgui.GetWindowWidth()
local style = imgui.GetStyle()
local colors = style.Colors
local ImVec4 = imgui.ImVec4
local explode_argb = function(argb)
local a = bit.band(bit.rshift(argb, 24), 0xFF)
local r = bit.band(bit.rshift(argb, 16), 0xFF)
local g = bit.band(bit.rshift(argb, 8), 0xFF)
local b = bit.band(argb, 0xFF)
return a, r, g, b
end
local getcolor = function(color)
if color:sub(1, 6):upper() == 'SSSSSS' then
local r, g, b = colors[1].x, colors[1].y, colors[1].z
local a = tonumber(color:sub(7, 8), 16) or colors[1].w * 255
return ImVec4(r, g, b, a / 255)
end
local color = type(color) == 'string' and tonumber(color, 16) or color
if type(color) ~= 'number' then return end
local r, g, b, a = explode_argb(color)
return imgui.ImColor(r, g, b, a):GetVec4()
end
local render_text = function(text_)
for w in text_:gmatch('[^\r\n]+') do
local textsize = w:gsub('{.-}', '')
local text_width = imgui.CalcTextSize(u8(textsize))
imgui.SetCursorPosX( width / 2 - text_width .x / 2 )
local text, colors_, m = {}, {}, 1
w = w:gsub('{(......)}', '{%1FF}')
while w:find('{........}') do
local n, k = w:find('{........}')
local color = getcolor(w:sub(n + 1, k - 1))
if color then
text[#text], text[#text + 1] = w:sub(m, n - 1), w:sub(k + 1, #w)
colors_[#colors_ + 1] = color
m = n
end
w = w:sub(1, n - 1) .. w:sub(k + 1, #w)
end
if text[0] then
for i = 0, #text do
imgui.TextColored(colors_[i] or colors[1], u8(text[i]))
imgui.SameLine(nil, 0)
end
imgui.NewLine()
else
imgui.Text(u8(w))
end
end
end
render_text(text)
end
function theme()
imgui.SwitchContext()
local style = imgui.GetStyle()
local colors = style.Colors
local clr = imgui.Col
local ImVec4 = imgui.ImVec4
local ImVec2 = imgui.ImVec2
style.WindowPadding = imgui.ImVec2(8, 8)
style.WindowRounding = 6
style.ChildWindowRounding = 5
style.FramePadding = imgui.ImVec2(5, 3)
style.FrameRounding = 3.0
style.ItemSpacing = imgui.ImVec2(5, 4)
style.ItemInnerSpacing = imgui.ImVec2(4, 4)
style.IndentSpacing = 21
style.ScrollbarSize = 10.0
style.ScrollbarRounding = 13
style.GrabMinSize = 8
style.GrabRounding = 1
style.WindowTitleAlign = imgui.ImVec2(0.5, 0.5)
style.ButtonTextAlign = imgui.ImVec2(0.5, 0.5)
colors[clr.Text] = ImVec4(0.95, 0.96, 0.98, 1.00);
colors[clr.TextDisabled] = ImVec4(0.29, 0.29, 0.29, 1.00);
colors[clr.WindowBg] = ImVec4(0.14, 0.14, 0.14, 1.00);
colors[clr.ChildWindowBg] = ImVec4(0.12, 0.12, 0.12, 1.00);
colors[clr.PopupBg] = ImVec4(0.08, 0.08, 0.08, 0.94);
colors[clr.Border] = ImVec4(0.14, 0.14, 0.14, 1.00);
colors[clr.BorderShadow] = ImVec4(1.00, 1.00, 1.00, 0.10);
colors[clr.FrameBg] = ImVec4(0.22, 0.22, 0.22, 1.00);
colors[clr.FrameBgHovered] = ImVec4(0.18, 0.18, 0.18, 1.00);
colors[clr.FrameBgActive] = ImVec4(0.09, 0.12, 0.14, 1.00);
colors[clr.TitleBg] = ImVec4(0.14, 0.14, 0.14, 0.81);
colors[clr.TitleBgActive] = ImVec4(0.14, 0.14, 0.14, 1.00);
colors[clr.TitleBgCollapsed] = ImVec4(0.00, 0.00, 0.00, 0.51);
colors[clr.MenuBarBg] = ImVec4(0.20, 0.20, 0.20, 1.00);
colors[clr.ScrollbarBg] = ImVec4(0.02, 0.02, 0.02, 0.39);
colors[clr.ScrollbarGrab] = ImVec4(0.36, 0.36, 0.36, 1.00);
colors[clr.ScrollbarGrabHovered] = ImVec4(0.18, 0.22, 0.25, 1.00);
colors[clr.ScrollbarGrabActive] = ImVec4(0.24, 0.24, 0.24, 1.00);
colors[clr.ComboBg] = ImVec4(0.24, 0.24, 0.24, 1.00);
colors[clr.CheckMark] = ImVec4(1.00, 0.28, 0.28, 1.00);
colors[clr.SliderGrab] = ImVec4(1.00, 0.28, 0.28, 1.00);
colors[clr.SliderGrabActive] = ImVec4(1.00, 0.28, 0.28, 1.00);
colors[clr.Button] = ImVec4(1.00, 0.28, 0.28, 1.00);
colors[clr.ButtonHovered] = ImVec4(1.00, 0.39, 0.39, 1.00);
colors[clr.ButtonActive] = ImVec4(1.00, 0.21, 0.21, 1.00);
colors[clr.Header] = ImVec4(1.00, 0.28, 0.28, 1.00);
colors[clr.HeaderHovered] = ImVec4(1.00, 0.39, 0.39, 1.00);
colors[clr.HeaderActive] = ImVec4(1.00, 0.21, 0.21, 1.00);
colors[clr.ResizeGrip] = ImVec4(1.00, 0.28, 0.28, 1.00);
colors[clr.ResizeGripHovered] = ImVec4(1.00, 0.39, 0.39, 1.00);
colors[clr.ResizeGripActive] = ImVec4(1.00, 0.19, 0.19, 1.00);
colors[clr.CloseButton] = ImVec4(0.40, 0.39, 0.38, 0.16);
colors[clr.CloseButtonHovered] = ImVec4(0.40, 0.39, 0.38, 0.39);
colors[clr.CloseButtonActive] = ImVec4(0.40, 0.39, 0.38, 1.00);
colors[clr.PlotLines] = ImVec4(0.61, 0.61, 0.61, 1.00);
colors[clr.PlotLinesHovered] = ImVec4(1.00, 0.43, 0.35, 1.00);
colors[clr.PlotHistogram] = ImVec4(1.00, 0.21, 0.21, 1.00);
colors[clr.PlotHistogramHovered] = ImVec4(1.00, 0.18, 0.18, 1.00);
colors[clr.TextSelectedBg] = ImVec4(1.00, 0.32, 0.32, 1.00);
colors[clr.ModalWindowDarkening] = ImVec4(0.26, 0.26, 0.26, 0.60);
end
theme()
moonloader.log
Код:
[12:18:28.310046] (system) Loading script 'D:\My Games\GTA NAMALSK\moonloader\tpm.lua'...
[12:18:28.310046] (debug) New script: 29E1E6A4
[12:18:28.311548] (error) tpm.lua: D:\My Games\GTA NAMALSK\moonloader\tpm.lua:291: 'then' expected near 'local'
[12:18:28.312047] (error) tpm.lua: Script died due to an error. (29E1E6A4)