Помогите, написал код для скрипта .lua , выдает ошибку

LuaCsDllIni1223

Новичок
Автор темы
1
0
Помогите, написал скрипт .lua , захожу на сервер а он не работает. Обновил мунлоадер , и все равно, помогите пожалуйста, вот сам код
require "lib.moonloader"
local keys = require "vkeys"
function main()
if not isSampLoaded() or not isSampfuncsLoaded()
then return
end
while not isSampAvailable
do wait(100)
end
sampAddChatMessage('testtttt', 0xFF8C00)
while true do
wait(0)
if isKeyDown(VK_8)
and isKeyJustPressed(VK_7)
then
sampSendChat("Приветствую")
end
if isKeyJustPressed(VK_A)
then
sampSendChat("Удачной игры.")
end
end
end
 

kyrtion

Известный
661
242
Lua:
local vkeys = require('vkeys')

function main()
  while not isSampAvailable() do wait(100) end

  sampAddChatMessage('testtttt', 0xFF8C00)

  while true do wait(0)
    if isKeyDown(vkeys.VK_8) and isKeyJustPressed(vkeys.VK_7) then
      sampSendChat('Приветствую')
    elseif isKeyJustPressed(vkeys.VK_A) then
      sampSendChat('Удачной игры.')
    end
  end
end
 
Последнее редактирование:

Andrinall

Известный
680
532
Помогите, написал скрипт .lua , захожу на сервер а он не работает. Обновил мунлоадер , и все равно, помогите пожалуйста, вот сам код
Ты ждёшь пока у тебя не будет переменной isSampAvailable, а она глобальная, так что есть)
while not isSampAvailable do wait(100) end

Тебе просто надо вызывать функцию с этим именем
while not isSampAvailable() do wait(100) end

И определись с тем, что ты используешь.
Если просто VK_* то убери подгрузку vkeys(если не собираешься использовать методы оттуда)
Либо используй как у человека выше keys.VK_* , где * это нужная кнопка.

Lua:
require 'lib.moonloader'

function main()
  if not isSampLoaded() or not isSampfuncsLoaded() then return end
  repeat wait(100) until isSampAvailable() -- repeat аналог while, почитай на досуге
  
  sampAddChatMessage('test', 0xFF8C00)

  while true do wait(0)
    if isKeyDown(VK_8) and isKeyJustPressed(VK_7) then
      sampSendChat('Приветствую')
    elseif isKeyJustPressed(VK_A) then
      sampSendChat('Удачной игры.')
    end
  end
end

Lua:
local vkeys = require('vkeys')

function main()
  while not isSampAvailable do wait(100) end

  sampAddChatMessage('testtttt', 0xFF8C00)

  while true do wait(0)
    if isKeyDown(vkeys.VK_8) and isKeyJustPressed(vkeys.VK_7) then
      sampSendChat('Приветствую')
    elseif isKeyJustPressed(vkeys.VK_A) then
      sampSendChat('Удачной игры.')
    end
  end
end
Спать хотелось чтоль, что так пропустил отсутствие вызова isSampAvailable ?)
 
  • Ха-ха
Реакции: kyrtion