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

Wysłany: 2018-12-04, 16:00


Kulegg







Wiek: 46
Na forum: 3266 dni
Posty: 283

Piwa: 20

Respekt: 50

Dobry,
Jak zrobi? by hud z neta nie pojawia? si? w panelu logowania tylko dopiero jak gracz si? zrespi ju? np. na spawnie?

(te bia?e kwadraty s? do zakrycia bo nie chce pokazywa? panelu xd)

https://imgur.com/a/PlzGTvr

Kod z hudu:


--[[
Autor kodu: Wercio.
Wykonane dla GTAO.PL
Zakaz zmiany autora!
]]

local sw,sh = guiGetScreenSize()
foNte3 = dxCreateFont("tf.ttf",20) or "defaul-bold"
foNte2 = dxCreateFont("tff.ttf",17) or "defaul-bold"
foNte1 = dxCreateFont("tff.ttf",26) or "defaul-bold"

addEventHandler("onClientRender", root, function()
    if isPlayerMapVisible() then return end
    
    showPlayerHudComponent("clock", false)
    showPlayerHudComponent("health", false)
    showPlayerHudComponent("money", false)
    showPlayerHudComponent("armour", false)
    showPlayerHudComponent("weapon", false)
    showPlayerHudComponent("ammo", false)
    showPlayerHudComponent("wanted",false)
    showPlayerHudComponent("breath",false)
    
    function roundedRectangle(x, y, w, h, color)
    dxDrawRectangle(x, y, w, h, color, false)
    dxDrawRectangle(x + 2, y - 1, w - 4, 1, color, false)
    dxDrawRectangle(x + 2, y + h, w - 4, 1, color, false)
    dxDrawRectangle(x - 1, y + 2, 1, h - 4, color, false)
    dxDrawRectangle(x + w, y + 2, 1, h - 4, color, false)
end
    
     local nick = getPlayerName(getLocalPlayer()):gsub("#%x%x%x%x%x%x","")
     local timehour, timeminute = getTime()
     local money = getPlayerMoney(localPlayer)
     local ping = getPlayerPing(localPlayer)
    
     roundedRectangle(sw* 0.7562, sh* 0.0189, sw* 0.2299, sh* 0.1789, tocolor(0, 0, 0, 180), false)
     roundedRectangle(sw* 0.7562, sh* 0.0078, sw* 0.2299, sh* 0.0544, tocolor(32, 155, 0, 255), false)
     dxDrawText(""..nick.."", sw * 0.7556, sh * 0.0040, sw * 0.9861, sh * 0.0522, tocolor(255, 255, 255, 255), 1.25, foNte3, "center", "top", false, false, false, false, false)
     dxDrawText(""..timehour..":"..timeminute.."", sw * 0.7556, sh * 0.0650, sw * 0.9812, sh * 0.2133, tocolor(255, 255, 255, 255), 1.00, foNte2, "center", "top", false, false, false, false, false)
     dxDrawText("PLN "..money.."", sw * 0.7556, sh * 0.1100, sw * 0.9812, sh * 0.2133, tocolor(255, 255, 255, 255), 0.65, foNte1, "center", "top", false, false, false, false, false)
     dxDrawText("Ping "..ping.."", sw * 0.7556, sh * 0.1550, sw * 0.9812, sh * 0.2133, tocolor(255, 255, 255, 255), 1.00, foNte2, "center", "top", false, false, false, false, false)
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-12-04, 16:38


Query

SyndicateMTA






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

Piwa: 5238

Respekt: 141
Respekt: 141

dodaj po eventHandlerze
if not getElementData(player:logged) then return end


Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-12-04, 16:49


Kulegg







Wiek: 46
Na forum: 3266 dni
Posty: 283

Piwa: 20

Respekt: 50

Doda?em tak jak napisa?e?, i mi znik? ca?kiem i teraz go wog?le nie wida? nawet po zalogowaniu si?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-12-04, 17:01


Query

SyndicateMTA






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

Piwa: 5238

Respekt: 141
Respekt: 141

Poka? kod panelu logowania i hud'u

Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-12-04, 17:10


Kulegg







Wiek: 46
Na forum: 3266 dni
Posty: 283

Piwa: 20

Respekt: 50

c_logging

if getElementData(localPlayer, "player:sid") then return end

local root = getRootElement()
local resourceRoot = getResourceRootElement(getThisResource())
local screenWidth, screenHeight = guiGetScreenSize()


local blurStrength = 20


local myScreenSource = dxCreateScreenSource(screenWidth, screenHeight)
blurShader, blurTec = dxCreateShader("shaders/BlurShader.fx")


function renderblur()
    if blur == true then
        dxUpdateScreenSource(myScreenSource)
        
        dxSetShaderValue(blurShader, "ScreenSource", myScreenSource);
        dxSetShaderValue(blurShader, "BlurStrength", blurStrength);
        dxSetShaderValue(blurShader, "UVSize", screenWidth, screenHeight);

        dxDrawImage(0, 0, screenWidth, screenHeight, blurShader)
    end
end
addEventHandler("onClientRender", root, renderblur)

addEventHandler("onClientResourceStop", resourceRoot,
function()
    if (blurShader) then
        destroyElement(blurShader)
        blurShader = nil
    end
end)

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

function renderLoginBox()
    blur = true
    --dxDrawImage(0, 0, 1920, 1080, "misc/drift.png", AristatesYuvarlak, 0, 0, tocolor(255, 255, 255, 255), false)
    dxDrawRectangle(sx*270/1025, sy*150/769, sx*500/1025, sy*458/767, tocolor(0, 0, 0, 135), false)
    --dxDrawImage(0, 0, 1920, 1080, "misc/drift.png", AristatesYuvarlak, 0, 0, tocolor(255, 255, 255, 255), false)
    if data.info then dxDrawText(data.info, sx*252/1024, sy*272/768, sx*800/1024, sy*255/768, tocolor(237, 0, 0, 255), 1.00, "default", "center", "center", false) end
    --dxDrawLine(sx*0/1024, sy*199/768, sx*1022/1024, sy*200/768, tocolor(31, 111, 193, 255), 5, false)
    --dxDrawLine(sx*0/1024, sy*509/768, sx*1022/1024, sy*510/768, tocolor(31, 111, 193, 255), 5, false)
    dxDrawText("Nick U?ytkownika", sx*280/1024, sy*270/768, sx*760/1024, sy*302/768, white, 1.30, "default-bold", "center", "center", false)
    dxDrawText("Has?o U?ytkownika", sx*-240/1024, sy*480/768, sx*1280/1024, sy*302/768, white, 1.30, "default-bold", "center", "center", false)
    if not isMouseIn(sx*305/1024, sy*506/768, sx*200/1024, sy*45/768) then dxDrawRectangle(sx*305/1024, sy*506/768, sx*200/1024, sy*45/768, tocolor(247, 148, 0, 170), false)
    else dxDrawRectangle(sx*305/1024, sy*506/768, sx*200/1024, sy*45/768, tocolor(220, 100, 0, 100), false) end
    if not isMouseIn(sx*535/1024, sy*506/768, sx*200/1024, sy*45/768) then dxDrawRectangle(sx*535/1024, sy*506/768, sx*200/1024, sy*45/768, tocolor(247, 148, 0, 170), false)
    else dxDrawRectangle(sx*535/1024, sy*506/768, sx*200/1024, sy*45/768, tocolor(220, 100, 0, 100), false) end
    dxDrawText("Zaloguj si? na serwer", sx*685/1024, sy*1015/768, sx*130/1024, sy*45/768, white, 1.00, "default-bold", "center", "center", false)
    dxDrawText("Zarejestruj si?", sx*1140/1024, sy*1013/768, sx*130/1024, sy*45/768, white, 1.00, "default-bold", "center", "center", false)
    dxDrawImage(sx * 0.4618, sy * 0.2013, sx * 0.0938, sy * 0.1549, "logo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    --dxDrawImage(sw/2-295,sh/2+70,594,307,"logo.png", angle, 0, -120 )
    local x,y=getPointFromDistanceRotation(2313.58, 1282.80, dist, angler)
    setCameraMatrix(x,y,107.72+0.9,2323.69, 1285.66, 107.72+0.9)
    angler=(angler+0.1)
end





addEventHandler("onClientClick", root, function(btn,state)
    if btn=="left" and state=="down" then
        if isMouseIn(sx*305/1024, sy*506/768, sx*200/1024, sy*45/768) 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(sx*535/1024, sy*506/768, sx*200/1024, sy*45/768) and data.showed then
            local login=guiGetText(data.button[1])
            local pass=guiGetText(data.button[2])
            if string.len(login) > 22 or string.len(pass) > 22 and string.len(login) < 3 or string.len(pass) < 3 then
                data.info="Login/Has?o musz? mie? mniej ni? od 3 do 22 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.40, 0.40, 0.22, 0.04, "", true)
    data.button[2]=guiCreateEdit(0.40, 0.53, 0.22, 0.04, "", true)   
    guiEditSetMasked(data.button[2],true)
end)


A hud:


--[[
Autor kodu: Wercio.
Wykonane dla GTAO.PL
Zakaz zmiany autora!
]]

local sw,sh = guiGetScreenSize()
foNte3 = dxCreateFont("tf.ttf",20) or "defaul-bold"
foNte2 = dxCreateFont("tff.ttf",17) or "defaul-bold"
foNte1 = dxCreateFont("tff.ttf",26) or "defaul-bold"

addEventHandler("onClientRender", root, function()
if not getElementData(player:logged) then return end
    if isPlayerMapVisible() then return end
    
    showPlayerHudComponent("clock", false)
    showPlayerHudComponent("health", false)
    showPlayerHudComponent("money", false)
    showPlayerHudComponent("armour", false)
    showPlayerHudComponent("weapon", false)
    showPlayerHudComponent("ammo", false)
    showPlayerHudComponent("wanted",false)
    showPlayerHudComponent("breath",false)
    
    function roundedRectangle(x, y, w, h, color)
    dxDrawRectangle(x, y, w, h, color, false)
    dxDrawRectangle(x + 2, y - 1, w - 4, 1, color, false)
    dxDrawRectangle(x + 2, y + h, w - 4, 1, color, false)
    dxDrawRectangle(x - 1, y + 2, 1, h - 4, color, false)
    dxDrawRectangle(x + w, y + 2, 1, h - 4, color, false)
end
    
     local nick = getPlayerName(getLocalPlayer()):gsub("#%x%x%x%x%x%x","")
     local timehour, timeminute = getTime()
     local money = getPlayerMoney(localPlayer)
     local ping = getPlayerPing(localPlayer)
    
     roundedRectangle(sw* 0.7562, sh* 0.0189, sw* 0.2299, sh* 0.1789, tocolor(0, 0, 0, 180), false)
     roundedRectangle(sw* 0.7562, sh* 0.0078, sw* 0.2299, sh* 0.0544, tocolor(32, 155, 0, 255), false)
     dxDrawText(""..nick.."", sw * 0.7556, sh * 0.0040, sw * 0.9861, sh * 0.0522, tocolor(255, 255, 255, 255), 1.25, foNte3, "center", "top", false, false, false, false, false)
     dxDrawText(""..timehour..":"..timeminute.."", sw * 0.7556, sh * 0.0650, sw * 0.9812, sh * 0.2133, tocolor(255, 255, 255, 255), 1.00, foNte2, "center", "top", false, false, false, false, false)
     dxDrawText("PLN "..money.."", sw * 0.7556, sh * 0.1100, sw * 0.9812, sh * 0.2133, tocolor(255, 255, 255, 255), 0.65, foNte1, "center", "top", false, false, false, false, false)
     dxDrawText("Ping "..ping.."", sw * 0.7556, sh * 0.1550, sw * 0.9812, sh * 0.2133, tocolor(255, 255, 255, 255), 1.00, foNte2, "center", "top", false, false, false, false, false)
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-12-04, 17:18


Wilq







Wiek: 24
Na forum: 4570 dni
Posty: 3409

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

@darecky02 - Twoja linijka jest z?a, radz? poczyta? zanim spr?bujesz pomaga?:

Więcej informacji znajdziesz w Wikipedii MTA:

getElementData




W kodzie od HUDu powy?sz? linijk?
if not getElementData(player:logged) then return end

popraw na:

if not getElementData(localPlayer, "player:logged") then return end


Po zalogowaniu upewnij si?, ?e ustawiasz poni?sz? elementDat? na warto?? TRUE.
setElementData(zmiennagracza, "player:logged", true)

(ustawianie prawdopodobnie b?dzie po stronie servera)

Finalnie kod hudu powinien wygl?d?? tak:

--[[
Autor kodu: Wercio.
Wykonane dla GTAO.PL
Zakaz zmiany autora!
]]

local sw,sh = guiGetScreenSize()
foNte3 = dxCreateFont("tf.ttf",20) or "defaul-bold"
foNte2 = dxCreateFont("tff.ttf",17) or "defaul-bold"
foNte1 = dxCreateFont("tff.ttf",26) or "defaul-bold"

addEventHandler("onClientRender", root, function()
if not getElementData(localPlayer, "player:logged") then return end
    if isPlayerMapVisible() then return end
    
    showPlayerHudComponent("clock", false)
    showPlayerHudComponent("health", false)
    showPlayerHudComponent("money", false)
    showPlayerHudComponent("armour", false)
    showPlayerHudComponent("weapon", false)
    showPlayerHudComponent("ammo", false)
    showPlayerHudComponent("wanted",false)
    showPlayerHudComponent("breath",false)
    
    function roundedRectangle(x, y, w, h, color)
    dxDrawRectangle(x, y, w, h, color, false)
    dxDrawRectangle(x + 2, y - 1, w - 4, 1, color, false)
    dxDrawRectangle(x + 2, y + h, w - 4, 1, color, false)
    dxDrawRectangle(x - 1, y + 2, 1, h - 4, color, false)
    dxDrawRectangle(x + w, y + 2, 1, h - 4, color, false)
end
    
     local nick = getPlayerName(getLocalPlayer()):gsub("#%x%x%x%x%x%x","")
     local timehour, timeminute = getTime()
     local money = getPlayerMoney(localPlayer)
     local ping = getPlayerPing(localPlayer)
    
     roundedRectangle(sw* 0.7562, sh* 0.0189, sw* 0.2299, sh* 0.1789, tocolor(0, 0, 0, 180), false)
     roundedRectangle(sw* 0.7562, sh* 0.0078, sw* 0.2299, sh* 0.0544, tocolor(32, 155, 0, 255), false)
     dxDrawText(""..nick.."", sw * 0.7556, sh * 0.0040, sw * 0.9861, sh * 0.0522, tocolor(255, 255, 255, 255), 1.25, foNte3, "center", "top", false, false, false, false, false)
     dxDrawText(""..timehour..":"..timeminute.."", sw * 0.7556, sh * 0.0650, sw * 0.9812, sh * 0.2133, tocolor(255, 255, 255, 255), 1.00, foNte2, "center", "top", false, false, false, false, false)
     dxDrawText("PLN "..money.."", sw * 0.7556, sh * 0.1100, sw * 0.9812, sh * 0.2133, tocolor(255, 255, 255, 255), 0.65, foNte1, "center", "top", false, false, false, false, false)
     dxDrawText("Ping "..ping.."", sw * 0.7556, sh * 0.1550, sw * 0.9812, sh * 0.2133, tocolor(255, 255, 255, 255), 1.00, foNte2, "center", "top", false, false, false, false, false)
end)


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Kulegg
Wysłany: 2018-12-04, 17:47


Kulegg







Wiek: 46
Na forum: 3266 dni
Posty: 283

Piwa: 20

Respekt: 50

Dzia?a ! Bardzo dzi?kuje, oraz za pomoc daj? piwko i respekt ! :)

Postaw piwo autorowi tego posta
 

 
Tagi: hud :: neta :: pokazuje :: się :: panelu :: logowania
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