в чем проблема?

infinityx

Известный
Автор темы
203
55
Версия MoonLoader
.026-beta
Lua:
script_name("fix brilliant")
script_author("roscoewe")

function main()
while true do
Random = math.random(720000, 1200000)
wait(Random)
sampSendClickTextdraw(99)
wait(1000)
sampCloseCurrentDialogWithButton(1)
end
end

local sampev = require('lib.samp.events')

function sampev.OnServerMessage(color, text)
    if text:find('Вы тут?') then
        lua_thread.create(function()
            thisScript().pause()
            wait(300000)
            thisScript().resume()
        end)
    end
end


При выполнении 2 func крашит
 
Последнее редактирование:

paulohardy

вы еще постите говно? тогда я иду к вам
Всефорумный модератор
1,891
1,254
Lua:
script_name("fix brilliant")
script_author("roscoewe")

function main()
while true do
Random = math.random(720000, 1200000)
wait(Random)
sampSendClickTextdraw(99)
wait(1000)
sampCloseCurrentDialogWithButton(1)
end
end

local sampev = require('lib.samp.events')

function sampev.OnServerMessage(color, text)
    if text:find('Вы тут?') then
        lua_thread.create(function()
            thisScript().pause()
            wait(300000)
            thisScript().resume()
        end)
    end
end


2 функция не робит.
onServerMessage, а не OnServerMessage
 

astynk

Известный
Проверенный
742
530
исправил, теперь гта закрывается, когда
if text:find('Вы тут?')
выполняется
По-другому надо делать.
Содержимое бесконечного цикла заворачивай в такое условие:
Lua:
working = true

while true do
    if working then
        -- code
    else wait(1000) end
end
В onServerMessage пиши:
Lua:
if text:find('Вы тут?') then
    working = false
    lua_thread.create(function()
        wait(300000)
        working = true
    end)
end
 

infinityx

Известный
Автор темы
203
55
По-другому надо делать.
Содержимое бесконечного цикла заворачивай в такое условие:
Lua:
working = true

while true do
    if working then
        -- code
    else wait(1000) end
end
В onServerMessage пиши:
Lua:
if text:find('Вы тут?') then
    working = false
    lua_thread.create(function()
        wait(300000)
        working = true
    end)
end
Lua:
working = true

function main()
while true do
    if working then
             Random = math.random(720000, 1200000)
             wait(Random)
             sampSendClickTextdraw(99)
             wait(1000)
             sampCloseCurrentDialogWithButton(1)
    end
end

local sampev = require('lib.samp.events')

function sampev.OnServerMessage(color, text)
    if text:find('Вы тут?') then
    working = false
    lua_thread.create(function()
print("wait")
                wait(300000)
        working = true
    end)
end
end
end

Крашей нет, но нихуя не работает, хз почему
 

EndoHokage

Активный
136
55
Код:
require "lib.moonloader"
local sampev = require('lib.samp.events')

working = true

function main()
while true do
    if working then
        Random = math.random(720000, 1200000)
        wait(Random)
        sampSendClickTextdraw(99)
        wait(1000)
        sampCloseCurrentDialogWithButton(1)
    end
end

function sampev.OnServerMessage(color, text)
    if text:find('Вы тут?') then
        working = false
        lua_thread.create(function()
            print("wait")
            wait(300000)
            working = true
        end)
    end
end
Если будет краш, скинь лог
 
  • Нравится
Реакции: Mamory

astynk

Известный
Проверенный
742
530
Lua:
working = true

function main()
while true do
    if working then
             Random = math.random(720000, 1200000)
             wait(Random)
             sampSendClickTextdraw(99)
             wait(1000)
             sampCloseCurrentDialogWithButton(1)
    end
end

local sampev = require('lib.samp.events')

function sampev.OnServerMessage(color, text)
    if text:find('Вы тут?') then
    working = false
    lua_thread.create(function()
print("wait")
                wait(300000)
        working = true
    end)
end
end
end

Крашей нет, но нихуя не работает, хз почему
onServerMessage
+ else wait(1000) в условии, иначе зависнет после сообщения
 

infinityx

Известный
Автор темы
203
55
Код:
require "lib.moonloader"
local sampev = require('lib.samp.events')

working = true

function main()
while true do
    if working then
        Random = math.random(720000, 1200000)
        wait(Random)
        sampSendClickTextdraw(99)
        wait(1000)
        sampCloseCurrentDialogWithButton(1)
    end
end

function sampev.OnServerMessage(color, text)
    if text:find('Вы тут?') then
        working = false
        lua_thread.create(function()
            print("wait")
            wait(300000)
            working = true
        end)
    end
end
Если будет краш, скинь лог
ничего. в конце end кстати, wait в консоль не выводит
 

cheremuxa

Известный
430
200
Lua:
working = true

function main()
while true do
    if working then
             Random = math.random(720000, 1200000)
             wait(Random)
             sampSendClickTextdraw(99)
             wait(1000)
             sampCloseCurrentDialogWithButton(1)
    end
end

local sampev = require('lib.samp.events')

function sampev.onServerMessage(color, text)
    if text:find('Вы тут?') then
    working = false
    lua_thread.create(function()
print("wait")
                wait(300000)
        working = true
    end)
end
end
end

Крашей нет, но нихуя не работает, хз почему
Lua:
working = true

function main()
repeat wait(0) until isSampAvaliable ()
    if working then
             Random = math.random(720000, 1200000)
             wait(Random)
             sampSendClickTextdraw(99)
             wait(1000)
    sampCloseCurrentDialogWithButton(1)
    end
while true do wait(0)
end
end

local sampev = require('lib.samp.events')

function sampev.onServerMessage(text, color)
    if text:find('Вы тут?') then
    working = false
    lua_thread.create(function()
if working == false then
                wait(300000)
        working = true
end
    end)
end
end
end