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: 3072 dni
Posty: 319
Nick w MP: Query

Piwa: 5257

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 screenWscreenH guiGetScreenSize()
local sxsy guiGetScreenSize()

local editboxs = {}
local liters 0

local gui_showed false

function editbox_create(editnamex1x2x3x4xx1xx2xx3xx4main_namemasked)
    if masked then
        masked true
    else
        masked false
    end
    table.insert(editboxs, {editnamex1x2x3x4xx1xx2xx3xx4truefalsemain_namemasked})
    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(editboxsi)
            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(textv[3]+1v[4]+1v[5]+1v[6]+1tocolor(000255), 1czcionka"left""center"truefalsetruefalsefalse)
            dxDrawText(textv[3], v[4], v[5], v[6], tocolor(255255255255), 1czcionka"left""center"truefalsetruefalsefalse)

    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], 1string.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(bkey)
    for i,v in ipairs(editboxs) do
        if zakazane_przyciski[bthen
            cancelEvent()
        end
        for i,v in ipairs(zakazane_litery) do
            if v[1] == b then
                cancelEvent()
            end
        end
    end
end)

addEventHandler("onClientClick"root, function(bs)
    if ~= "state" and ~= "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: 3577 dni
Posty: 472
Nick w MP: Qwertick

Piwa: 2726

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: 3072 dni
Posty: 319
Nick w MP: Query

Piwa: 5257

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 » Editbox 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