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

Wysłany: 2019-07-14, 18:02


Pyrek24







Wiek: 25
Na forum: 3438 dni
Posty: 546
Nick w MP: Pyrek

Piwa: 10

Respekt: 50

Witam ot?? mam kod na scorboarda. Chcia?bym by id sortowa?o si? pokolei 1,2,3,4,5,6,7,8,9,10... itd.
kod
--[[
    AutorAsperek
    Zakaz u?ywania bez zgody autora!
    Zakaz udost?pniania bez zgody autora!
]]

--[[
Wszelkie prawa odkupione przez STOPseba!
]]--


local screenWscreenH guiGetScreenSize()
local dxfont0_CaviarDreams_Bold dxCreateFont(":guied/fonts/CaviarDreams_Bold.ttf"30)
local dxfont1_CaviarDreams_Bold dxCreateFont(":guied/fonts/CaviarDreams_Bold.ttf"16)
local dxfont2_CaviarDreams_Bold dxCreateFont(":guied/fonts/CaviarDreams_Bold.ttf"14)
local dxfont3_CaviarDreams_Bold dxCreateFont(":guied/fonts/CaviarDreams_Bold.ttf"11)
local px,sy guiGetScreenSize()
local px,py = (screenW/1920),(screenH/1080)
local zoom 1
local fh 1920
if px fh then
 zoom math.min(2,fh/px)
end

-- tego nie ruszaj
local k 1
local n 19

local score false

local font dxCreateFont("font.ttf"13) or "default-bold"

local ping = {}

local logo false -- wylaczanie/wlaczanie loga w scoreboardzie

function dxDrawShadowText(text,x,y,w,h,color,size,font,x1,x2)
    
end

addEventHandler("onClientRender"root, function()
    score getKeyState("tab")
    local gracze getElementsByType("player")
    if score ~= true then return end
    -- werjsa z logiem
    if logo == true then
        dxDrawRectangle(screenW 0.3068screenH 0.0370screenW 0.3943screenH 0.8583tocolor(919192100), false)    
        --dxDrawImage(screenW 0.3729screenH 0.2194screenW 0.2562screenH 0.09"logo.png"000tocolor(255255255255), false)
    else -- wersja bez loga
        dxDrawRectangle(screenW 0.3068screenH 0.0370screenW 0.3943screenH 0.8583tocolor(000200), false)    
    end
    local x 0
    for i,v in ipairs(gracze) do
        if >= and <= n then 
            x x+1
            if not ping[vthen
                ping[v] = {}
                ping[v]["ms"] = getPlayerPing(v)
                ping[v]["time"] = getTickCount()
            elseif getTickCount()-ping[v]["time"] > 1500 then
                ping[v]["ms"] = getPlayerPing(v)
                ping[v]["time"] = getTickCount()
            end
            local id getElementData(v"id")
            local uid getElementData(v"player:uid")
            local org getElementData(v"player:organization")
            local frakcja getElementData(v,"player:duty")
            local offsetY = (screenH*0.03600)*(x-1)
            local isPremium=getElementData(v"player:premium")
        dxDrawLine((screenW 0.3068) - 1, (screenH 0.0370) - 1, (screenW 0.3068) - 1screenH 0.8954tocolor(2552000255), 1false)
        dxDrawLine(screenW 0.7010, (screenH 0.0370) - 1, (screenW 0.3068) - 1, (screenH 0.0370) - 1tocolor(2552000255), 1false)
        dxDrawLine((screenW 0.3068) - 1screenH 0.8954screenW 0.7010screenH 0.8954tocolor(2552000255), 1false)
        dxDrawLine(screenW 0.7010screenH 0.8954screenW 0.7010, (screenH 0.0370) - 1tocolor(2552000255), 1false)

        
        dxDrawText("MoveRPG", (screenW 0.3052) - 1, (screenH 0.0343) - 1, (screenW 0.5349) - 1, (screenH 0.1370) - 1tocolor(25521675254), 1.00*pxdxfont0_CaviarDreams_Bold"center""center"falsefalsefalsefalsefalse)
        dxDrawText("MoveRPG", (screenW 0.3052) + 1, (screenH 0.0343) - 1, (screenW 0.5349) + 1, (screenH 0.1370) - 1tocolor(25521675254), 1.00*pxdxfont0_CaviarDreams_Bold"center""center"falsefalsefalsefalsefalse)
        dxDrawText("MoveRPG", (screenW 0.3052) - 1, (screenH 0.0343) + 1, (screenW 0.5349) - 1, (screenH 0.1370) + 1tocolor(25521675254), 1.00*pxdxfont0_CaviarDreams_Bold"center""center"falsefalsefalsefalsefalse)
        dxDrawText("MoveRPG", (screenW 0.3052) + 1, (screenH 0.0343) + 1, (screenW 0.5349) + 1, (screenH 0.1370) + 1tocolor(25521675254), 1.00*pxdxfont0_CaviarDreams_Bold"center""center"falsefalsefalsefalsefalse)
        dxDrawText("MoveRPG"screenW 0.3052screenH 0.0343screenW 0.5349screenH 0.1370tocolor(110254), 1.00*pxdxfont0_CaviarDreams_Bold"center""center"falsefalsefalsefalsefalse)
        dxDrawText("Graczy online:\n"..tostring(#gracze).."/295 !", screenW * 0.5359, screenH * 0.0389, screenW * 0.7010, screenH * 0.1370, tocolor(255, 255, 255, 255), 1.00*px, dxfont1_CaviarDreams_Bold, "center", "center", false, false, false, false, false)
        dxDrawText("RID"screenW 0.3073screenH 0.1398screenW 0.3276screenH 0.8954tocolor(255255255255), 1.00*pxdxfont2_CaviarDreams_Bold"center""top"falsefalsefalsefalsefalse)
        dxDrawText("ID"screenW 0.3297screenH 0.1398screenW 0.3500screenH 0.8954tocolor(255255255255), 1.00*pxdxfont2_CaviarDreams_Bold"center""top"falsefalsefalsefalsefalse)
        dxDrawText("Nick"screenW 0.3500screenH 0.1398screenW 0.4484screenH 0.8954tocolor(255255255255), 1.00*pxdxfont2_CaviarDreams_Bold"center""top"falsefalsefalsefalsefalse)
        dxDrawText("S?u?ba"screenW 0.4484screenH 0.1398screenW 0.5078screenH 0.8954tocolor(255255255255), 1.00*pxdxfont2_CaviarDreams_Bold"center""top"falsefalsefalsefalsefalse)
        dxDrawText("Organizacja"screenW 0.5078screenH 0.1398screenW 0.6083screenH 0.8954tocolor(255255255255), 1.00*pxdxfont2_CaviarDreams_Bold"center""top"falsefalsefalsefalsefalse)
        dxDrawText("Gang"screenW 0.6083screenH 0.1398screenW 0.6500screenH 0.8954tocolor(255255255255), 1.00*pxdxfont2_CaviarDreams_Bold"center""top"falsefalsefalsefalsefalse)
        dxDrawText("PING"screenW 0.6500screenH 0.1398screenW 0.7010screenH 0.8954tocolor(255255255255), 1.00*pxdxfont2_CaviarDreams_Bold"center""top"falsefalsefalsefalsefalse)

        dxDrawText(getElementData(v"player:uid") or "---"screenW 0.3073screenH 0.1630+offsetYscreenW 0.3276screenH 0.8954+offsetYtocolor(255255255255), 1.00*pxdxfont3_CaviarDreams_Bold"center""top"falsefalsefalsefalsefalse)
        dxDrawText(getElementData(v"id") or "---"screenW 0.3297screenH 0.1630+offsetYscreenW 0.3500screenH 0.8954+offsetYtocolor(255255255255), 1.00*pxdxfont3_CaviarDreams_Bold"center""top"falsefalsefalsefalsefalse)
        dxDrawText(getPlayerName(v), screenW 0.3500screenH 0.1630+offsetYscreenW 0.4484screenH 0.8954+offsetYtocolor(255255255255), 1.00*pxdxfont3_CaviarDreams_Bold"center""top"falsefalsefalsetruetrue)
        dxDrawText(getElementData(v"player:duty") or "---"screenW 0.4484screenH 0.1630+offsetYscreenW 0.5078screenH 0.8954+offsetYtocolor(255255255255), 1.00*pxdxfont3_CaviarDreams_Bold"center""top"falsefalsefalsefalsefalse)
        dxDrawText(getElementData(v"player:organization") or "---"screenW 0.5078screenH 0.1630+offsetYscreenW 0.6083screenH 0.8954+offsetYtocolor(255255255255), 1.00*pxdxfont3_CaviarDreams_Bold"center""top"falsefalsefalsefalsefalse)
        dxDrawText(getElementData(v"player:gang") or "---"screenW 0.6083screenH 0.1630+offsetYscreenW 0.6500screenH 0.8954+offsetYtocolor(255255255255), 1.00*pxdxfont3_CaviarDreams_Bold"center""top"falsefalsefalsefalsefalse)
        dxDrawText(getPlayerPing(v), screenW 0.6500screenH 0.1630+offsetYscreenW 0.7010screenH 0.8954+offsetYtocolor(255255255255), 1.00*pxdxfont3_CaviarDreams_Bold"center""top"falsefalsefalsefalsefalse)            
        end
    end
end)

bindKey("mouse_wheel_down""both", function()
    if score ~= true then return end
    scrollUp()
end)

bindKey("mouse_wheel_up""both", function()
    if score ~= true then return end
    scrollDown()
end)

function openScoreboard()
    if score == true then
        score false
    else
        score true
    end
end

function scrollDown()
    if == 19 then return end
    k k-1
    n n-1
end

function scrollUp()
    if #getElementsByType("player") then return end
    k+1
    n n+1
end

function roundedRectangle(xywhcolor)

end



Podpis
amta
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-07-16, 09:21


Hemoglobina

Tylko Hema






Wiek: 29
Na forum: 3397 dni
Posty: 89
Nick w MP: Answer

Piwa: 1386

Respekt: 90


table.sort(gracze, function(ab) return b end)


Musisz to zmodyfikowa? tak, ?eby sortowa?o po ID.

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Pyrek24
Wysłany: 2019-07-16, 16:14


DylemaT929

Nikt






Wiek: 28
Na forum: 4041 dni
Posty: 333
Nick w MP: dylemat929

Piwa: 3195

Respekt: 165,8
Respekt: 165,8Respekt: 165,8

Masz podmie? .


--[[
    AutorAsperek
    Zakaz u?ywania bez zgody autora!
    Zakaz udost?pniania bez zgody autora!
]]

--[[
Wszelkie prawa odkupione przez STOPseba!
]]--


local screenWscreenH guiGetScreenSize()
local dxfont0_CaviarDreams_Bold dxCreateFont(":guied/fonts/CaviarDreams_Bold.ttf"30)
local dxfont1_CaviarDreams_Bold dxCreateFont(":guied/fonts/CaviarDreams_Bold.ttf"16)
local dxfont2_CaviarDreams_Bold dxCreateFont(":guied/fonts/CaviarDreams_Bold.ttf"14)
local dxfont3_CaviarDreams_Bold dxCreateFont(":guied/fonts/CaviarDreams_Bold.ttf"11)
local px,sy guiGetScreenSize()
local px,py = (screenW/1920),(screenH/1080)
local zoom 1
local fh 1920
if px fh then
 zoom math.min(2,fh/px)
end

-- tego nie ruszaj
local k 1
local n 19

local score false

local font dxCreateFont("font.ttf"13) or "default-bold"

local ping = {}

local logo false -- wylaczanie/wlaczanie loga w scoreboardzie

function dxDrawShadowText(text,x,y,w,h,color,size,font,x1,x2)
    
end

function sort(parametr1parametr2)
    if isElement(parametr1) and isElement(parametr2then
        return (getElementData(parametr1"id") or 0) < (getElementData(parametr2"id") or 0)
    end
end

addEventHandler("onClientRender"root, function()
    score getKeyState("tab")
    local gracze getElementsByType("player")
table.sort(graczesort)
    if score ~= true then return end
    -- werjsa z logiem
    if logo == true then
        dxDrawRectangle(screenW 0.3068screenH 0.0370screenW 0.3943screenH 0.8583tocolor(919192100), false)    
        --dxDrawImage(screenW 0.3729screenH 0.2194screenW 0.2562screenH 0.09"logo.png"000tocolor(255255255255), false)
    else -- wersja bez loga
        dxDrawRectangle(screenW 0.3068screenH 0.0370screenW 0.3943screenH 0.8583tocolor(000200), false)    
    end
    local x 0
    for i,v in ipairs(gracze) do
        if >= and <= n then 
            x x+1
            if not ping[vthen
                ping[v] = {}
                ping[v]["ms"] = getPlayerPing(v)
                ping[v]["time"] = getTickCount()
            elseif getTickCount()-ping[v]["time"] > 1500 then
                ping[v]["ms"] = getPlayerPing(v)
                ping[v]["time"] = getTickCount()
            end
            local id getElementData(v"id")
            local uid getElementData(v"player:uid")
            local org getElementData(v"player:organization")
            local frakcja getElementData(v,"player:duty")
            local offsetY = (screenH*0.03600)*(x-1)
            local isPremium=getElementData(v"player:premium")
        dxDrawLine((screenW 0.3068) - 1, (screenH 0.0370) - 1, (screenW 0.3068) - 1screenH 0.8954tocolor(2552000255), 1false)
        dxDrawLine(screenW 0.7010, (screenH 0.0370) - 1, (screenW 0.3068) - 1, (screenH 0.0370) - 1tocolor(2552000255), 1false)
        dxDrawLine((screenW 0.3068) - 1screenH 0.8954screenW 0.7010screenH 0.8954tocolor(2552000255), 1false)
        dxDrawLine(screenW 0.7010screenH 0.8954screenW 0.7010, (screenH 0.0370) - 1tocolor(2552000255), 1false)

        
        dxDrawText("MoveRPG", (screenW 0.3052) - 1, (screenH 0.0343) - 1, (screenW 0.5349) - 1, (screenH 0.1370) - 1tocolor(25521675254), 1.00*pxdxfont0_CaviarDreams_Bold"center""center"falsefalsefalsefalsefalse)
        dxDrawText("MoveRPG", (screenW 0.3052) + 1, (screenH 0.0343) - 1, (screenW 0.5349) + 1, (screenH 0.1370) - 1tocolor(25521675254), 1.00*pxdxfont0_CaviarDreams_Bold"center""center"falsefalsefalsefalsefalse)
        dxDrawText("MoveRPG", (screenW 0.3052) - 1, (screenH 0.0343) + 1, (screenW 0.5349) - 1, (screenH 0.1370) + 1tocolor(25521675254), 1.00*pxdxfont0_CaviarDreams_Bold"center""center"falsefalsefalsefalsefalse)
        dxDrawText("MoveRPG", (screenW 0.3052) + 1, (screenH 0.0343) + 1, (screenW 0.5349) + 1, (screenH 0.1370) + 1tocolor(25521675254), 1.00*pxdxfont0_CaviarDreams_Bold"center""center"falsefalsefalsefalsefalse)
        dxDrawText("MoveRPG"screenW 0.3052screenH 0.0343screenW 0.5349screenH 0.1370tocolor(110254), 1.00*pxdxfont0_CaviarDreams_Bold"center""center"falsefalsefalsefalsefalse)
        dxDrawText("Graczy online:\n"..tostring(#gracze).."/295 !", screenW * 0.5359, screenH * 0.0389, screenW * 0.7010, screenH * 0.1370, tocolor(255, 255, 255, 255), 1.00*px, dxfont1_CaviarDreams_Bold, "center", "center", false, false, false, false, false)
        dxDrawText("RID"screenW 0.3073screenH 0.1398screenW 0.3276screenH 0.8954tocolor(255255255255), 1.00*pxdxfont2_CaviarDreams_Bold"center""top"falsefalsefalsefalsefalse)
        dxDrawText("ID"screenW 0.3297screenH 0.1398screenW 0.3500screenH 0.8954tocolor(255255255255), 1.00*pxdxfont2_CaviarDreams_Bold"center""top"falsefalsefalsefalsefalse)
        dxDrawText("Nick"screenW 0.3500screenH 0.1398screenW 0.4484screenH 0.8954tocolor(255255255255), 1.00*pxdxfont2_CaviarDreams_Bold"center""top"falsefalsefalsefalsefalse)
        dxDrawText("S?u?ba"screenW 0.4484screenH 0.1398screenW 0.5078screenH 0.8954tocolor(255255255255), 1.00*pxdxfont2_CaviarDreams_Bold"center""top"falsefalsefalsefalsefalse)
        dxDrawText("Organizacja"screenW 0.5078screenH 0.1398screenW 0.6083screenH 0.8954tocolor(255255255255), 1.00*pxdxfont2_CaviarDreams_Bold"center""top"falsefalsefalsefalsefalse)
        dxDrawText("Gang"screenW 0.6083screenH 0.1398screenW 0.6500screenH 0.8954tocolor(255255255255), 1.00*pxdxfont2_CaviarDreams_Bold"center""top"falsefalsefalsefalsefalse)
        dxDrawText("PING"screenW 0.6500screenH 0.1398screenW 0.7010screenH 0.8954tocolor(255255255255), 1.00*pxdxfont2_CaviarDreams_Bold"center""top"falsefalsefalsefalsefalse)

        dxDrawText(getElementData(v"player:uid") or "---"screenW 0.3073screenH 0.1630+offsetYscreenW 0.3276screenH 0.8954+offsetYtocolor(255255255255), 1.00*pxdxfont3_CaviarDreams_Bold"center""top"falsefalsefalsefalsefalse)
        dxDrawText(getElementData(v"id") or "---"screenW 0.3297screenH 0.1630+offsetYscreenW 0.3500screenH 0.8954+offsetYtocolor(255255255255), 1.00*pxdxfont3_CaviarDreams_Bold"center""top"falsefalsefalsefalsefalse)
        dxDrawText(getPlayerName(v), screenW 0.3500screenH 0.1630+offsetYscreenW 0.4484screenH 0.8954+offsetYtocolor(255255255255), 1.00*pxdxfont3_CaviarDreams_Bold"center""top"falsefalsefalsetruetrue)
        dxDrawText(getElementData(v"player:duty") or "---"screenW 0.4484screenH 0.1630+offsetYscreenW 0.5078screenH 0.8954+offsetYtocolor(255255255255), 1.00*pxdxfont3_CaviarDreams_Bold"center""top"falsefalsefalsefalsefalse)
        dxDrawText(getElementData(v"player:organization") or "---"screenW 0.5078screenH 0.1630+offsetYscreenW 0.6083screenH 0.8954+offsetYtocolor(255255255255), 1.00*pxdxfont3_CaviarDreams_Bold"center""top"falsefalsefalsefalsefalse)
        dxDrawText(getElementData(v"player:gang") or "---"screenW 0.6083screenH 0.1630+offsetYscreenW 0.6500screenH 0.8954+offsetYtocolor(255255255255), 1.00*pxdxfont3_CaviarDreams_Bold"center""top"falsefalsefalsefalsefalse)
        dxDrawText(getPlayerPing(v), screenW 0.6500screenH 0.1630+offsetYscreenW 0.7010screenH 0.8954+offsetYtocolor(255255255255), 1.00*pxdxfont3_CaviarDreams_Bold"center""top"falsefalsefalsefalsefalse)            
        end
    end
end)

bindKey("mouse_wheel_down""both", function()
    if score ~= true then return end
    scrollUp()
end)

bindKey("mouse_wheel_up""both", function()
    if score ~= true then return end
    scrollDown()
end)

function openScoreboard()
    if score == true then
        score false
    else
        score true
    end
end

function scrollDown()
    if == 19 then return end
    k k-1
    n n-1
end

function scrollUp()
    if #getElementsByType("player") then return end
    k+1
    n n+1
end

function roundedRectangle(xywhcolor)

end


zresetuj i zobacz :)

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Pyrek24
Tagi: sortowanie :: tabie
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