Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2018-10-16, 18:45


Query

SyndicateMTA






Wiek: 24
Na forum: 3213 dni
Posty: 319
Nick w MP: Query

Piwa: 5238

Respekt: 141
Respekt: 141

Heja! Chcia?bym doda? tak? funkcje do editbox?w ?e na dole ?aduje sie taki paseczek na dany kolor. Kodzik exitbox?w
local screenW, screenH = guiGetScreenSize()
local sx, sy = guiGetScreenSize()

local editboxs = {}
local liters = 0

local gui_showed = false

function editbox_create(edit, name, x1, x2, x3, x4, xx1, xx2, xx3, xx4, main_name, masked)
    if masked then
        masked = true
    else
        masked = false
    end
    table.insert(editboxs, {edit, name, x1, x2, x3, x4, xx1, xx2, xx3, xx4, true, false, main_name, masked})
    liters = liters+1
    if gui_showed ~= true then
        gui_showed = true
    end
end

function editbox_destroy(name)
    for i=#editboxs, 1, -1 do
        if editboxs[i][13] == name then
            table.remove(editboxs, i)
            if gui_showed == true then
                if liters == 1 then
                    gui_showed = false
                else
                    liters = liters-1
                end
            end
        end
    end
end

function mysz(psx,psy,pssx,pssy,abx,aby)
    if not isCursorShowing() then return end
    cx,cy=getCursorPosition()
    cx,cy=cx*sx,cy*sy
    if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
        return true,cx,cy
    else
        return false
    end
end

local czcionka = dxCreateFont("cz.ttf", 11)

addEventHandler("onClientRender", root, function()
    for i,v in ipairs(editboxs) do
        local text = ""
        if v[1] == "" and v[12] ~= true then
            text = v[2]
        elseif v[12] == true then
            text = v[1]
            if v[14] == true then
                text = string.gsub(text, ".", "&#8226;")
            end
            text = text.."|"
        else
            text = v[1]
            if v[14] == true then
                text = string.gsub(text, ".", "&#8226;")
            end
        end
    
        
        dxDrawText(text, v[3]+1, v[4]+1, v[5]+1, v[6]+1, tocolor(0, 0, 0, 255), 1, czcionka, "left", "center", true, false, true, false, false)
            dxDrawText(text, v[3], v[4], v[5], v[6], tocolor(255, 255, 255, 255), 1, czcionka, "left", "center", true, false, true, false, false)

    end
end)

function editbox_text(name)
    for i,v in ipairs(editboxs) do
        if v[13] == name then
            return v[1]
        end
    end
end

bindKey("backspace", "down", function()
    for i,v in ipairs(editboxs) do
        if v[12] == true then
            v[1] = string.sub(v[1], 1, string.len(v[1])-1)
        end
    end
end)

local zakazane_litery = {
{"t"},
{"y"},
{"o"},
{"p"},
{"f"},
{"c"},
{"v"},
}

local zakazane_przyciski = {
["enter"] = true,    
["lshift"] = true,
["f5"] = true,
}

addEventHandler("onClientCharacter", root, function(key)
    if not key then return end
    for i,v in ipairs(editboxs) do
        if v[12] == true then
            v[1] = v[1]..""..key
        end
    end
end)

addEventHandler("onClientKey", root, function(b, key)
    for i,v in ipairs(editboxs) do
        if zakazane_przyciski[b] then
            cancelEvent()
        end
        for i,v in ipairs(zakazane_litery) do
            if v[1] == b then
                cancelEvent()
            end
        end
    end
end)

addEventHandler("onClientClick", root, function(b, s)
    if b ~= "state" and s ~= "down" then return end
    for i,v in ipairs(editboxs) do
        if v[12] == true then
            v[12] = false
        else
            if mysz(v[7], v[8], v[9], v[10]) and v[11] == true then
                v[12] = true
            end
        end
    end
end)


stawiam piwko i respekcik

Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-10-16, 21:50


Qwertick

Coming soon...






Wiek: 23
Na forum: 3718 dni
Posty: 472
Nick w MP: Qwertick

Piwa: 2727

Respekt: 215,8
Respekt: 215,8Respekt: 215,8

U?yj sobie np. dxDrawRectangle ustaw dobrze i dodaj do tego interpolateBetween

Podpis

Kontakt
Discord: Qwertick#1210

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-10-17, 08:06


Query

SyndicateMTA






Wiek: 24
Na forum: 3213 dni
Posty: 319
Nick w MP: Query

Piwa: 5238

Respekt: 141
Respekt: 141

M?g?by? mnie nakierowa?? Bo troszk? nie rozumiem... :-?

Podpis
Postaw piwo autorowi tego posta
 

 
Tagi: editbox
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku