- 436
- 70
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
- Версия MoonLoader
- Другое
В чем ошибка при нажатии Поставить метку вот такая ошибка
Ошибка:
[ML] (error) CheckcordByMorse: D:\GTA 130K BY DAPO SHOW\moonloader\CheckcordByMorse.lua:48: attempt to yield across C-call boundary
stack traceback:
[C]: in function 'wait'
D:\GTA 130K BY DAPO SHOW\moonloader\CheckcordByMorse.lua:48: in function <D:\GTA 130K BY DAPO SHOW\moonloader\CheckcordByMorse.lua:41>
[C]: in function 'sampProcessChatInput'
D:\GTA 130K BY DAPO SHOW\moonloader\CheckcordByMorse.lua:72: in function 'OnDrawFrame'
D:\GTA 130K BY DAPO SHOW\moonloader\lib\imgui.lua:1378: in function <D:\GTA 130K BY DAPO SHOW\moonloader\lib\imgui.lua:1367>
[ML] (error) CheckcordByMorse: Script died due to an error. (1A8084A4)
Lua:
script_name("CheckcordByMorse")
script_author("Morse")
script_description("Check coordinates")
script_version("1.0")
require "lib.moonloader"
local keys = require "vkeys"
local imgui = require "imgui"
local encoding = require "encoding"
encoding.default = "CP1251"
u8 = encoding.UTF8
local main_color = 0xE6E6FA
local ImVec2 = imgui.ImVec2
local main_window_state = imgui.ImBool(false)
local text_buffer = imgui.ImBuffer(256)
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
sampAddChatMessage("[CheckCoordByMorse] Script is ready to using {FFDAB9} /chcord", main_color)
sampAddChatMessage("[CheckCoordByMorse] Script is ready to using {FFDAB9} /chcord", main_color)
sampAddChatMessage("[CheckCoordByMorse] Script is ready to using {FFDAB9} /chcord", main_color)
sampRegisterChatCommand("chcord", cmd_chcord)
sampRegisterChatCommand("setmark", cmd_setmark)
imgui.Process = false
while true do
wait(0)
if main_window_state.v == false then
imgui.Process = false
end
end
end
function cmd_setmark(type, x, y, z, radius, color)
deleteCheckpoint(marker)
removeBlip(checkpoint)
checkpoint = addBlipForCoord(x, y, z)
marker = createCheckpoint(type, x, y, z, 1, 1, 1, radius)
changeBlipColour(checkpoint, color)
repeat
wait(0)
local x1, y1, z1 = getCharCoordinates(PLAYER_PED)
until getDistanceBetweenCoords3d(x, y, z, x1, y1, z1) < radius or not doesBlipExist(checkpoint)
deleteCheckpoint(marker)
removeBlip(checkpoint)
addOneOffSound(0, 0, 0, 1149)
end
function cmd_chcord(arg)
main_window_state.v = not main_window_state.v
imgui.Process = main_window_state.v
end
function imgui.OnDrawFrame()
local sw, sh = getScreenResolution()
imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.SetNextWindowSize(imgui.ImVec2(400, 110), imgui.Cond.FirstUseEver)
imgui.GetStyle().WindowTitleAlign = imgui.ImVec2(0.5, 0.5)
imgui.Begin("CheckCordByMorse", main_window_state, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse)
imgui.SetCursorPos(imgui.ImVec2(78, 33))
imgui.InputText("", text_buffer)
imgui.SetCursorPos(imgui.ImVec2(80, 60))
if imgui.Button(u8"Поставить метку") then
sampAddChatMessage("Метка поставлена.", main_color)
sampProcessChatInput("/setmark " .. u8:decode(text_buffer.v))
text_buffer.v = ""
end
imgui.SetCursorPos(imgui.ImVec2(80, 60))
if imgui.Button(u8"Сохранить координаты", imgui.SameLine()) then
sampAddChatMessage("Координаты сохранены.", main_color)
text_buffer.v = ""
end
imgui.SetCursorPosX((imgui.GetWindowWidth() - 75) / 2)
imgui.Text("Script By Morse")
imgui.End()
end