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

Wysłany: 2017-02-03, 23:09


mixLoLmix2

Programista






Wiek: 35
Na forum: 4254 dni
Posty: 454
Nick w MP: TomeQmix

Piwa: 1915

Respekt: 47,3

Mam taki problem z Skalowaniem, Mam tu taki kod ale Na Innych rozdzielczosciach ni? 640-480 Elementy wychodza troche za ekran


x,y=36.63,82.19 -- my width
intro_step=math.random(0,850)

local sx,sy=guiGetScreenSize()
local data={ showed=nil, button={}, info=nil, misc=nil, }

function isMouseIn(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 dist = 10    
local angler = 0
function getPointFromDistanceRotation(x, y, dist, angler)
    local a = math.rad(20 - angler)
    local dx = math.cos(a) * dist;
    local dy = math.sin(a) * dist;
    return x+dx, y+dy;
end

function renderLoginBox()
    if data.info then dxDrawText(data.info, sx*36/640, sy*124/480, sx*156/640, sy*31/480, tocolor(237, 0, 0, 255), 1.00, "default", "center", "center", false) end
dxDrawImage(0, 0, 640, 480, "panel.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    



end
--loguj = guiCreateButton(0.07, 0.58, 0.22, 0.08, "", true, wm.window)\
--rejestruj = guiCreateButton(0.07, 0.68, 0.22, 0.08, "", true, wm.window)

--log = guiCreateButton(0.07, 0.57, 0.21, 0.08, "", true)
--reg = guiCreateButton(0.08, 0.68, 0.21, 0.07, "", true)
        --dxDrawText("", 44, 271, 181, 315, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false)
        --dxDrawText("", 44, 321, 181, 360, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false)
   -- end
--)

addEventHandler("onClientClick", root, function(btn,state)
    if btn=="left" and state=="down" then
        if isMouseIn(44, 271, 181, 315) and data.showed then
            local login=guiGetText(data.button[1])
            local pass=guiGetText(data.button[2])
            if string.len(login) < 2 or string.len(pass) < 2 then
                data.info="Wype?nij wszystkie pola!"
                return
            end
            triggerServerEvent("logging:checkAccount", resourceRoot, login, pass)
        end
        if isMouseIn(44, 321, 181, 360) and data.showed then
            local login=guiGetText(data.button[1])
            local pass=guiGetText(data.button[2])
            if string.len(login) < 2 or string.len(pass) < 2 then
                data.info="Wype?nij wszystkie pola!"
                return
            end
            if string.len(login) > 22 or string.len(pass) > 30 then
                data.info="Login/Has?o musi mie? mniej ni? 22/30 znak?w."
                return
            end
            triggerServerEvent("logging:newAccount", resourceRoot, login, pass)
        end
    end
end)

addEvent("logging:result", true)
addEventHandler("logging:result", resourceRoot, function(value,info)
    if not info then info="" end
    if value then
        data.showed=false
        showZones(data.misc)
        
        -- Usuwamy elementy
        destroyElement(data.button[1])
        destroyElement(data.button[2])
        removeEventHandler("onClientRender", root, renderLoginBox)
    else
        data.info=tostring(info)
        setTimer(function() data.info=nil end, 3000, 1)
    end
end)

addEventHandler("onClientResourceStart", resourceRoot, function()
    showChat(false)
    showCursor(true)
    fadeCamera(true)
    data.showed=true
    setElementAlpha(localPlayer,0)
    data.misc=playSound("misc/intro.mp3",true)
    setSoundVolume(data.misc, 1.0)
    showPlayerHudComponent("all",false)
    guiSetInputMode("no_binds_when_editing")
    setElementData(localPlayer,"status","Loguje si?")
    setElementData(localPlayer,"player:logged",false)
    addEventHandler("onClientRender", root, renderLoginBox)
    data.button[1]=guiCreateEdit(0.10, 0.37, 0.15, 0.04, "", true)
    data.button[2]=guiCreateEdit(0.10, 0.48, 0.18, 0.04, "", true)   
    guiEditSetMasked(data.button[2],true)
end)


Podpis
Zajmuję się pisaniem zaawansowanych skryptów lua na zamówienie za bardzo niską cene.
Oraz pomoc przy serwerze mta/forum i tym podobnych.
Discord: TomeQmix#7106
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-04, 12:48


_Haze

Peace Yo!






Wiek: 25
Na forum: 4325 dni
Posty: 1648
Nick w MP: Haze

Piwa: 2628

Respekt: 1020
Respekt: 1020

mixLoLmix2, spr?buj to wyskalowa? guieditorze relativem.

Postaw piwo autorowi tego posta
 

 
Tagi: panel :: logowania :: skalalowanie
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Panel Logowania Skalalowanie 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