Спавнит фуру как только видет штраф

mrproper

Участник
Автор темы
166
15
Версия MoonLoader
Другое
Крч, я сдаю фуру, и иногда когда я АФК много кто специально топит взрывает фуру, иза чего появляется штраф, можно чтобы от первого сообщения фура скриптом выгружалась из сервера?
Arizona RP
 

YarikVL

Известный
Проверенный
4,797
1,813
Попрошу более знающих подправить данный код, так как скорее всего он не работает.
Lua:
require 'lib.moonloader'
local sampev = require 'samp.events'
local t = {}

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end
   sampRegisterChatCommand("autounloadtruck", function()
      active = not active
      printStringNow(active and "Auto Unload Truck ON" or "Auto Unload Truck OFF")
   end)
    while true do wait(0)
       if active and #t > 0 and sampIsDialogActive()
       for i = 1, #t do
          lline = t[i]
          sampSendDialogResponse(sampGetCurrentDialogId(), 1, lline, nil)
          wait(150)
          sampSendDialogResponse(sampGetCurrentDialogId(), 1, 11, nil)
       end
    end
end

function sampev.onServerMessage(color, text)
lua_thread.create(function()
    if text:find('Ваш автомобиль был взорван') and not text:find("говорит") then
       if not sampIsCursorActive() then
           sampSendChat("/cars")
           repeat wait(0) until sampIsDialogActive()
           local line = -1
           for v in string.gmatch(text, '[^\r\n]+') do
              if text:find("ТОЧНОЕ НАЗВАНИЕ ТВОЕЙ ФУРЫ") and not text:find("Не загружено") then
                    line = line + 1
                    table.insert(t, line)
              end
           end
       else
          repeat wait(0) until not sampIsCursorActive()
          sampSendChat("/cars")
           repeat wait(0) until sampIsDialogActive()
           local line = -1
           for v in string.gmatch(text, '[^\r\n]+') do
              if text:find("ТОЧНОЕ НАЗВАНИЕ ТВОЕЙ ФУРЫ") and not text:find("Не загружено") then
                    line = line + 1
                    table.insert(t, line)
              end
           end
end)
end
Писал с телефона, возможно что-то потерял и извините за табуляцию)
 

lontumiarn

Активный
344
58
Можно диалог /cars еще
1649848832455.png
 

sat0ry

Известный
1,088
290
lua:
require 'moonloader'
local sampev = require('samp.events')

local act = false

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

    sampRegisterChatCommand('unloadtruck', function()
        act = not act

        if act then
            sampAddChatMessage('[UnLoadTruck] Скрипт активирован!', -1)
        else
            sampAddChatMessage('[UnLoadTruck] Скрипт деактивирован!', -1)
        end
    end)

    sampAddChatMessage('[UnLoadTruck] Был успешно загружен!', -1)

    while true do
        wait(0)
        if act and sampGetDialogCaption():find('Мой транспорт') then
            sampSendDialogResponse(sampGetCurrentDialogId(), 1, 0, nil)
        end

        if act and sampGetDialogCaption():find('Инструменты для') then
            sampSendDialogResponse(sampGetCurrentDialogId(), 1 , 11, nil)
        end
    end
end

function sampev.onServerMessage(color, text)
    if text:find('Ваш автомобиль был взорван и уничтожен') and act then
        sampSendChat('/cars')
    end
end
Без костылей не получилось, но зато работает!(Выгружает лишь тот транспорт, который находится на первой строчке, в моем случае MountBike)

timecodes: 0:21 - 1:01
 

mrproper

Участник
Автор темы
166
15
lua:
require 'moonloader'
local sampev = require('samp.events')

local act = false

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

    sampRegisterChatCommand('unloadtruck', function()
        act = not act

        if act then
            sampAddChatMessage('[UnLoadTruck] Скрипт активирован!', -1)
        else
            sampAddChatMessage('[UnLoadTruck] Скрипт деактивирован!', -1)
        end
    end)

    sampAddChatMessage('[UnLoadTruck] Был успешно загружен!', -1)

    while true do
        wait(0)
        if act and sampGetDialogCaption():find('Мой транспорт') then
            sampSendDialogResponse(sampGetCurrentDialogId(), 1, 0, nil)
        end

        if act and sampGetDialogCaption():find('Инструменты для') then
            sampSendDialogResponse(sampGetCurrentDialogId(), 1 , 11, nil)
        end
    end
end

function sampev.onServerMessage(color, text)
    if text:find('Ваш автомобиль был взорван и уничтожен') and act then
        sampSendChat('/cars')
    end
end
Без костылей не получилось, но зато работает!(Выгружает лишь тот транспорт, который находится на первой строчке, в моем случае MountBike)

timecodes: 0:21 - 1:01
Огромное спасибо!
 

lontumiarn

Активный
344
58
lua:
require 'moonloader'
local sampev = require('samp.events')

local act = false

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

    sampRegisterChatCommand('unloadtruck', function()
        act = not act

        if act then
            sampAddChatMessage('[UnLoadTruck] Скрипт активирован!', -1)
        else
            sampAddChatMessage('[UnLoadTruck] Скрипт деактивирован!', -1)
        end
    end)

    sampAddChatMessage('[UnLoadTruck] Был успешно загружен!', -1)

    while true do
        wait(0)
        if act and sampGetDialogCaption():find('Мой транспорт') then
            sampSendDialogResponse(sampGetCurrentDialogId(), 1, 0, nil)
        end

        if act and sampGetDialogCaption():find('Инструменты для') then
            sampSendDialogResponse(sampGetCurrentDialogId(), 1 , 11, nil)
        end
    end
end

function sampev.onServerMessage(color, text)
    if text:find('Ваш автомобиль был взорван и уничтожен') and act then
        sampSendChat('/cars')
    end
end
Без костылей не получилось, но зато работает!(Выгружает лишь тот транспорт, который находится на первой строчке, в моем случае MountBike)

timecodes: 0:21 - 1:01
сделай чтобы когда в чат так пишут то чтобы не выгружало