Можно передвинуть всплывающий текст денег справа внизу?

Albann770

Известный
Автор темы
4
0
Версия SA-MP
  1. 0.3.7 (R1)
Можно передвинуть всплывающий текст денег справа внизу?
Может скрипт какой есть? Ну или какие варианты есть?
Спасибо...
 

Вложения

  • Скриншот 16.04.26_20.32.29.png
    Скриншот 16.04.26_20.32.29.png
    410.2 KB · Просмотры: 24

Albann770

Известный
Автор темы
4
0
Мне хотелось бы поэкспериментировать люблю собирать сборки. И там бывает спидометр установишь и они мешают друг другу и туда можно окно ставить смотреть ютуб (Картинка в картинке). Ну в общем хотелось бы чтоб была возможность перемещать.Как-то так))
 

undefineders

Участник
44
23
держи (работает)

активация /mny:
local vkeys = require 'vkeys'
local samp = require 'samp.events'

local cfg = {
    pos = {x = 500, y = 100},
    show_time = 3000
}

local conf_path = getWorkingDirectory() .. "\\config\\money_mover.ini"
local active = false
local last_money = 0
local display_text = ""
local display_color = 0xFFFFFFFF
local timer = 0

function main()
    while not isSampAvailable() do wait(100) end
    
    if doesFileExist(conf_path) then
        local f = io.open(conf_path, "r")
        if f then
            cfg.pos.x = tonumber(f:read("*line")) or 500
            cfg.pos.y = tonumber(f:read("*line")) or 100
            f:close()
        end
    end

    sampAddChatMessage("{FFD700}[MoneyMover]{FFFFFF} Скрипт загружен. Команда: {FFD700}/mny", -1)
    last_money = getPlayerMoney(playerHandle)

    sampRegisterChatCommand("mny", function()
        active = not active
        if active then
            sampAddChatMessage("{FFD700}[MoneyMover]{FFFFFF} Режим настройки: зажми {BBBBBB}ЛКМ{FFFFFF} и двигай. Повтори /mny для сохранения.", -1)
            sampSetCursorMode(3)
            display_text = "-1488$"
            display_color = 0xFF3232BB
            timer = os.clock() + 999999
        else
            sampSetCursorMode(0)
            timer = 0 -- Скрыть
            saveConfig()
            sampAddChatMessage("{00FF00}[MoneyMover]{FFFFFF} Позиция сохранена!", -1)
        end
    end)

    while true do
        wait(0)
        local current_money = getPlayerMoney(playerHandle)

        if not active and current_money ~= last_money then
            local diff = current_money - last_money
            if diff > 0 then
                display_text = "+" .. diff .. "$"
                display_color = 0xFF4CAF50
            else
                display_text = diff .. "$"
                display_color = 0xFF3232BB
            end
            timer = os.clock() + (cfg.show_time / 1000)
            last_money = current_money
        end

        if active or os.clock() < timer then
            if active and isKeyDown(vkeys.VK_LBUTTON) then
                local mx, my = getCursorPos()
                local sw, sh = getScreenResolution()
                cfg.pos.x = mx / (sw / 640)
                cfg.pos.y = my / (sh / 448)
            end
            
            drawMoneyText(display_text, cfg.pos.x, cfg.pos.y, display_color)
        else
            sampTextdrawDelete(228)
        end
    end
end

function drawMoneyText(text, x, y, color)
    if sampTextdrawIsExists(228) then
        sampTextdrawSetPos(228, x, y)
        sampTextdrawSetString(228, text)
        sampTextdrawSetLetterSizeAndColor(228, 0.6, 2.2, color)
    else
        sampTextdrawCreate(228, text, x, y)
        sampTextdrawSetLetterSizeAndColor(228, 0.6, 2.2, color)
        sampTextdrawSetOutlineColor(228, 2, 0xFF000000)
        sampTextdrawSetStyle(228, 2)
        sampTextdrawSetProportional(228, true)
    end
end

function saveConfig()
    if not doesDirectoryExist(getWorkingDirectory() .. "\\config") then
        createDirectory(getWorkingDirectory() .. "\\config")
    end
    local f = io.open(conf_path, "w")
    if f then
        f:write(cfg.pos.x .. "\n" .. cfg.pos.y)
        f:close()
    end
end
 

менталейшн

Известный
1,705
336
function drawMoneyText(text, x, y, color)
if sampTextdrawIsExists(228) then
sampTextdrawSetPos(228, x, y)
sampTextdrawSetString(228, text)
sampTextdrawSetLetterSizeAndColor(228, 0.6, 2.2, color)
else
sampTextdrawCreate(228, text, x, y)
sampTextdrawSetLetterSizeAndColor(228, 0.6, 2.2, color)
sampTextdrawSetOutlineColor(228, 2, 0xFF000000)
sampTextdrawSetStyle(228, 2)
sampTextdrawSetProportional(228, true)
end
end
это ж не текстдрав а геймтекст
 

Albann770

Известный
Автор темы
4
0
держи (работает)

активация /mny:
local vkeys = require 'vkeys'
local samp = require 'samp.events'

local cfg = {
    pos = {x = 500, y = 100},
    show_time = 3000
}

local conf_path = getWorkingDirectory() .. "\\config\\money_mover.ini"
local active = false
local last_money = 0
local display_text = ""
local display_color = 0xFFFFFFFF
local timer = 0

function main()
    while not isSampAvailable() do wait(100) end
   
    if doesFileExist(conf_path) then
        local f = io.open(conf_path, "r")
        if f then
            cfg.pos.x = tonumber(f:read("*line")) or 500
            cfg.pos.y = tonumber(f:read("*line")) or 100
            f:close()
        end
    end

    sampAddChatMessage("{FFD700}[MoneyMover]{FFFFFF} Скрипт загружен. Команда: {FFD700}/mny", -1)
    last_money = getPlayerMoney(playerHandle)

    sampRegisterChatCommand("mny", function()
        active = not active
        if active then
            sampAddChatMessage("{FFD700}[MoneyMover]{FFFFFF} Режим настройки: зажми {BBBBBB}ЛКМ{FFFFFF} и двигай. Повтори /mny для сохранения.", -1)
            sampSetCursorMode(3)
            display_text = "-1488$"
            display_color = 0xFF3232BB
            timer = os.clock() + 999999
        else
            sampSetCursorMode(0)
            timer = 0 -- Скрыть
            saveConfig()
            sampAddChatMessage("{00FF00}[MoneyMover]{FFFFFF} Позиция сохранена!", -1)
        end
    end)

    while true do
        wait(0)
        local current_money = getPlayerMoney(playerHandle)

        if not active and current_money ~= last_money then
            local diff = current_money - last_money
            if diff > 0 then
                display_text = "+" .. diff .. "$"
                display_color = 0xFF4CAF50
            else
                display_text = diff .. "$"
                display_color = 0xFF3232BB
            end
            timer = os.clock() + (cfg.show_time / 1000)
            last_money = current_money
        end

        if active or os.clock() < timer then
            if active and isKeyDown(vkeys.VK_LBUTTON) then
                local mx, my = getCursorPos()
                local sw, sh = getScreenResolution()
                cfg.pos.x = mx / (sw / 640)
                cfg.pos.y = my / (sh / 448)
            end
           
            drawMoneyText(display_text, cfg.pos.x, cfg.pos.y, display_color)
        else
            sampTextdrawDelete(228)
        end
    end
end

function drawMoneyText(text, x, y, color)
    if sampTextdrawIsExists(228) then
        sampTextdrawSetPos(228, x, y)
        sampTextdrawSetString(228, text)
        sampTextdrawSetLetterSizeAndColor(228, 0.6, 2.2, color)
    else
        sampTextdrawCreate(228, text, x, y)
        sampTextdrawSetLetterSizeAndColor(228, 0.6, 2.2, color)
        sampTextdrawSetOutlineColor(228, 2, 0xFF000000)
        sampTextdrawSetStyle(228, 2)
        sampTextdrawSetProportional(228, true)
    end
end

function saveConfig()
    if not doesDirectoryExist(getWorkingDirectory() .. "\\config") then
        createDirectory(getWorkingDirectory() .. "\\config")
    end
    local f = io.open(conf_path, "w")
    if f then
        f:write(cfg.pos.x .. "\n" .. cfg.pos.y)
        f:close()
    end
end
Спасибо но что-то вообще не работает((

это ж не текстдрав а геймтекст
Хочешь сказать что нельзя эго двигать?
Я просто не шарю (текстдрав и гейтекст) не знаю отличие в чем.((