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

Wysłany: 2018-02-11, 11:44


Kuksss

guwno






Wiek: 22
Na forum: 3781 dni
Posty: 102
Nick w MP: guwnp

Piwa: 732

Respekt: 70,5

Ostrzeżeń: 100%
Siema, robi? skrypt na scoreboard, ale nie wiem jak zrobi?, ?eby nick,pid,organizacja itd. by?y pod sob?.
Wszystko nachodzi na siebie i wygl?da(przy 2 graczach online) tak:



Kod:


screenWscreenH guiGetScreenSize()

SCOREBOARD_UPDATE_INTERVAL 250 -- co ile ma sie odswiezac  
SCOREBOARD_SCROLL_VALUE -- co ile graczy scrollowascoreboard 
SCOREBOARD_MAX_ROWS 15 -- ile maksymalnie widocznych graczy na raz 
SCOREBOARD_BG_COLOR tocolor(21140200) -- kolor t?a 
SCOREBOARD_CLEAR_INTERVAL=20000
local baseX 4096 -- by zmniejszyscoreboard zwi?ksz twarto?? i vice versa
local zoom 1 
local minZoom 2.2
if screenW baseX then
    zoom math.min(minZoombaseX/screenW)
end 

testczciona dxCreateFont("fonts/font-bold.ttf"math.floor(20/zoom), false"antialiased") or "default"


local scoreboardWidth math.floor(1600/zoom)
local scoreboardHeight math.floor(170/zoom) -- minimalna wysoko??
local scoreboardRowHeight math.floor(60/zoom) -- wysoko?? jednego pola
local scoreboardColumns = {
    -- nazwa kolumny z tablicy getPlayerScoreboardDatad?ugo?? kolumny
    {"id"0.075}, 
    {"uid"0.09},
    {"nick"0.28}, 
    {"rp"0.09}, 
    {"organizacja"0.29}, 
    {"duty"0.1}, 
    {"ping"0.08},
}

local sx,sy guiGetScreenSize() -- pobieramy rozdzielczo?? gracza kt?ry widzi gui
local px,py = (sx/1366),(sy/768) -- dzielimy rozdzielczo?? gracza kt?ry widzi gui przez rozdzielczo?? na kt?rej by?o robione gui.

local logoWlogoH math.floor((500/zoom)*0.6), math.floor((140/zoom)*0.6)
    
local showing false 
local scoreboardData =  {}

local selectedRow 1 
local visibleRows SCOREBOARD_MAX_ROWS

function renderScoreboard()
    local fontHeightfontBoldHeight dxGetFontHeight(1"clear"), dxGetFontHeight(1"clear")
    -- tlo
    local xywscreenW/2-scoreboardWidth/2screenH/2-scoreboardHeight/2-(math.min(#scoreboardData, SCOREBOARD_MAX_ROWS)*scoreboardRowHeight)/2, scoreboardWidth, scoreboardHeight+(math.min(#scoreboardData, SCOREBOARD_MAX_ROWS)*scoreboardRowHeight)
        
        exports.blur:dxDrawBluredRectangle(xywhtocolor(255255255255))
        
    dxDrawImage(0*px0*py1366*px768*py"img/tab.png")
    
    --dxDrawImage(x+math.floor(20/zoom), ylogoWlogoH"img/logo.png"000tocolor(255255255255), true)
    
    dxDrawText("Graczy online: "..tostring(#scoreboardData), 915*px, 94*py, 1028*px, 110*py, tocolor(255, 255, 255, 255), 1.10*py, testczciona, "left", "top", false, false, false, false, false)
    
    -- kolumny
    local offsetX math.floor(25/zoom) -- dla kolumn
    local columnY y+math.floor(75/zoom)
    local columnH fontBoldHeight+2
    exports.blur:dxDrawBluredRectangle(xcolumnYwcolumnHtocolor(125125125255))
    
    for kv in ipairs(scoreboardColumns) do
        dxDrawText(string.upper(v[1]), 423432432432432432432432432432432432432423324324234+math.floor(offsetX)+1columnY+143242343232234x+4324234324324234324324324324324324324324324324324*4324324324-3424324-432432+4324324234tocolor(000243), 1"default-bold""left""center"falsefalsetrue)
        offsetX offsetX v[2]
    end 
    
    -- gracze 
    local offsetY 0
    for kv in ipairs(scoreboardData) do
        if >= selectedRow and <= visibleRows then 
            local offsetX math.floor(25/zoom) -- dla kolumn
            
            y offsetY+columnY+columnH+1
            h scoreboardRowHeight
            
            if == 1 then 
                exports.blur:dxDrawBluredRectangle(xywhtocolor(6073108255), true)
            else 
                exports.blur:dxDrawBluredRectangle(xywhtocolor(405388255), true)
            end

            for icolumn in ipairs(scoreboardColumns) do
                local data scoreboardData[k][column[1]]
                if column[1] == "nick" then -- dodajemy avatar w nicku
                    --dxDrawImage(x+math.floor(offsetX), y+4/2h-4h-4"img/avekm.png"000tocolor(255255255255), true)
                    if v.isPremium and not v.ranga == true then
                        dxDrawText(tostring(data):gsub("#%x%x%x%x%x%x",""), 495*px151*py549*px167*pytocolor(21917852), 1.10*pytestczciona"left""top"falsefalsefalsefalsefalse)
                    elseif v.ranga == 1 then
                        dxDrawText(tostring(data):gsub("#%x%x%x%x%x%x",""), 495*px151*py549*px167*pytocolor(6419280), 1.10*pytestczciona"left""top"falsefalsefalsefalsefalse)
                    elseif v.ranga == 2 then
                        dxDrawText(tostring(data):gsub("#%x%x%x%x%x%x",""), 495*px151*py549*px167*pytocolor(01280), 1.10*pytestczciona"left""top"falsefalsefalsefalsefalse)
                    elseif v.ranga == 3 then
                        dxDrawText(tostring(data):gsub("#%x%x%x%x%x%x",""), 495*px151*py549*px167*pytocolor(25500), 1.10*pytestczciona"left""top"falsefalsefalsefalsefalse)
                    else
                        dxDrawText(tostring(data):gsub("#%x%x%x%x%x%x",""), 495*px151*py549*px167*pytocolor(243243243243), 1.10*pytestczciona"left""top"falsefalsefalsefalsefalse)
                    end
                else 
                    dxDrawText(tostring(data), 326+math.floor(offsetX), 150380166+htocolor(255255255255), 1.00testczciona"left""top"falsefalsefalsefalsefalse)
                end 
                
                offsetX offsetX column[2]
            end 
    
            offsetY offsetY+scoreboardRowHeight+1
        end
    end
end

function scrollScoreboard(keystate)
    if key == "mouse_wheel_up" then 
        if selectedRow <= 1 then return end
        selectedRow math.max(1selectedRow-SCOREBOARD_SCROLL_VALUE)
        visibleRows math.max(SCOREBOARD_MAX_ROWSvisibleRows-SCOREBOARD_SCROLL_VALUE)
        
    elseif key == "mouse_wheel_down" then 
        if visibleRows >= #scoreboardData then return end
        selectedRow selectedRow+SCOREBOARD_SCROLL_VALUE
        visibleRows visibleRows+SCOREBOARD_SCROLL_VALUE
        
        if visibleRows #scoreboardData then 
            local diff visibleRows-#scoreboardData
            selectedRow selectedRow-diff
            visibleRows visibleRows-diff
        end
    end
end 

setTimer(function()
    new_awatary={}
    for i,v in ipairs(getElementsByType("player"))do
        if(awatary[v])then
            new_awatary[v]=awatary[v]
        end
    end
    awatary=new_awatary
end,SCOREBOARD_CLEAR_INTERVAL,0)

awatary={}
local function getPlayerScoreboardData(player)
    awatar=nil
    awatar=getElementData(player,"awatar")
    if(awatar and not awatary[player])then
        awatary[player]=dxCreateTexture(awatar,"dxt1")
    end
    return {
        id=getElementData(player"id") or "---",
        uid=getElementData(player"player:uid") or "---",
        nick=getPlayerName(player),
        rp=getElementData(player"player:reputation") or "---",
        organizacja=getElementData(player"player:organization") or "---",
        duty=getElementData(player"player:duty") or "---",
        ping=getPlayerPing(player),
        isPremium=getElementData(player"player:premium"),
        ranga=getElementData(player"player:level"),
        awatar=(awatary[player] or "img/avatar.png")
    }
end

function refreshScoreboardData()
    scoreboardData = {}
    for kv in ipairs(getElementsByType("player")) do
        if ~= localPlayer then
            table.insert(scoreboardDatagetPlayerScoreboardData(v))
        end
    end
    
    table.sort(scoreboardData, function(ab)
        return a.id b.id
    end)

    table.insert(scoreboardData1getPlayerScoreboardData(localPlayer))
end 

function showScoreboard()
    if getElementData(localPlayer,"player:uid"then
        showing not showing
        if showing then 
            --font dxCreateFont("fonts/font-normal.ttf"math.floor(20/zoom), false"antialiased") or "default"
            -- = dxCreateFont("fonts/font-bold.ttf"math.floor(22/zoom), false"antialiased") or "default-bold"
            
            refreshTimer setTimer(refreshScoreboardDataSCOREBOARD_UPDATE_INTERVAL0)
            addEventHandler("onClientRender"rootrenderScoreboard)
            addEventHandler("onClientKey"rootscrollScoreboard)
        else 
            if isElement(fontthen 
                destroyElement(font)
            end 
            
            if isElement("clear"then 
                destroyElement("clear")
            end
            
            if isTimer(refreshTimerthen 
                killTimer(refreshTimer)
            end
            
            removeEventHandler("onClientRender"rootrenderScoreboard)
            removeEventHandler("onClientKey"rootscrollScoreboard)
        end
    else
        outputChatBox("Zaloguj si?!")
    end
end 
bindKey("tab""both"showScoreboard)
if getPlayerName(localPlayer) == "mkJ" then
bindKey("9""both"showScoreboard)
end


Dzi?kuj?, gdyby kto? to zrobi?, postawi? :piwo: !

Podpis
c***
Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 19 piw(a):
Janusz., BMWZiomek, koj155, sebastianf10, Kimi2002PL, Bolek123456789, Wilku8618, MrSmutasek, Batonikk, Adamosol, KochaS, manymodz, Kamilo_Kamilo12, Kamilekko, Elo13, Amator, !hejcob, Mihal1520, tiger18
Wysłany: 2018-02-11, 15:21


Ciastuuś

Truck soon...






Wiek: 26
Na forum: 3071 dni
Posty: 799
Nick w MP: Ciastuuś

Piwa: 4297

Respekt: 640
Respekt: 640Respekt: 640

Musisz zmieni? odpowiednio pozycje dodawanych kolejnych kolumn ( czyt. graczy ) kt?rzy pojawiaj? si? na li??ie

Podpis
Truck soon...
Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Maniek122
Tagi: tab :: panel(scoreboard)
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Tab panel(scoreboard) 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