diolog

- |2347| -

Активный
Автор темы
218
58
Версия SA-MP
  1. Любая
  2. Другая
как в диологе заменить текст ВТС: на свой текст


Lua:
local sampev = require 'samp.events'
function sampev.onShowDialog(dialogId, style, title, button1, button2, text)
    
text = text:gsub("{......}","")
    for line in text:gmatch("[^\n]+") do
        if line:find('BTC:') then
            local rank = '123'
            print(rank)

        end
    end
end
 
Решение
Lua:
local sampev = require('lib.samp.events')
function sampev.onShowDialog(dialogId, style, title, button1, button2, text)
    if title:find('Основная статистика') then
        local new_text = {}
        for line in text:gmatch("[^\r\n]+") do
            --print(line)
            if line:find("BTC:%s+{.-}%[(%d+)%]") then
                line = string.gsub(line, "BTC:%s+{.-}%[(%d+)%]", "BTC: {B83434}[9999999]")
            end
            table.insert(new_text, line)
        end
        return {dialogId, style, title, button1, button2, table.concat(new_text, "\n")}
    end
end
1714930871818.png

хромиус)

спокойно, это всего лишь слива
Друг
4,960
3,232
Lua:
local sampev = require('lib.samp.events')
function sampev.onShowDialog(dialogId, style, title, button1, button2, text)
  text = text:gsub("{.-}",'')
  local new_text = {}
  for line in text:gmatch("[^\r\n]+") do
    if line:find("BTC:%s+(%d+)") then
      line = string.gsub(line, "BTC:%s+(%d+)", "BTC: 9999999")
    end
    table.insert(new_text, line)
  end
  return {dialogId, style, title, button1, button2, table.concat(new_text, "\n")}
end
должно быть так
 

- |2347| -

Активный
Автор темы
218
58
Lua:
local sampev = require('lib.samp.events')
function sampev.onShowDialog(dialogId, style, title, button1, button2, text)
  text = text:gsub("{.-}",'')
  local new_text = {}
  for line in text:gmatch("[^\r\n]+") do
    if line:find("BTC:%s+(%d+)") then
      line = string.gsub(line, "BTC:%s+(%d+)", "BTC: 9999999")
    end
    table.insert(new_text, line)
  end
  return {dialogId, style, title, button1, button2, table.concat(new_text, "\n")}
end
должно быть так
Ничего не происходит
 

хромиус)

спокойно, это всего лишь слива
Друг
4,960
3,232
Lua:
local sampev = require('lib.samp.events')
function sampev.onShowDialog(dialogId, style, title, button1, button2, text)
    if title:find('Основная статистика') then
        local new_text = {}
        for line in text:gmatch("[^\r\n]+") do
            --print(line)
            if line:find("BTC:%s+{.-}%[(%d+)%]") then
                line = string.gsub(line, "BTC:%s+{.-}%[(%d+)%]", "BTC: {B83434}[9999999]")
            end
            table.insert(new_text, line)
        end
        return {dialogId, style, title, button1, button2, table.concat(new_text, "\n")}
    end
end
1714930871818.png
 
Последнее редактирование:
  • Нравится
Реакции: aksi0ma