Как исправить ошибку?

iframe

Известный
Автор темы
40
11
Lua:
function SampEvents.onServerMessage(msg)

    if msg:find('Вы можете взять %d материалов.') then -- < Ошибка возникает тут.
        sampSendChat(string.format('/get guns %d', msg)) 
    end
end

Сама ошибка:

[ML] (error) main.lua: D:\Games\SAMP\moonloader\main.lua:33: attempt to index local 'msg' (a number value)
stack traceback:
D:\Games\SAMP\moonloader\main.lua:33: in function 'callback'
D:\Games\SAMP\moonloader\lib\samp\events\core.lua:80: in function <D:\Games\SAMP\moonloader\lib\samp\events\core.lua:54>
[ML] (error) main.lua: Script died due to error. (0D9514AC)
[ML] (script) FBI Tools: Ballas Gang
 
Решение
Lua:
function SampEvents.onServerMessage(msg)

    if msg:find('Вы можете взять %d материалов.') then -- < Ошибка возникает тут.
        sampSendChat(string.format('/get guns %d', msg))
    end
end

Сама ошибка:

[ML] (error) main.lua: D:\Games\SAMP\moonloader\main.lua:33: attempt to index local 'msg' (a number value)
stack traceback:
D:\Games\SAMP\moonloader\main.lua:33: in function 'callback'
D:\Games\SAMP\moonloader\lib\samp\events\core.lua:80: in function <D:\Games\SAMP\moonloader\lib\samp\events\core.lua:54>
[ML] (error) main.lua: Script died due to error. (0D9514AC)
[ML] (script) FBI Tools: Ballas Gang
первым значением идёт цвет. вторым уже сообщение

Lua:
function...

deddosouru

Смотрю аниме, служу Сатане
Друг
2,036
1,320
Lua:
function SampEvents.onServerMessage(msg)

    if msg:find('Вы можете взять %d материалов.') then -- < Ошибка возникает тут.
        sampSendChat(string.format('/get guns %d', msg))
    end
end

Сама ошибка:

[ML] (error) main.lua: D:\Games\SAMP\moonloader\main.lua:33: attempt to index local 'msg' (a number value)
stack traceback:
D:\Games\SAMP\moonloader\main.lua:33: in function 'callback'
D:\Games\SAMP\moonloader\lib\samp\events\core.lua:80: in function <D:\Games\SAMP\moonloader\lib\samp\events\core.lua:54>
[ML] (error) main.lua: Script died due to error. (0D9514AC)
[ML] (script) FBI Tools: Ballas Gang
первым значением идёт цвет. вторым уже сообщение

Lua:
function SampEvents.onServerMessage(color,msg)

    if msg:find('Вы можете взять %d материалов.') then -- < Ошибка возникает тут.
        sampSendChat(string.format('/get guns %d', msg))
    end
end
 

iframe

Известный
Автор темы
40
11
первым значением идёт цвет. вторым уже сообщение

Lua:
function SampEvents.onServerMessage(color,msg)

    if msg:find('Вы можете взять %d материалов.') then -- < Ошибка возникает тут.
        sampSendChat(string.format('/get guns %d', msg))
    end
end

А, как тогда узнать цвет текста?