Moonloader not displaying server message when calling a function inside event listener

goldprince

Новичок
Автор темы
6
0
So, I am working on a script to show the server's /rules dialog when you login, the script is working fine it shows /rules dialog when you login but it doesn't shows the server's login message.

My script:
rules.lua:
local SE = require 'lib.samp.events'

function SE.onServerMessage(color, text)
    if string.find(text, "logged in") ~= nil then
        sampSendChat("/rules")
        return true
    end
end
 
Решение
Thanks for the help, I tried it too, but still it's not displaying the server message but /rules is working.
should work with minimal latency, I just forgot to add it xD

Lua:
local SE = require 'lib.samp.events'

function SE.onServerMessage(color, text)
    if string.find(text, "logged in") ~= nil then
        lua_thread.create(function()
            wait(10)
            sampSendChat("/rules")
        end)
    end
end

Hideme Flow

Известный
555
193
So, I am working on a script to show the server's /rules dialog when you login, the script is working fine it shows /rules dialog when you login but it doesn't shows the server's login message.

My script:
rules.lua:
local SE = require 'lib.samp.events'

function SE.onServerMessage(color, text)
    if string.find(text, "logged in") ~= nil then
        sampSendChat("/rules")
        return true
    end
end
What is this "the server's login message."?
 

Fott

Простреленный
3,423
2,249
There is no need to use return true here

Lua:
local SE = require 'lib.samp.events'

function SE.onServerMessage(color, text)
    if string.find(text, "logged in") ~= nil then
        sampSendChat("/rules")
    end
end
If it doesn't work anyway, and most likely won't work, add a minimum delay


Lua:
local SE = require 'lib.samp.events'

function SE.onServerMessage(color, text)
    if string.find(text, "logged in") ~= nil then
        lua_thread.create(function()
            sampSendChat("/rules")
        end)
    end
end
 

goldprince

Новичок
Автор темы
6
0
There is no need to use return true here

Lua:
local SE = require 'lib.samp.events'

function SE.onServerMessage(color, text)
    if string.find(text, "logged in") ~= nil then
        sampSendChat("/rules")
    end
end
If it doesn't work anyway, and most likely won't work, add a minimum delay


Lua:
local SE = require 'lib.samp.events'

function SE.onServerMessage(color, text)
    if string.find(text, "logged in") ~= nil then
        lua_thread.create(function()
            sampSendChat("/rules")
        end)
    end
end
Thanks for the help, I tried it too, but still it's not displaying the server message but /rules is working.
 

Fott

Простреленный
3,423
2,249
Thanks for the help, I tried it too, but still it's not displaying the server message but /rules is working.
should work with minimal latency, I just forgot to add it xD

Lua:
local SE = require 'lib.samp.events'

function SE.onServerMessage(color, text)
    if string.find(text, "logged in") ~= nil then
        lua_thread.create(function()
            wait(10)
            sampSendChat("/rules")
        end)
    end
end