Крашится скрипт

MrCH

Участник
Автор темы
93
18
Версия MoonLoader
Другое
Пишу свой первый скрипт, так что просьба палками не кидаться
lua:
require 'lib.moonloader'
require 'lib.sampfuncs'
local sampev = require "lib.samp.events"

function main()
    while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand('bzv', bot)
end
function bot()
    setCharCoordinates(PLAYER_PED, 2558.4213867188, -1291.0051269531, 1044.125)
    sampSendPickedUpPickup(1624)
    wait(500)
    sampSendClickTextdraw(617)
    wait(100)
    sampSendClickTextdraw(618)
    wait(100)
    EmulateKey(VK_MENU, true)
    wait(20)
    EmulateKey(VK_MENU, false)
    wait(9000)
    setCharCoordinates(PLAYER_PED, 2564.326171875, -1293.0026855469, 1044.125)
    wait(100)
    EmulateKey(VK_MENU, true)
    wait(20)
    EmulateKey(VK_MENU, false)
end

Скрипт крашится после подбора пикапа 1624.
мунлог:

[ML] (error) char.lua: D:\GTA 140K BY DAPO SHOW\moonloader\char.lua:23: attempt to yield across C-call boundary
stack traceback:
[C]: in function 'wait'
D:\GTA 140K BY DAPO SHOW\moonloader\char.lua:23: in function <D:\GTA 140K BY DAPO SHOW\moonloader\char.lua:20>
[ML] (error) char.lua: Script died due to an error. (0CBA217C)
 
Решение
Lua:
require 'lib.moonloader'
require 'lib.sampfuncs'
local sampev = require "lib.samp.events"

function main()
    while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand('bzv', bot)
    wait(-1)
end
function bot()
    lua_thread.create(function()-- тут поток

    setCharCoordinates(PLAYER_PED, 2558.4213867188, -1291.0051269531, 1044.125)
    sampSendPickedUpPickup(1624)
    wait(500)
    sampSendClickTextdraw(617)
    wait(100)
    sampSendClickTextdraw(618)
    wait(100)
    EmulateKey(VK_MENU, true)
    wait(20)
    EmulateKey(VK_MENU, false)
    wait(9000)
    setCharCoordinates(PLAYER_PED, 2564.326171875, -1293.0026855469, 1044.125)
    wait(100)
    EmulateKey(VK_MENU, true)
    wait(20)
    EmulateKey(VK_MENU...

why ega

Известный
1,407
730
Lua:
require 'lib.moonloader'
require 'lib.sampfuncs'
local sampev = require "lib.samp.events"

function main()
    while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand('bzv', bot)
    wait(-1)
end
function bot()
    lua_thread.create(function()-- тут поток

    setCharCoordinates(PLAYER_PED, 2558.4213867188, -1291.0051269531, 1044.125)
    sampSendPickedUpPickup(1624)
    wait(500)
    sampSendClickTextdraw(617)
    wait(100)
    sampSendClickTextdraw(618)
    wait(100)
    EmulateKey(VK_MENU, true)
    wait(20)
    EmulateKey(VK_MENU, false)
    wait(9000)
    setCharCoordinates(PLAYER_PED, 2564.326171875, -1293.0026855469, 1044.125)
    wait(100)
    EmulateKey(VK_MENU, true)
    wait(20)
    EmulateKey(VK_MENU, false)
    end) 
end
 
  • Нравится
Реакции: MrCH