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

Wysłany: 2018-03-07, 23:22


Yami

Mapper / Uczeń LUA






Wiek: 25
Na forum: 3059 dni
Posty: 379

Piwa: 97

Respekt: 235
Respekt: 235Respekt: 235

Siemka
Bo mam ma?y problem, ot?? posiadam hud i gdy wchodz? na serwer to gdy ju? wejde na niego ale nawet si? jeszcze nie zaloguje to wida? hud z pieni?dzmi itd.
I st?d pytanie, czy da sie zrobi? ?e dopiero po zalogowaniu by sie pokazywa?, i je?li tak to jak?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-03-08, 00:53


.RiV







Wiek: 25
Na forum: 3588 dni
Posty: 554
Nick w MP: Split

Piwa: 2596

Respekt: 597,8
Respekt: 597,8

Przy otwieraniu panelu logowania ustaw graczowi warto??

setElementData(localPlayer"loguje_sie"true)


Przy zamykaniu panelu logowania usu? graczowi warto??

setElementData(localPlayer"loguje_sie"false)


Przy renderingu hud'u wstaw warunek

if getElementData(localPlayer"loguje_sie"then return nil end


Podpis

Autor OGRPG, na scenie MTA od 2012 roku.




Użytkownik: 08.08.2016
GTAO Member: 06.02.2017
Support-Team: 17.06.2017 & 01.06.2019 - 18.11.2019
Moderator: 14.01.2018 - 09.08.2018

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-03-08, 17:00


Yami

Mapper / Uczeń LUA






Wiek: 25
Na forum: 3059 dni
Posty: 379

Piwa: 97

Respekt: 235
Respekt: 235Respekt: 235

A gdzie to dok?adnie doda??
S-Side

function findPlayer(plr,cel)
    local target=nil
    if (tonumber(cel) ~= nilthen
        target=getElementByID("p"..cel)
    else -- podano fragment nicku
        for _,thePlayer in ipairs(getElementsByType("player")) do
            if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x"""), cel:lower(), 1truethen
                if (targetthen
                    outputChatBox("Znaleziono wiecej niz jednego gracza o pasujacym nicku, podaj wiecej liter."plr)
                    return nil
                end
                target=thePlayer
            end
        end
    end
    return target
end

local function findFreeValue(tablica_id)
    table.sort(tablica_id)
    local wolne_id=0
    for i,v in ipairs(tablica_id) do
        if (v==wolne_idthen wolne_id=wolne_id+1 end
        if (v>wolne_idthen return wolne_id end
    end
    return wolne_id
end

function assignPlayerID(plr)
    local gracze=getElementsByType("player")
    local tablica_id = {}
    for i,v in ipairs(gracze) do
        local lid=getElementData(v"id")
        if (lidthen
            table.insert(tablica_idtonumber(lid))
        end
    end
    local free_id=findFreeValue(tablica_id)
    
    setElementData(plr,"id"free_id)
    setElementID(plr"p" .. free_id)
    return free_id
end

function getPlayerID(plr)
    if not plr then return "" end
    local id=getElementData(plr,"id")
    if (idthen
        return id
    else
        return assignPlayerID(plr)
    end
    
end

addEventHandler ("onPlayerJoin"getRootElement(), function()
    assignPlayerID(source)
end)


C-Side

local fontm dxCreateFont("font.otf"16)

--SKALOWANIE GUI--
local screenWscreenH guiGetScreenSize()
local w= (screenW/1920), (screenH/1080)

local ranga "brak"
--------------------------------------------
addEventHandler("onClientRender"root, function()
    setPlayerHudComponentVisible("all"false)
    local hp math.floor(getElementHealth(localPlayer))
    local nickname =  getPlayerName(localPlayer)
    local money getPlayerMoney(localPlayer)
    dxDrawImage(1600*w50*h301*w130*h"images/bg.png"000tocolor(255255255255), false)
    dxDrawText(nickname.."[#00fff2"..getElementData(localPlayer"id").."#FFFFFF]"3500*w60*h00tocolor(255255255255), 1fontm'center''top'falsefalsefalsetrue)
    dxDrawText(hp.."%"1830*w103*h00tocolor(255255255255), 0.8fontm'left''top'falsefalsefalsetrue)
    dxDrawText(money.."$"1660*w103*h00tocolor(255255255255), 0.8fontm'left''top'falsefalsefalsetrue)    
    if getElementData(localPlayer"rank") == 1 then
        ranga "#FFFFFFGracz"
    end
    if getElementData(localPlayer"rank") == 2 then
        ranga "#40ff23Moderator"
    end
    dxDrawText(ranga3490*w150*h00tocolor(255255255255), 0.8fontm'center''top'falsefalsefalsetrue)
end)



Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-03-08, 17:42


jagoreq







Wiek: 24
Na forum: 3221 dni
Posty: 221
Nick w MP: dwd

Piwa: 18

Respekt: 66,3

Ostrzeżeń: 20%
local fontm dxCreateFont("font.otf"16)

--SKALOWANIE GUI--
local screenWscreenH guiGetScreenSize()
local w= (screenW/1920), (screenH/1080)

local ranga "brak"
--------------------------------------------
addEventHandler("onClientRender"root, function()
    if getElementData(localPlayer"p:logged") == true then
        setPlayerHudComponentVisible("all"false)
        local hp math.floor(getElementHealth(localPlayer))
        local nickname =  getPlayerName(localPlayer)
        local money getPlayerMoney(localPlayer)
        dxDrawImage(1600*w50*h301*w130*h"images/bg.png"000tocolor(255255255255), false)
        dxDrawText(nickname.."[#00fff2"..getElementData(localPlayer"id").."#FFFFFF]"3500*w60*h00tocolor(255255255255), 1fontm'center''top'falsefalsefalsetrue)
        dxDrawText(hp.."%"1830*w103*h00tocolor(255255255255), 0.8fontm'left''top'falsefalsefalsetrue)
        dxDrawText(money.."$"1660*w103*h00tocolor(255255255255), 0.8fontm'left''top'falsefalsefalsetrue)    
        if getElementData(localPlayer"rank") == 1 then
            ranga "#FFFFFFGracz"
        end
        if getElementData(localPlayer"rank") == 2 then
            ranga "#40ff23Moderator"
        end
        dxDrawText(ranga3490*w150*h00tocolor(255255255255), 0.8fontm'center''top'falsefalsefalsetrue)
    end
end)


teraz jak masz edate p:logged na true to widzisz hud, a jak na false to nie widzisz hudu.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-03-08, 17:44


Hiroszekk







Wiek: 24
Na forum: 3312 dni
Posty: 113
Nick w MP: Hiroszek

Piwa: 845

Respekt: -84,3

Ostrzeżeń: 20%
Je?eli korzystasz z OG to kod poni?ej powinien poprawi?, doda?em
    if not getElementData(localPlayer,"player:logged"then return end

ElementData "player:logged" dodaje si? w og po zalogowaniu.


local fontm dxCreateFont("font.otf"16)

--SKALOWANIE GUI--
local screenWscreenH guiGetScreenSize()
local w= (screenW/1920), (screenH/1080)

local ranga "brak"
--------------------------------------------
addEventHandler("onClientRender"root, function()
    if not getElementData(localPlayer,"player:logged"then return end
    setPlayerHudComponentVisible("all"false)
    local hp math.floor(getElementHealth(localPlayer))
    local nickname =  getPlayerName(localPlayer)
    local money getPlayerMoney(localPlayer)
    dxDrawImage(1600*w50*h301*w130*h"images/bg.png"000tocolor(255255255255), false)
    dxDrawText(nickname.."[#00fff2"..getElementData(localPlayer"id").."#FFFFFF]"3500*w60*h00tocolor(255255255255), 1fontm'center''top'falsefalsefalsetrue)
    dxDrawText(hp.."%"1830*w103*h00tocolor(255255255255), 0.8fontm'left''top'falsefalsefalsetrue)
    dxDrawText(money.."$"1660*w103*h00tocolor(255255255255), 0.8fontm'left''top'falsefalsefalsetrue)    
    if getElementData(localPlayer"rank") == 1 then
        ranga "#FFFFFFGracz"
    end
    if getElementData(localPlayer"rank") == 2 then
        ranga "#40ff23Moderator"
    end
    dxDrawText(ranga3490*w150*h00tocolor(255255255255), 0.8fontm'center''top'falsefalsefalsetrue)
end)


Je?eli nie korzystasz z og nadawaj dla gracza po zalogowaniu element date "player:logged".

Postaw piwo autorowi tego posta
 

 
Tagi: widocznośc :: huda
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