Преобразование данных

MrCH

Участник
Автор темы
109
17
Версия MoonLoader
Другое
Lua:
require('samp.events').onServerMessage = function(color, text)
    if text:match('{FF8888}%a+_%a+{FFFFFF}') and text:match('|') and text:match('packetloss') then
        name = text:match('%a+_%a+')
       id = text:match('%d+')
            if name == 'RedRock_Bot' then
                adm.name1.id = id
            end
    end
end
Вот часть кода. Переменная id должна быть числом. Пробовал tonomber(), не получилось
 

ChromiusJ

Известный
Друг
4,905
3,192
 
  • Нравится
Реакции: YarikVL

webb_

Участник
50
4
Lua:
require('samp.events').onServerMessage = function(color, text)
    if text:match('{FF8888}%a+_%a+{FFFFFF}') and text:match('|') and text:match('packetloss') then
        local name = text:match('(%a+_%a+)')
        local id = tonumber(text:match('(%d+)'))
        if name == 'RedRock_Bot' and id ~= nil then
            adm.name1.id = id
        end
    end
end
Попробуй так что ли