sampSendChat не принимает строку

zewslamer

Новичок
Автор темы
14
0
123:
script_author('HeLK')
script_name('flooder')
script_description('Flood /pm')
function main()
    while not isSampAvailable() do wait(250) end
    sampRegisterChatCommand('flood', fld)
    while true do
        wait(0)
    end
end
function fld(id, mesg)
    sampSendChat('/pm ' ..id.." " ..mesg)
end
не принимает строку
 

ewin

Известный
675
369
123:
script_author('HeLK')
script_name('flooder')
script_description('Flood /pm')
function main()
    while not isSampAvailable() do wait(250) end
    sampRegisterChatCommand('flood', fld)
    while true do
        wait(0)
    end
end
function fld(id, mesg)
    sampSendChat('/pm ' ..id.." " ..mesg)
end
не принимает строку
Lua:
function fld(args)
    args = split(args, " ") -- разбиваем аргументы на отдельные ячейки из сниппета ниже и суем в массив
    sampAddChatMessage(args[1].." | " ..args[2], -1)
end

function split(str, delim, plain)
    local tokens, pos, plain = {}, 1, not (plain == false) --[[ delimiter is plain text by default ]]
    repeat
        local npos, epos = string.find(str, delim, pos, plain)
        table.insert(tokens, string.sub(str, pos, npos and npos - 1))
        pos = epos and epos + 1
    until not pos
    return tokens
end
 
  • Нравится
Реакции: zewslamer

zewslamer

Новичок
Автор темы
14
0
Lua:
function fld(args)
    args = split(args, " ") -- разбиваем аргументы на отдельные ячейки из сниппета ниже и суем в массив
    sampAddChatMessage(args[1].." | " ..args[2], -1)
end

function split(str, delim, plain)
    local tokens, pos, plain = {}, 1, not (plain == false) --[[ delimiter is plain text by default ]]
    repeat
        local npos, epos = string.find(str, delim, pos, plain)
        table.insert(tokens, string.sub(str, pos, npos and npos - 1))
        pos = epos and epos + 1
    until not pos
    return tokens
end
Помог, но правда пришлось немноооого переделать :)