Сбивается скрипт

Статус
В этой теме нельзя размещать новые ответы.

imring

Ride the Lightning
Автор темы
Всефорумный модератор
2,355
2,516
Помогите, я создаю команду /rank [ID] [РАНГ], но у меня проблема. Когда пишу команду /rank 55 2, то у меня сбивается скрипт.
Код:
Lua:
script_name("liders")
script_description("/lhelp - помощь")
script_version("v2.0")
script_author("ebanteev imring yagulia")
script_dependencies("SAMPFUNCS, SAMP")
require("lib.moonloader")

--jstart = 1

function main()
  while not isSampAvailable() do
      wait(1000)
  end
  --[[f jstart == 1 then
  elseif jstart == 2 then
  end]]--
  sampRegisterChatCommand("rank", gid)
  while true do
    wait(0)
  end
end

function gid(param)
  local id, rang = string.match(param, '(%d+) (%d+)')
  if id ~= nil and rang ~= nil then 
    idd = id
    idrang = rang
    giverank()
  else
    sampAddChatMessage("[ Мысли ]: Выдать ранг игроку [ /rank ID RANK ]", 0xC1C1C1)
  end
end

function giverank()
  sampSendChat("/lmenu")
  wait(100)
  sampSendDialogResponse(615, 1, 6)
  wait(100)
  sampSendDialogResponse(616, 1, 0, idd)
  wait(500)
  sampSendDialogResponse(617, 1, 0, idrang)
  wait(500)
  sampShowDialog(1376, "test", "test", "test")
  local resultMain, buttonMain, listMain = sampHasDialogRespond(1376)
  if sampIsDialogActive(1376) == true then sampCloseCurrentDialogWithButton(0) end
end

Если даже вот так напишу, то всё равно:
Lua:
function gid(param)
  local id, rang = string.match(param, '(%d+) (%d+)')
  if id ~= nil and rang ~= nil then 
    sampSendChat("/lmenu")
    wait(100)
    sampSendDialogResponse(615, 1, 6)
    wait(100)
    sampSendDialogResponse(616, 1, 0, id)
    wait(500)
    sampSendDialogResponse(617, 1, 0, rang)
    wait(500)
    sampShowDialog(1376, "test", "test", "test")
    local resultMain, buttonMain, listMain = sampHasDialogRespond(1376)
    if sampIsDialogActive(1376) == true then sampCloseCurrentDialogWithButton(0) end
    else
      sampAddChatMessage("[ Мысли ]: Выдать ранг игроку [ /rank ID RANK ]", 0xC1C1C1)
  end
end
 
  • Нравится
Реакции: MISTER_GONWIK
Статус
В этой теме нельзя размещать новые ответы.