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: 3125 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 koduWercio.
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(xywhcolor)
    dxDrawRectangle(xywhcolorfalse)
    dxDrawRectangle(2141colorfalse)
    dxDrawRectangle(2h41colorfalse)
    dxDrawRectangle(1214colorfalse)
    dxDrawRectangle(w214colorfalse)
end
    
     local nick getPlayerName(getLocalPlayer()):gsub("#%x%x%x%x%x%x","")
     local timehourtimeminute getTime()
     local money getPlayerMoney(localPlayer)
     local ping getPlayerPing(localPlayer)
    
     roundedRectangle(sw0.7562sh0.0189sw0.2299sh0.1789tocolor(000180), false)
     roundedRectangle(sw0.7562sh0.0078sw0.2299sh0.0544tocolor(321550255), false)
     dxDrawText(""..nick..""sw 0.7556sh 0.0040sw 0.9861sh 0.0522tocolor(255255255255), 1.25foNte3"center""top"falsefalsefalsefalsefalse)
     dxDrawText(""..timehour..":"..timeminute..""sw 0.7556sh 0.0650sw 0.9812sh 0.2133tocolor(255255255255), 1.00foNte2"center""top"falsefalsefalsefalsefalse)
     dxDrawText("PLN "..money..""sw 0.7556sh 0.1100sw 0.9812sh 0.2133tocolor(255255255255), 0.65foNte1"center""top"falsefalsefalsefalsefalse)
     dxDrawText("Ping "..ping..""sw 0.7556sh 0.1550sw 0.9812sh 0.2133tocolor(255255255255), 1.00foNte2"center""top"falsefalsefalsefalsefalse)
end)


Postaw piwo autorowi tego posta
 

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


Query

SyndicateMTA






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

Piwa: 5257

Respekt: 141
Respekt: 141

dodaj po eventHandlerze
if not getElementData(player:loggedthen return end


Podpis
Postaw piwo autorowi tego posta
 

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


Kulegg







Wiek: 46
Na forum: 3125 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: 3071 dni
Posty: 319
Nick w MP: Query

Piwa: 5257

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: 3125 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 screenWidthscreenHeight guiGetScreenSize()


local blurStrength 20


local myScreenSource dxCreateScreenSource(screenWidthscreenHeight)
blurShaderblurTec dxCreateShader("shaders/BlurShader.fx")


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

        dxDrawImage(00screenWidthscreenHeightblurShader)
    end
end
addEventHandler("onClientRender"rootrenderblur)

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

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

local sx,sy=guiGetScreenSize()
local data={ showed=nilbutton={}, info=nilmisc=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(xydistangler)
    local a math.rad(90 angler)
    local dx math.cos(a) * dist;
    local dy math.sin(a) * dist;
    return x+dxy+dy;
end

function renderLoginBox()
    blur true
    --dxDrawImage(0019201080"misc/drift.png"AristatesYuvarlak00tocolor(255255255255), false)
    dxDrawRectangle(sx*270/1025sy*150/769sx*500/1025sy*458/767tocolor(000135), false)
    --dxDrawImage(0019201080"misc/drift.png"AristatesYuvarlak00tocolor(255255255255), false)
    if data.info then dxDrawText(data.infosx*252/1024sy*272/768sx*800/1024sy*255/768tocolor(23700255), 1.00"default""center""center"falseend
    --dxDrawLine(sx*0/1024sy*199/768sx*1022/1024sy*200/768tocolor(31111193255), 5false)
    --dxDrawLine(sx*0/1024sy*509/768sx*1022/1024sy*510/768tocolor(31111193255), 5false)
    dxDrawText("Nick U?ytkownika"sx*280/1024sy*270/768sx*760/1024sy*302/768white1.30"default-bold""center""center"false)
    dxDrawText("Has?o U?ytkownika"sx*-240/1024sy*480/768sx*1280/1024sy*302/768white1.30"default-bold""center""center"false)
    if not isMouseIn(sx*305/1024sy*506/768sx*200/1024sy*45/768then dxDrawRectangle(sx*305/1024sy*506/768sx*200/1024sy*45/768tocolor(2471480170), false)
    else dxDrawRectangle(sx*305/1024sy*506/768sx*200/1024sy*45/768tocolor(2201000100), falseend
    if not isMouseIn(sx*535/1024sy*506/768sx*200/1024sy*45/768then dxDrawRectangle(sx*535/1024sy*506/768sx*200/1024sy*45/768tocolor(2471480170), false)
    else dxDrawRectangle(sx*535/1024sy*506/768sx*200/1024sy*45/768tocolor(2201000100), falseend
    dxDrawText("Zaloguj si? na serwer"sx*685/1024sy*1015/768sx*130/1024sy*45/768white1.00"default-bold""center""center"false)
    dxDrawText("Zarejestruj si?"sx*1140/1024sy*1013/768sx*130/1024sy*45/768white1.00"default-bold""center""center"false)
    dxDrawImage(sx 0.4618sy 0.2013sx 0.0938sy 0.1549"logo.png"000tocolor(255255255255), false)
    --dxDrawImage(sw/2-295,sh/2+70,594,307,"logo.png"angle0, -120 )
    local x,y=getPointFromDistanceRotation(2313.581282.80distangler)
    setCameraMatrix(x,y,107.72+0.9,2323.691285.66107.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/1024sy*506/768sx*200/1024sy*45/768) and data.showed then
            local login=guiGetText(data.button[1])
            local pass=guiGetText(data.button[2])
            if string.len(login) < or string.len(pass) < 2 then
                data.info="Wype?nij wszystkie pola!"
                return
            end
            triggerServerEvent("logging:checkAccount"resourceRootloginpass)
        end
        if isMouseIn(sx*535/1024sy*506/768sx*200/1024sy*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) < 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"resourceRootloginpass)
        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"rootrenderLoginBox)
    else
        data.info=tostring(info)
        setTimer(function() data.info=nil end30001)
    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.misc1.0)
    showPlayerHudComponent("all",false)
    guiSetInputMode("no_binds_when_editing")
    setElementData(localPlayer,"status","Loguje si?")
    --setElementData(localPlayer,"player:logged",false)
    addEventHandler("onClientRender"rootrenderLoginBox)
    data.button[1]=guiCreateEdit(0.400.400.220.04""true)
    data.button[2]=guiCreateEdit(0.400.530.220.04""true)   
    guiEditSetMasked(data.button[2],true)
end)


A hud:


--[[
Autor koduWercio.
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:loggedthen 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(xywhcolor)
    dxDrawRectangle(xywhcolorfalse)
    dxDrawRectangle(2141colorfalse)
    dxDrawRectangle(2h41colorfalse)
    dxDrawRectangle(1214colorfalse)
    dxDrawRectangle(w214colorfalse)
end
    
     local nick getPlayerName(getLocalPlayer()):gsub("#%x%x%x%x%x%x","")
     local timehourtimeminute getTime()
     local money getPlayerMoney(localPlayer)
     local ping getPlayerPing(localPlayer)
    
     roundedRectangle(sw0.7562sh0.0189sw0.2299sh0.1789tocolor(000180), false)
     roundedRectangle(sw0.7562sh0.0078sw0.2299sh0.0544tocolor(321550255), false)
     dxDrawText(""..nick..""sw 0.7556sh 0.0040sw 0.9861sh 0.0522tocolor(255255255255), 1.25foNte3"center""top"falsefalsefalsefalsefalse)
     dxDrawText(""..timehour..":"..timeminute..""sw 0.7556sh 0.0650sw 0.9812sh 0.2133tocolor(255255255255), 1.00foNte2"center""top"falsefalsefalsefalsefalse)
     dxDrawText("PLN "..money..""sw 0.7556sh 0.1100sw 0.9812sh 0.2133tocolor(255255255255), 0.65foNte1"center""top"falsefalsefalsefalsefalse)
     dxDrawText("Ping "..ping..""sw 0.7556sh 0.1550sw 0.9812sh 0.2133tocolor(255255255255), 1.00foNte2"center""top"falsefalsefalsefalsefalse)
end)


Postaw piwo autorowi tego posta
 

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


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

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:loggedthen 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 koduWercio.
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(xywhcolor)
    dxDrawRectangle(xywhcolorfalse)
    dxDrawRectangle(2141colorfalse)
    dxDrawRectangle(2h41colorfalse)
    dxDrawRectangle(1214colorfalse)
    dxDrawRectangle(w214colorfalse)
end
    
     local nick getPlayerName(getLocalPlayer()):gsub("#%x%x%x%x%x%x","")
     local timehourtimeminute getTime()
     local money getPlayerMoney(localPlayer)
     local ping getPlayerPing(localPlayer)
    
     roundedRectangle(sw0.7562sh0.0189sw0.2299sh0.1789tocolor(000180), false)
     roundedRectangle(sw0.7562sh0.0078sw0.2299sh0.0544tocolor(321550255), false)
     dxDrawText(""..nick..""sw 0.7556sh 0.0040sw 0.9861sh 0.0522tocolor(255255255255), 1.25foNte3"center""top"falsefalsefalsefalsefalse)
     dxDrawText(""..timehour..":"..timeminute..""sw 0.7556sh 0.0650sw 0.9812sh 0.2133tocolor(255255255255), 1.00foNte2"center""top"falsefalsefalsefalsefalse)
     dxDrawText("PLN "..money..""sw 0.7556sh 0.1100sw 0.9812sh 0.2133tocolor(255255255255), 0.65foNte1"center""top"falsefalsefalsefalsefalse)
     dxDrawText("Ping "..ping..""sw 0.7556sh 0.1550sw 0.9812sh 0.2133tocolor(255255255255), 1.00foNte2"center""top"falsefalsefalsefalsefalse)
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: 3125 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