Хелпаните с скриптом

Contadino

Потрачен
Автор темы
32
3
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Привет решил создать скрипт для Правительства и личных целей.Но чет ошибочка у меня.Помогите пожайлуста.За ранее спасибо!
Мойкоде:
script_name ("GovernmentHelper")
script_author ("Contadino")
script_description ("Helper")

--ЛОКАЛЬНЫЕ

require "lib.moonloader"
local keys = require "vKeys"
local tag = "[GovernmentHelper]:"
local main_color = 0x009EFF
local main_color_text = "{FFFFFF}"
local white_color = "{FFFFFF}"
local SE = require 'lib.samp.events'
local sampev = require 'lib.samp.events'
local inicfg = require 'inicfg'
local inifiles = inicfg.load({
    settings =
    {
        prefix = "RUS"
    }
},"MultiHelper.ini")

require 'moonloader'
--Функция МЕЙН

function main()
   if not isSampLoaded() or not isSampfuncsLoaded() then return end
   while not isSampAvailable() do wait(100) end
 
           sampRegisterChatCommand("govmenu", cmd_govmenu)
 
        sampAddChatMessage("{00EEFF}[Government Helper]:{FFFFFF} Успешно загружен. Автор: {FF0000}Contadino", 0x00EEFF)
        sampAddChatMessage("{00EEFF}[Government Helper]:{FFFFFF} Просмотр команд: /govmenu ", 0x00EEFF)
        sampAddChatMessage("{00EEFF}[Government Helper]:{FFFFFF} Версия: v1.0", 0x00EEFF)

    sampRegisterChatCommand('rep', function(params)
        if params == '' then sampAddChatMessage('{00EEFF}[Government Helper]{FFFFFF} /report{858585} [text]', -1) return end
        lua_thread.create(function()
        HideDialogs = true
            sampSendChat('/report')
        wait(150)
            sampSendDialogResponse(idDialog, 1, 0, -1)
        wait(150)
            sampSendDialogResponse(idDialog, 1, -1, params)
            HideDialogs = false
        end)
    end)

--КОМАНДЫ

        sampRegisterChatCommand("dialog", dialog)
       
            sampRegisterChatCommand('pass', function(num)
        if num ~= nil then
            sampSendChat('Здравствуйте!Вам сделать паспорт? '..num)
             sampSendChat('Хорошо,тогда скажите дату рождения,например 19/5/1992'..num)
                    sampSendChat('/me достал ручки и документ'..num)
                        sampSendChat('/me записал все сказанное человеком на против'..num)
                            sampSendChat('/todo Вот держите*почесав локоть'..num)
        end
    end)
   
        sampRegisterChatCommand('fz', function(num)
        if num ~= nil then
            sampSendChat('/findibiz '..num)
        end
    end)

        sampRegisterChatCommand('ma', function(num)
        if num ~= nil then
            sampSendChat('/mask'..num)
            sampSendChat('/armour'..num)
        end
    end)
   
            sampRegisterChatCommand('rc', function(num)
        if num ~= nil then
            sampSendChat('/repcar '..num)
        end
    end)
       
        sampRegisterChatCommand('fc', function(num)
        if num ~= nil then
            sampSendChat('/fillcar'..num)
        end
    end)

        sampRegisterChatCommand('ph', function(num)
        if num ~= nil then
            sampSendChat('/phone'..num)
        end
    end)

        sampRegisterChatCommand('pred', function(num)
        if num ~= nil then
            sampSendChat('Сэр.Вы нарушаете правила,в случае если это повторится,я вас выгоню.'..num)
        end
    end)

      sampRegisterChatCommand("gg", activatecmd)
    while true do
        wait(0)
        if not isPauseMenuActive() and isPlayerPlaying(playerHandle) then
          if active == 1 then
            local valid, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
            if valid and doesCharExist(ped) then
               local result, id = sampGetPlayerIdByCharHandle(ped)
               if result then
                sampSendChat("Извините,но я должен вас выгнать по причине нарушение правил " ..num)
                    sampSendChat("/expel Неадекватное поведение  " ..id)
         end
    end

        sampRegisterChatCommand('bi', function(num)
        if num ~= nil then
            sampSendChat('/bizinfo'..num)
        end
    end)

        sampRegisterChatCommand("accent", accent)

        wait(-1)
   end


--ФУНКЦИИ

function cmd_arzmenu(arg)
    sampAddChatMessage("{FFFFFF}Commands:{00FF00} /pass Сделать паспорт {FFFFFF}||{00FF00} /fz = Найти Бизнес {FFFFFF}||{00FF00} /ph = Открыть Телефон", 0x00EEFF)
    sampAddChatMessage("{FFFFFF}Commands:{00FF00} /rc = Починить Машину {FFFFFF}||{00FF00} /fc = Заправить Машину {FFFFFF}||{00FF00} /accent = Изменить Акцент", 0x00EEFF)
    sampAddChatMessage("{FFFFFF}Commands:{00FF00} /ma Надеть Бронжилет и Маску {FFFFFF}||{00FF00} /pred /gg  = 1-предупреждение,2-выгнать ", 0x00EEFF)
    sampAddChatMessage("{FFFFFF}Commands:{00FF00} /rep = Фаст Жалоба {FFFFFF}||{00FF00} /bi - Открыть меню Бизнеса ", 0x00EEFF)
end


function accent(data)
    local text = string.match(data, '%s*(.+)')
    inifiles.settings.prefix = text
    inicfg.save(inifiles)
    sampAddChatMessage("{00EEFF}[Government Helper]:{FFFFFF} Акцент изменён.", 0x00EEFF)
end

function replace(msg)
    msg = string.format("[%s]: %s",inifiles.settings.prefix, msg)
    return msg
end


--Events

function SE.onSendChat(msg)
    msg = replace(msg)
    if msg == nil then
        return false
    end
    return {msg}
end

function sampev.onShowDialog(id, style, title, button1, button2, text)
    if HideDialogs then
        idDialog = id
        return false
        end
    end
end
 
Последнее редактирование:

damag

Женюсь на официантке в моем любимом баре
Проверенный
1,152
1,192
Lua:
script_name ("GovernmentHelper")
script_author ("Contadino")
script_description ("Helper")
local sampev = require 'lib.samp.events'
local inicfg = require 'inicfg'
local inifiles = inicfg.load({
    settings =
    {
        prefix = "RUS"
    }
},"MultiHelper.ini")
function main()
   if not isSampLoaded() or not isSampfuncsLoaded() then return end
   while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand("govmenu", cmd_govmenu)
    sampAddChatMessage("{00EEFF}[Government Helper]:{FFFFFF} Успешно загружен. Автор: {FF0000}Contadino", 0x00EEFF)
    sampAddChatMessage("{00EEFF}[Government Helper]:{FFFFFF} Просмотр команд: /govmenu ", 0x00EEFF)
    sampAddChatMessage("{00EEFF}[Government Helper]:{FFFFFF} Версия: v1.0", 0x00EEFF)
    sampRegisterChatCommand('rep', function(params)
        if params == '' then sampAddChatMessage('{00EEFF}[Government Helper]{FFFFFF} /report{858585} [text]', -1) return end
        lua_thread.create(function()
            HideDialogs = true
            sampSendChat('/report')
            wait(150)
            sampSendDialogResponse(idDialog, 1, 0, -1)
            wait(150)
            sampSendDialogResponse(idDialog, 1, -1, params)
            HideDialogs = false
        end)
    end)

--КОМАНДЫ

    sampRegisterChatCommand("dialog", dialog)
        
    sampRegisterChatCommand('pass', function(num)
        if num ~= nil then
            sampSendChat('Здравствуйте!Вам сделать паспорт? ')
            sampSendChat('Хорошо,тогда скажите дату рождения,например 19/5/1992')
            sampSendChat('/me достал ручки и документ')
            sampSendChat('/me записал все сказанное человеком на против')
            sampSendChat('/todo Вот держите*почесав локоть')
            --cmd to give pass
        end
    end)
    
    sampRegisterChatCommand('fz', function(num)
        if num ~= nil then
            sampSendChat('/findibiz '..num)
        end
    end)

    sampRegisterChatCommand('ma', function()
       sampSendChat('/mask')
       sampSendChat('/armour')
    end)
    
    sampRegisterChatCommand('rc', function()
        sampSendChat('/repcar')
    end)
        
    sampRegisterChatCommand('fc', function()
        sampSendChat('/fillcar')
    end)

    sampRegisterChatCommand('ph', function()
        sampSendChat('/phone')
    end)

    sampRegisterChatCommand('pred', function()
        sampSendChat('Сэр.Вы нарушаете правила,в случае если это повторится,я вас выгоню.')
    end)

    sampRegisterChatCommand('bi', function()
        sampSendChat('/bizinfo')
    end)

    sampRegisterChatCommand("accent", accent)
    sampRegisterChatCommand("gg", activatecmd)
    while true do wait(0)
        if not isPauseMenuActive() and isPlayerPlaying(playerHandle) then
            if active == 1 then
                local valid, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
                if valid and doesCharExist(ped) then
                    local result, id = sampGetPlayerIdByCharHandle(ped)
                    if result then
                        sampSendChat("Извините,но я должен вас выгнать по причине нарушение правил " ..num)
                        sampSendChat("/expel  " ..id)
                    end
                end
            end
        end
    end
end

function cmd_arzmenu(arg)
    sampAddChatMessage("{FFFFFF}Commands:{00FF00} /pass Сделать паспорт {FFFFFF}||{00FF00} /fz = Найти Бизнес {FFFFFF}||{00FF00} /ph = Открыть Телефон", 0x00EEFF)
    sampAddChatMessage("{FFFFFF}Commands:{00FF00} /rc = Починить Машину {FFFFFF}||{00FF00} /fc = Заправить Машину {FFFFFF}||{00FF00} /accent = Изменить Акцент", 0x00EEFF)
    sampAddChatMessage("{FFFFFF}Commands:{00FF00} /ma Надеть Бронжилет и Маску {FFFFFF}||{00FF00} /pred /gg  = 1-предупреждение,2-выгнать ", 0x00EEFF)
    sampAddChatMessage("{FFFFFF}Commands:{00FF00} /rep = Фаст Жалоба {FFFFFF}||{00FF00} /bi - Открыть меню Бизнеса ", 0x00EEFF)
end


function accent(data)
    local text = string.match(data, '%s*(.+)')
    inifiles.settings.prefix = text
    inicfg.save(inifiles)
    sampAddChatMessage("{00EEFF}[Government Helper]:{FFFFFF} Акцент изменён.", 0x00EEFF)
end

function replace(msg)
    msg = string.format("[%s]: %s",inifiles.settings.prefix, msg)
    return msg
end


--Events

function sampev.onSendChat(msg)
    msg = replace(msg)
    if msg == nil then
        return false
    end
    return {msg}
end

function sampev.onShowDialog(id, style, title, button1, button2, text)
    if HideDialogs then
        idDialog = id
        return false
    end
end
 

Contadino

Потрачен
Автор темы
32
3
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Lua:
script_name ("GovernmentHelper")
script_author ("Contadino")
script_description ("Helper")
local sampev = require 'lib.samp.events'
local inicfg = require 'inicfg'
local inifiles = inicfg.load({
    settings =
    {
        prefix = "RUS"
    }
},"MultiHelper.ini")
function main()
   if not isSampLoaded() or not isSampfuncsLoaded() then return end
   while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand("govmenu", cmd_govmenu)
    sampAddChatMessage("{00EEFF}[Government Helper]:{FFFFFF} Успешно загружен. Автор: {FF0000}Contadino", 0x00EEFF)
    sampAddChatMessage("{00EEFF}[Government Helper]:{FFFFFF} Просмотр команд: /govmenu ", 0x00EEFF)
    sampAddChatMessage("{00EEFF}[Government Helper]:{FFFFFF} Версия: v1.0", 0x00EEFF)
    sampRegisterChatCommand('rep', function(params)
        if params == '' then sampAddChatMessage('{00EEFF}[Government Helper]{FFFFFF} /report{858585} [text]', -1) return end
        lua_thread.create(function()
            HideDialogs = true
            sampSendChat('/report')
            wait(150)
            sampSendDialogResponse(idDialog, 1, 0, -1)
            wait(150)
            sampSendDialogResponse(idDialog, 1, -1, params)
            HideDialogs = false
        end)
    end)

--КОМАНДЫ

    sampRegisterChatCommand("dialog", dialog)
       
    sampRegisterChatCommand('pass', function(num)
        if num ~= nil then
            sampSendChat('Здравствуйте!Вам сделать паспорт? ')
            sampSendChat('Хорошо,тогда скажите дату рождения,например 19/5/1992')
            sampSendChat('/me достал ручки и документ')
            sampSendChat('/me записал все сказанное человеком на против')
            sampSendChat('/todo Вот держите*почесав локоть')
            --cmd to give pass
        end
    end)
   
    sampRegisterChatCommand('fz', function(num)
        if num ~= nil then
            sampSendChat('/findibiz '..num)
        end
    end)

    sampRegisterChatCommand('ma', function()
       sampSendChat('/mask')
       sampSendChat('/armour')
    end)
   
    sampRegisterChatCommand('rc', function()
        sampSendChat('/repcar')
    end)
       
    sampRegisterChatCommand('fc', function()
        sampSendChat('/fillcar')
    end)

    sampRegisterChatCommand('ph', function()
        sampSendChat('/phone')
    end)

    sampRegisterChatCommand('pred', function()
        sampSendChat('Сэр.Вы нарушаете правила,в случае если это повторится,я вас выгоню.')
    end)

    sampRegisterChatCommand('bi', function()
        sampSendChat('/bizinfo')
    end)

    sampRegisterChatCommand("accent", accent)
    sampRegisterChatCommand("gg", activatecmd)
    while true do wait(0)
        if not isPauseMenuActive() and isPlayerPlaying(playerHandle) then
            if active == 1 then
                local valid, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
                if valid and doesCharExist(ped) then
                    local result, id = sampGetPlayerIdByCharHandle(ped)
                    if result then
                        sampSendChat("Извините,но я должен вас выгнать по причине нарушение правил " ..num)
                        sampSendChat("/expel  " ..id)
                    end
                end
            end
        end
    end
end

function cmd_arzmenu(arg)
    sampAddChatMessage("{FFFFFF}Commands:{00FF00} /pass Сделать паспорт {FFFFFF}||{00FF00} /fz = Найти Бизнес {FFFFFF}||{00FF00} /ph = Открыть Телефон", 0x00EEFF)
    sampAddChatMessage("{FFFFFF}Commands:{00FF00} /rc = Починить Машину {FFFFFF}||{00FF00} /fc = Заправить Машину {FFFFFF}||{00FF00} /accent = Изменить Акцент", 0x00EEFF)
    sampAddChatMessage("{FFFFFF}Commands:{00FF00} /ma Надеть Бронжилет и Маску {FFFFFF}||{00FF00} /pred /gg  = 1-предупреждение,2-выгнать ", 0x00EEFF)
    sampAddChatMessage("{FFFFFF}Commands:{00FF00} /rep = Фаст Жалоба {FFFFFF}||{00FF00} /bi - Открыть меню Бизнеса ", 0x00EEFF)
end


function accent(data)
    local text = string.match(data, '%s*(.+)')
    inifiles.settings.prefix = text
    inicfg.save(inifiles)
    sampAddChatMessage("{00EEFF}[Government Helper]:{FFFFFF} Акцент изменён.", 0x00EEFF)
end

function replace(msg)
    msg = string.format("[%s]: %s",inifiles.settings.prefix, msg)
    return msg
end


--Events

function sampev.onSendChat(msg)
    msg = replace(msg)
    if msg == nil then
        return false
    end
    return {msg}
end

function sampev.onShowDialog(id, style, title, button1, button2, text)
    if HideDialogs then
        idDialog = id
        return false
    end
end
[ML] (error) GovernmentHelper: attempt to call a nil value
stack traceback:
[ML] (error) GovernmentHelper: Script died due to an error. (17631DD4)
такая вот ошибочка
 
  • Нравится
Реакции: Nisan