(Lua)Не запускается скрипт в самп

R-Roach

Участник
Автор темы
76
7
Версия SA-MP
  1. Любая
СЕЙЧАС ТАК - ТО ПЫТАЮСЬ УЧИТЬ ЛУА, СМОТРЮ РОЛИКИ И ТД И ТП, ВСЕ ВРОДЕ ПОВТОРИЛ С РОЛИКА НО СКРИПТ НЕ ЗАПУСКАЕТСЯ ВЧЕРА СИДЕЛ 1.3ч И ДУМАЛ ПОЧЕМУ ОН НЕ ЗАПУСКАЕТСЯ. Так и ришение не нашел help pups

КОД:
script_name('New script') -- название скрипта
script_author('RORMS') -- автор скрипта
script_description('Command') -- описание скрипта

require "lib.moonloader" -- подключение библиотеки
local keys = require "vkeys"
local sampev = require 'lib.samp.events'

local tag = '[My First Script]:' -- локальная переменная
local label = 0
local main_color = 0x5A90CE
local main_color_text = "{5A90CE}"
local white_color = "{FFFFFF}"

function main()
 if not isSampLoaded() or not isSampfuncsLoaded() then return end
 while not isSampAvailable() do wait(100) end

 sampRegisterChatCommand("normal", cmd_normal)
 sampRegisterChatCommand("optimal", cmd_optimal)
 sampRegisterChatCommand("cool", cmd_cool)

 _, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
 nick = sampGetPlayerNickname(id)

 thread = lua_threar.create_suspended(thread_fuction)
    -- блок выполняется один раз после старта samp gta san andreas

end




 --if label == 1 then
        -- условие 1
        --sampAddChatMessage(tag .. "text", 0XFFFF00)
    --else
        -- условие 2
        --sampAddChatMessage(tag .. "text", 0XFFFFFF)
    --end

    -- sampAddChatMessage(taq .. "text", 0xFFFF00)

    -- Блок выполняется один раз после старта сампа

 while true do
  wait(0)

  if isKeyJustPressed(VK_F3) then
        sampAddChatMessage("Вы нажали клавишу {FFFFFF}F3. " .. main_color_text .. "Ваш ник: {FFFFFF}" .. nick .. ", " .. main_color_text .. "ваш ID: {FFFFFF}" .. id, main_color)
  end

  if isKeyDown(VK_MENU) and isKeyJustPressed(VK_9) then
    sampAddChatMessage("Вы крут, вы зажали комбинацию клавиш!", main_color)
    wait(500)
    sampAddChatMessage("Прошло пол секунды", main_color)
end
  -- Блок выполняется бесконечно (пока самп активен)

 end
end


    function cmd_normal(arg)
    thread:run("normal", arg)
  end

  function cmd_cool(arg)
    thread:run("cool", arg)
  end

function thread_fuction(option, arg)
    if option = "normal" then
        sampAddChatMessage(sampGetMaxPlayerId(false), -1)
        wait(2000)
        sampSendChat(arg)
     end
     if option == "cool" then
         sampAddChatMessage("Привет ютуб, you cool", -1)
        wait(1000)
        sampSendChat(arg, main_color)
    end
  end

--for i, j in pairs(colorsName) do
--sampAddChatMessage(i, j)



--sampAddChatMessage(text, colorsName["red"])

    --for i, value in ipairs(array) do
        --sampAddChatMessage(i .. "Элемент" .. value, main_color)
    --end



function cmd_optimal(arg)
        if #arg == 0 then
            sampAddChatMessage("Привет, вы ввели команду, но не ввели аргумент :(", main_color)
        else
            sampAddChatMessage("Привет! Вы ввели команду и ввели аргумент: {FFFFFF}" .. arg, main_color)
    end
end

function cmd_cool(arg)
    var1, var2 = string.match(arg, "(.+) (.+)")
    if var1 == nill or var1 == "" then
        sampAddChatMessage("Неплохо, у вас уже 2 аргумента, но вы их их не ввели :(", main_color)
    else
        sampAddChatMessage("Круто, вы ввели команду и 2 аргумента. 1ый: " .. white_color .. var1 .. ", " .. main_color_text .. "2ой: " .. white_color .. var2, main_color)
    end
end



--function sampev.onSendChat(text)
    --return  {"Текст"}
--end


function sampev.xonSendExitVehicle(vehicleId)
    sampAddChatMessage("Вы вышли с авто с ID" .. vehicleId , color)
end


function sampev.onSendEnterVehicle(vehicleId, passenger)
    sampAddChatMessage("Вы сели в авто с ID" .. vehicleId .. " / Пассажир : " .. tostring(passenger) ,  color )
end


function sampev.onServerMessage(color, text)
    if string.find(text, 'Администратор', 1, true) then
        return false
    end
end


function sampev.onShowDialog(dialogId, style, title, button1, button2, text)
    sampAddChatMessage(diaglogId, color)
    sampAddChatMessage(style, color)
    sampAddChatMessage(title, color)
    sampAddChatMessage(button1, color)
    sampAddChatMessage(button2, color)
    sampAddChatMessage(text, color)
end

function sampev.onSetInterior(interior)
    sampAddChatMessage("Вы зашли в интерьер с ID" .. interior , color)
end

function sampev.onDisplayGameText(style, time, text)
    sampAddChatMessage(style, color)
    sampAddChatMessage(time, color)
    sampAddChatMessage(text, color)
end

function sampev.onApplyPlayerAnimation(playerId, animLib, animName, loop, lockX, lockY, freeze, time)
    sampAddChatMessage(playerId, color)
    sampAddChatMessage(animLib, color)
    sampAddChatMessage(animName, color)
    sampAddChatMessage(tostring(loop), color)
    sampAddChatMessage(tostring(lockX), color)
    sampAddChatMessage(tostring(lockY), color)
    sampAddChatMessage(tostring(freeze), color)
    sampAddChatMessage(time, color)
end


ЛОГИ Скрипт Test2

[23:23:36.661835] (info) Working directory: C:\Test scripts sborka\moonloader
[23:23:36.661835] (debug) FP Control: 0009001F
[23:23:36.661835] (debug) Game: GTA SA 1.0.0.0 US
[23:23:36.661835] (system) Installing pre-game hooks...
[23:23:36.664835] (system) Hooks installed.
[23:23:38.566944] (debug) Initializing opcode handler table
[23:23:38.566944] (debug) package.path = C:\Test scripts sborka\moonloader\lib\?.lua;C:\Test scripts sborka\moonloader\lib\?\init.lua;C:\Test scripts sborka\moonloader\?.lua;C:\Test scripts sborka\moonloader\?\init.lua;.\?.lua;C:\Test scripts sborka\moonloader\lib\?.luac;C:\Test scripts sborka\moonloader\lib\?\init.luac;C:\Test scripts sborka\moonloader\?.luac;C:\Test scripts sborka\moonloader\?\init.luac;.\?.luac
[23:23:38.566944] (debug) package.cpath = C:\Test scripts sborka\moonloader\lib\?.dll;
[23:23:38.568944] (system) Loading script 'C:\Test scripts sborka\moonloader\AIRBRAKE by SanderFisher.lua'...
[23:23:38.568944] (debug) New script: 0819C684
[23:23:38.570944] (system) AIRBRAKE by SanderFisher.lua: Loaded successfully.
[23:23:38.570944] (system) Loading script 'C:\Test scripts sborka\moonloader\CheckOnline.lua'...
[23:23:38.570944] (debug) New script: 0819C80C
[23:23:38.581945] (system) CheckOnline: Loaded successfully.
[23:23:38.581945] (system) Loading script 'C:\Test scripts sborka\moonloader\Custom_NameTags_v_2.0.lua'...
[23:23:38.581945] (debug) New script: 0819C994
[23:23:38.586945] (system) Custom NameTags: Loaded successfully.
[23:23:38.586945] (system) Loading script 'C:\Test scripts sborka\moonloader\de_50.lua'...
[23:23:38.586945] (debug) New script: 0819CB1C
[23:23:38.593946] (system) de_50.lua: Loaded successfully.
[23:23:38.593946] (system) Loading script 'C:\Test scripts sborka\moonloader\DTime1.3.lua'...
[23:23:38.593946] (debug) New script: 0819CE2C
[23:23:38.608946] (system) DTime: Loaded successfully.
[23:23:38.608946] (system) Loading script 'C:\Test scripts sborka\moonloader\FullText.lua'...
[23:23:38.608946] (debug) New script: 0819CFB4
[23:23:38.609947] (error) FullText.lua: C:\Test scripts sborka\moonloader\FullText.lua:27: 'end' expected (to close 'function' at line 19) near '<eof>'
[23:23:38.609947] (error) FullText.lua: Script died due to an error. (0819CFB4)
[23:23:38.609947] (system) Loading script 'C:\Test scripts sborka\moonloader\GameFixer.lua'...
[23:23:38.609947] (debug) New script: 0819CFB4
[23:23:38.640948] (system) GameFixer.lua: Loaded successfully.
[23:23:38.640948] (system) Loading script 'C:\Test scripts sborka\moonloader\GODMODE by SanderFisher.lua'...
[23:23:38.640948] (debug) New script: 0819D13C
[23:23:38.645949] (system) GODMODE by SanderFisher.lua: Loaded successfully.
[23:23:38.645949] (system) Loading script 'C:\Test scripts sborka\moonloader\lock.lua'...
[23:23:38.645949] (debug) New script: 0819D2C4
[23:23:38.651949] (system) Benjamin Busterenko: Loaded successfully.
[23:23:38.651949] (system) Loading script 'C:\Test scripts sborka\moonloader\NoAdmins.lua'...
[23:23:38.651949] (debug) New script: 0819D44C
[23:23:38.651949] (error) NoAdmins.lua: C:\Test scripts sborka\moonloader\NoAdmins.lua:21: 'end' expected (to close 'function' at line 7) near '<eof>'
[23:23:38.651949] (error) NoAdmins.lua: Script died due to an error. (0819D44C)
[23:23:38.651949] (system) Loading script 'C:\Test scripts sborka\moonloader\Player Remover.lua'...
[23:23:38.651949] (debug) New script: 0819D44C
[23:23:38.667950] (system) Player Remover: Loaded successfully.
[23:23:38.667950] (system) Loading script 'C:\Test scripts sborka\moonloader\reload_all.lua'...
[23:23:38.667950] (debug) New script: 0819D5D4
[23:23:38.672950] (system) ML-ReloadAll: Loaded successfully.
[23:23:38.672950] (system) Loading script 'C:\Test scripts sborka\moonloader\samp++.lua'...
[23:23:38.672950] (debug) New script: 0819D75C
[23:23:38.680951] (system) samp++.lua: Loaded successfully.
[23:23:38.680951] (system) Loading script 'C:\Test scripts sborka\moonloader\Test2.lua'...
[23:23:38.680951] (debug) New script: 0819D8E4
[23:23:38.680951] (error) Test2.lua: C:\Test scripts sborka\moonloader\Test2.lua:61: '<eof>' expected near 'end'
[23:23:38.680951] (error) Test2.lua: Script died due to an error. (0819D8E4)
[23:23:38.680951] (system) Loading script 'C:\Test scripts sborka\moonloader\WALLHACK by SanderFisher.luac'...
[23:23:38.680951] (debug) New script: 0819D8E4
[23:23:38.690951] (system) WallHack: Loaded successfully.
[23:23:38.690951] (system) Loading script 'C:\Test scripts sborka\moonloader\быстрая загрузка.lua'...
[23:23:38.690951] (debug) New script: 0819DA6C
[23:23:38.692951] (system) быстрая загрузка: Loaded successfully.
[23:23:51.254670] (system) Installing post-load hooks...
[23:23:51.254670] (system) Hooks installed.
[23:24:05.047459] (error) CheckOnline: C:\Test scripts sborka\moonloader\CheckOnline.lua:0: Server not found.
stack traceback:
[C]: in function 'assert'
C:\Test scripts sborka\moonloader\CheckOnline.lua: in function <C:\Test scripts sborka\moonloader\CheckOnline.lua:0>
[23:24:05.047459] (error) CheckOnline: Script died due to an error. (0819C80C)
[23:24:08.246642] (script) de_50.lua: Dialog: 1, Button: 1Input: 123321
[23:24:08.421652] (script) de_50.lua: Dialog: 1, Button: 1Input: Мужчина
[23:24:08.581661] (script) de_50.lua: Dialog: 1, Button: 1Input: Светлый
[23:24:08.742670] (script) de_50.lua: Dialog: 1, Button: 1Input: Вкладка 'Hosted'
[23:24:13.205925] (script) de_50.lua: Dialog: 234, Button: 0Input:
[23:24:33.792103] (system) AIRBRAKE by SanderFisher.lua: Script terminated. (0819C684)
[23:24:33.792103] (system) Custom NameTags: Script terminated. (0819C994)
[23:24:33.793103] (system) de_50.lua: Script terminated. (0819CB1C)
[23:24:33.794103] (system) DTime: Script terminated. (0819CE2C)
[23:24:33.795103] (system) GameFixer.lua: Script terminated. (0819CFB4)
[23:24:33.797103] (system) GODMODE by SanderFisher.lua: Script terminated. (0819D13C)
[23:24:33.797103] (system) Benjamin Busterenko: Script terminated. (0819D2C4)
[23:24:33.798103] (system) Player Remover: Script terminated. (0819D44C)
[23:24:33.799103] (system) ML-ReloadAll: Script terminated. (0819D5D4)
[23:24:33.800103] (system) samp++.lua: Script terminated. (0819D75C)
[23:24:33.800103] (system) WallHack: Script terminated. (0819D8E4)
[23:24:33.801103] (system) быстрая загрузка: Script terminated. (0819DA6C)
[23:24:33.802103] (system) Loading script 'C:\Test scripts sborka\moonloader\AIRBRAKE by SanderFisher.lua'...
[23:24:33.802103] (debug) New script: 0819DA6C
[23:24:33.803103] (system) AIRBRAKE by SanderFisher.lua: Loaded successfully.
[23:24:33.803103] (system) Loading script 'C:\Test scripts sborka\moonloader\CheckOnline.lua'...
[23:24:33.803103] (debug) New script: 0819D8E4
[23:24:33.807104] (system) CheckOnline: Loaded successfully.
[23:24:33.807104] (system) Loading script 'C:\Test scripts sborka\moonloader\Custom_NameTags_v_2.0.lua'...
[23:24:33.807104] (debug) New script: 0819D75C
[23:24:33.811104] (system) Custom NameTags: Loaded successfully.
[23:24:33.811104] (system) Loading script 'C:\Test scripts sborka\moonloader\de_50.lua'...
[23:24:33.811104] (debug) New script: 0819D5D4
[23:24:33.816104] (system) de_50.lua: Loaded successfully.
[23:24:33.816104] (system) Loading script 'C:\Test scripts sborka\moonloader\DTime1.3.lua'...
[23:24:33.816104] (debug) New script: 0819D44C
[23:24:33.823105] (system) DTime: Loaded successfully.
[23:24:33.823105] (system) Loading script 'C:\Test scripts sborka\moonloader\FullText.lua'...
[23:24:33.823105] (debug) New script: 0819D2C4
[23:24:33.823105] (error) FullText.lua: C:\Test scripts sborka\moonloader\FullText.lua:27: 'end' expected (to close 'function' at line 19) near '<eof>'
[23:24:33.823105] (error) FullText.lua: Script died due to an error. (0819D2C4)
[23:24:33.823105] (system) Loading script 'C:\Test scripts sborka\moonloader\GameFixer.lua'...
[23:24:33.823105] (debug) New script: 0819D2C4
[23:24:33.842106] (system) GameFixer.lua: Loaded successfully.
[23:24:33.842106] (system) Loading script 'C:\Test scripts sborka\moonloader\GODMODE by SanderFisher.lua'...
[23:24:33.842106] (debug) New script: 0819D13C
[23:24:33.847106] (system) GODMODE by SanderFisher.lua: Loaded successfully.
[23:24:33.847106] (system) Loading script 'C:\Test scripts sborka\moonloader\lock.lua'...
[23:24:33.847106] (debug) New script: 0819CFB4
[23:24:33.851106] (system) Benjamin Busterenko: Loaded successfully.
[23:24:33.851106] (system) Loading script 'C:\Test scripts sborka\moonloader\NoAdmins.lua'...
[23:24:33.851106] (debug) New script: 0819CE2C
[23:24:33.852106] (error) NoAdmins.lua: C:\Test scripts sborka\moonloader\NoAdmins.lua:21: 'end' expected (to close 'function' at line 7) near '<eof>'
[23:24:33.852106] (error) NoAdmins.lua: Script died due to an error. (0819CE2C)
[23:24:33.852106] (system) Loading script 'C:\Test scripts sborka\moonloader\Player Remover.lua'...
[23:24:33.852106] (debug) New script: 0819CE2C
[23:24:33.866107] (system) Player Remover: Loaded successfully.
[23:24:33.866107] (system) Loading script 'C:\Test scripts sborka\moonloader\reload_all.lua'...
[23:24:33.866107] (debug) New script: 0819CB1C
[23:24:33.870107] (system) ML-ReloadAll: Loaded successfully.
[23:24:33.870107] (system) Loading script 'C:\Test scripts sborka\moonloader\samp++.lua'...
[23:24:33.870107] (debug) New script: 0819C994
[23:24:33.876108] (system) samp++.lua: Loaded successfully.
[23:24:33.876108] (system) Loading script 'C:\Test scripts sborka\moonloader\Test2.lua'...
[23:24:33.876108] (debug) New script: 0819C684
[23:24:33.876108] (error) Test2.lua: C:\Test scripts sborka\moonloader\Test2.lua:61: '<eof>' expected near 'end'
[23:24:33.876108] (error) Test2.lua: Script died due to an error. (0819C684)
[23:24:33.876108] (system) Loading script 'C:\Test scripts sborka\moonloader\WALLHACK by SanderFisher.luac'...
[23:24:33.876108] (debug) New script: 0819C684
[23:24:33.885108] (system) WallHack: Loaded successfully.
[23:24:33.885108] (system) Loading script 'C:\Test scripts sborka\moonloader\быстрая загрузка.lua'...
[23:24:33.885108] (debug) New script: 0785DB84
[23:24:33.886108] (system) быстрая загрузка: Loaded successfully.
[23:24:33.886108] (error) CheckOnline: C:\Test scripts sborka\moonloader\CheckOnline.lua:0: Server not found.
stack traceback:
[C]: in function 'assert'
C:\Test scripts sborka\moonloader\CheckOnline.lua: in function <C:\Test scripts sborka\moonloader\CheckOnline.lua:0>
[23:24:33.886108] (error) CheckOnline: Script died due to an error. (0819D8E4)
[23:25:02.096722] (system) AIRBRAKE by SanderFisher.lua: Script terminated. (0819DA6C)
[23:25:02.096722] (system) Custom NameTags: Script terminated. (0819D75C)
[23:25:02.097722] (system) de_50.lua: Script terminated. (0819D5D4)
[23:25:02.097722] (system) DTime: Script terminated. (0819D44C)
[23:25:02.098722] (system) GameFixer.lua: Script terminated. (0819D2C4)
[23:25:02.100722] (system) GODMODE by SanderFisher.lua: Script terminated. (0819D13C)
[23:25:02.100722] (system) Benjamin Busterenko: Script terminated. (0819CFB4)
[23:25:02.101722] (system) Player Remover: Script terminated. (0819CE2C)
[23:25:02.102722] (system) ML-ReloadAll: Script terminated. (0819CB1C)
[23:25:02.103722] (system) samp++.lua: Script terminated. (0819C994)
[23:25:02.103722] (system) WallHack: Script terminated. (0819C684)
[23:25:02.104722] (system) быстрая загрузка: Script terminated. (0785DB84)
[23:25:02.105722] (system) Loading script 'C:\Test scripts sborka\moonloader\AIRBRAKE by SanderFisher.lua'...
[23:25:02.105722] (debug) New script: 0785DB84
[23:25:02.106722] (system) AIRBRAKE by SanderFisher.lua: Loaded successfully.
[23:25:02.106722] (system) Loading script 'C:\Test scripts sborka\moonloader\CheckOnline.lua'...
[23:25:02.106722] (debug) New script: 0785D6EC
[23:25:02.110722] (system) CheckOnline: Loaded successfully.
[23:25:02.110722] (system) Loading script 'C:\Test scripts sborka\moonloader\Custom_NameTags_v_2.0.lua'...
[23:25:02.110722] (debug) New script: 0785D0CC
[23:25:02.114723] (system) Custom NameTags: Loaded successfully.
[23:25:02.114723] (system) Loading script 'C:\Test scripts sborka\moonloader\de_50.lua'...
[23:25:02.114723] (debug) New script: 0785CF44
[23:25:02.119723] (system) de_50.lua: Loaded successfully.
[23:25:02.119723] (system) Loading script 'C:\Test scripts sborka\moonloader\DTime1.3.lua'...
[23:25:02.119723] (debug) New script: 0785E63C
[23:25:02.127723] (system) DTime: Loaded successfully.
[23:25:02.127723] (system) Loading script 'C:\Test scripts sborka\moonloader\FullText.lua'...
[23:25:02.127723] (debug) New script: 0785D874
[23:25:02.127723] (error) FullText.lua: C:\Test scripts sborka\moonloader\FullText.lua:27: 'end' expected (to close 'function' at line 19) near '<eof>'
[23:25:02.127723] (error) FullText.lua: Script died due to an error. (0785D874)
[23:25:02.127723] (system) Loading script 'C:\Test scripts sborka\moonloader\GameFixer.lua'...
[23:25:02.127723] (debug) New script: 0785D874
[23:25:02.146725] (system) GameFixer.lua: Loaded successfully.
[23:25:02.146725] (system) Loading script 'C:\Test scripts sborka\moonloader\GODMODE by SanderFisher.lua'...
[23:25:02.146725] (debug) New script: 0785E4B4
[23:25:02.150725] (system) GODMODE by SanderFisher.lua: Loaded successfully.
[23:25:02.150725] (system) Loading script 'C:\Test scripts sborka\moonloader\lock.lua'...
[23:25:02.150725] (debug) New script: 25B1037C
[23:25:02.155725] (system) Benjamin Busterenko: Loaded successfully.
[23:25:02.155725] (system) Loading script 'C:\Test scripts sborka\moonloader\NoAdmins.lua'...
[23:25:02.155725] (debug) New script: 25B1006C
[23:25:02.155725] (error) NoAdmins.lua: C:\Test scripts sborka\moonloader\NoAdmins.lua:21: 'end' expected (to close 'function' at line 7) near '<eof>'
[23:25:02.155725] (error) NoAdmins.lua: Script died due to an error. (25B1006C)
[23:25:02.155725] (system) Loading script 'C:\Test scripts sborka\moonloader\Player Remover.lua'...
[23:25:02.155725] (debug) New script: 25B1006C
[23:25:02.169726] (system) Player Remover: Loaded successfully.
[23:25:02.169726] (system) Loading script 'C:\Test scripts sborka\moonloader\reload_all.lua'...
[23:25:02.169726] (debug) New script: 25B1068C
[23:25:02.173726] (system) ML-ReloadAll: Loaded successfully.
[23:25:02.174726] (system) Loading script 'C:\Test scripts sborka\moonloader\samp++.lua'...
[23:25:02.174726] (debug) New script: 07A37F1C
[23:25:02.179726] (system) samp++.lua: Loaded successfully.
[23:25:02.179726] (system) Loading script 'C:\Test scripts sborka\moonloader\Test2.lua'...
[23:25:02.179726] (debug) New script: 07A3884C
[23:25:02.180726] (error) Test2.lua: C:\Test scripts sborka\moonloader\Test2.lua:72: 'then' expected near '='
[23:25:02.180726] (error) Test2.lua: Script died due to an error. (07A3884C)
[23:25:02.180726] (system) Loading script 'C:\Test scripts sborka\moonloader\WALLHACK by SanderFisher.luac'...
[23:25:02.180726] (debug) New script: 07A3884C
[23:25:02.189727] (system) WallHack: Loaded successfully.
[23:25:02.189727] (system) Loading script 'C:\Test scripts sborka\moonloader\быстрая загрузка.lua'...
[23:25:02.189727] (debug) New script: 07A380A4
[23:25:02.190727] (system) быстрая загрузка: Loaded successfully.
[23:25:02.190727] (error) CheckOnline: C:\Test scripts sborka\moonloader\CheckOnline.lua:0: Server not found.