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

Wysłany: 2018-02-09, 17:38


AppleSir

Majster LUA






Wiek: 27
Na forum: 3046 dni
Posty: 19
Nick w MP: Przybysz



Respekt: 45,3

Witam mam problem z scoreboardem. Chcia?bym aby S?u?ba By?a na grupy acl np. ?e jestem w acl SAPD i chc? aby pisa?o w S?u?bie SAPD.

jak co? S?u?ba to Duty



serdeczne dzi?ki :piwo:

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-02-09, 17:39


Nexisten

Moderator






Wiek: 22
Na forum: 4107 dni
Posty: 551
Nick w MP: Nexisten

Piwa: 1479

Respekt: 287,3
Respekt: 287,3Respekt: 287,3Respekt: 287,3

Podaj ca?y kod odpowiadaj?cy za wy?wietlanie scoreboard, najlepiej w znacznikach [lua.]

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-02-09, 17:41


AppleSir

Majster LUA






Wiek: 27
Na forum: 3046 dni
Posty: 19
Nick w MP: Przybysz



Respekt: 45,3

local scoreFunc = {}
local screenWscreenH guiGetScreenSize()
local gracze "?"
scoreFunc.page 1

scoreFunc.onPage 20

scoreFunc.renderData = {screenW 0.2723screenH 0.1497screenW 0.4561screenH 0.7005}

function scoreFunc.sort(op1op2)
    if isElement(op1) and isElement(op2then
        return getElementData(op1"id") < getElementData(op2"id")
    end
end

local czcionka "default-bold"
local czcionka2 "default-bold"
local id "id"
local dbid "dbid"
local repka "rp"
local organizacja "Organizacja"
local duty "faction"

function scoreFunc.render()
    local allPlayers = {}
    for kv in ipairs(getElementsByType("player")) do
        if ~= localPlayer then
            table.insert(allPlayersv)
        end
    end
    table.sort(allPlayersscoreFunc.sort)
    local _allPlayers allPlayers
    allPlayers = {}
    table.insert(allPlayerslocalPlayer)
    for 1#_allPlayers do
        allPlayers[1] = _allPlayers[i]
    end
    _allPlayers nil

    local i 1
    gracze #allPlayers
    dxDrawRectangle(scoreFunc.renderData[1], scoreFunc.renderData[2], scoreFunc.renderData[3], scoreFunc.renderData[4]-30tocolor(000150), false)
    dxDrawRectangle(screenW 0.2892screenH 0.2279screenW 0.4180screenH 0.0430tocolor(2575125155), false)
    for kv in ipairs(allPlayers) do
        if >= (scoreFunc.page 1) * scoreFunc.onPage and scoreFunc.page scoreFunc.onPage then
            local ping getPlayerPing(v)
            local rggetPlayerNametagColor(v)
            dxDrawText((getElementData(vid) or "0"), screenW 0.3100screenH 0.2813 + (1) * 20screenW 0.3175screenH 0.3177 + (1) * 20tocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
            dxDrawText((getElementData(vdbid) or " "), screenW 0.3655screenH 0.2813 + (1) * 20screenW 0.3650screenH 0.3177 + (1) * 20tocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
            dxDrawText(getPlayerName(v), screenW 0.4490screenH 0.2813 + (1) * 20screenW 0.4495screenH 0.3177 + (1) * 20tocolor(rgb255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
            dxDrawText((getElementData(vrepka) or " "), screenW 0.5200screenH 0.2813 + (1) * 20screenW 0.5200screenH 0.3177 + (1) * 20tocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
            dxDrawText((getElementData(vorganizacja) or " "), screenW 0.5700screenH 0.2813 + (1) * 20screenW 0.5700screenH 0.3177 + (1) * 20tocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
            dxDrawText((getElementData(vduty) or " "), screenW 0.6300screenH 0.2813 + (1) * 20screenW 0.6300screenH 0.3177 + (1) * 20tocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
            dxDrawText(pingscreenW 0.6815screenH 0.2813 + (1) * 20screenW 0.6838screenH 0.3177 + (1) * 20tocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
            1
        end
    end
    dxDrawText("Forum serwera: new-mode.pl", (screenW 0.2892) + 1, (screenH 0.1628) + 1, (screenW 0.4400) + 1, (screenH 0.2148) + 1tocolor(000255), 1.00czcionka2"left""center"falsefalsefalsefalsefalse)
    dxDrawText("Forum serwera: new-mode.pl"screenW 0.2892screenH 0.1628screenW 0.4400screenH 0.2148tocolor(255255255255), 1.00czcionka2"left""center"falsefalsefalsefalsefalse)
    dxDrawText("Graczy online: "..#allPlayers, (screenW * 0.5461) + 1, (screenH * 0.1615) + 1, (screenW * 0.6991) + 1, (screenH * 0.2148) + 1, tocolor(0, 0, 0, 255), 1.00, czcionka2, "right", "center", false, false, false, false, false)
    dxDrawText("Graczy online: "..#allPlayers, screenW * 0.5461, screenH * 0.1615, screenW * 0.6991, screenH * 0.2148, tocolor(255, 255, 255, 255), 1.00, czcionka2, "right", "center", false, false, false, false, false)
    dxDrawText("ID", (screenW 0.2899) + 1, (screenH 0.2292) + 1, (screenW 0.3411) + 1, (screenH 0.2721) + 1tocolor(000255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
    dxDrawText("ID"screenW 0.2899screenH 0.2292screenW 0.3411screenH 0.2721tocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
    dxDrawText("DBID", (screenW 0.3655) + 1, (screenH 0.2292) + 1, (screenW 0.3650) + 1, (screenH 0.2721) + 1tocolor(000255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
    dxDrawText("DBID"screenW 0.3655screenH 0.2292screenW 0.3650screenH 0.271tocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
    dxDrawText("Nazwa u?ytkownika", (screenW 0.4527) + 1, (screenH 0.2292) + 1, (screenW 0.4545) + 1, (screenH 0.2721) + 1tocolor(000255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
    dxDrawText("Nazwa u?ytkownika"screenW 0.4527screenH 0.2292screenW 0.4545screenH 0.2721tocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
    dxDrawText("mP", (screenW 0.5200) + 1, (screenH 0.2292) + 1, (screenW 0.5200) + 1, (screenH 0.2721) + 1tocolor(000255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
    dxDrawText("mP"screenW 0.5200screenH 0.2292screenW 0.5200screenH 0.2721tocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
    dxDrawText("Organizacja", (screenW 0.5700) + 1, (screenH 0.2292) + 1, (screenW 0.5700) + 1, (screenH 0.2721) + 1tocolor(000255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
    dxDrawText("Organizacja"screenW 0.5700screenH 0.2292screenW 0.5700screenH 0.2721tocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
    dxDrawText("S?u?ba", (screenW 0.6300) + 1, (screenH 0.2292) + 1, (screenW 0.6300) + 1, (screenH 0.2721) + 1tocolor(000255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
    dxDrawText("S?u?ba"screenW 0.6300screenH 0.2292screenW 0.6300screenH 0.2721tocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
    dxDrawText("Ping"screenW 0.6654 1screenH 0.2292 1screenW 0.7064 1screenH 0.2721 1tocolor(000255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
    dxDrawText("Ping"screenW 0.6654screenH 0.2292screenW 0.7064screenH 0.2721tocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsefalsefalse)
end

function scoreFunc.bindKey(keystate)
    if state == "down" then
        addEventHandler("onClientRender"rootscoreFunc.render)
    else
        removeEventHandler("onClientRender"rootscoreFunc.render)
    end    
end
bindKey("TAB""both"scoreFunc.bindKey)

bindKey("mouse_wheel_down""down", function()
    local max math.floor(gracze scoreFunc.onPage)+1
    if max == scoreFunc.page then return end
    scoreFunc.page scoreFunc.page 1
end)

bindKey("mouse_wheel_up""down", function()
    if scoreFunc.page == 1 then return end
    scoreFunc.page scoreFunc.page 1
end)


[ Dodano: 2018-02-09, 19:06 ]
vNeXxuS, masz tu

Komentarz .WhiteBlue dodany 2018-02-10, 21:45Stosuj znaczniki [lua] zamiast [code] do kodów LUA.
Ostatnio zmieniony przez .RiV 2018-02-10, 21:45, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-02-09, 19:26


Ciastuuś

Truck soon...






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

Piwa: 4297

Respekt: 640
Respekt: 640Respekt: 640

Wytestuj,


function nazwaRangi (player)
if( getElementType(player) == "player" then
account getAccountName getPlayerAccount player ) )
if (isObjectInACLGroup ("user."..account,aclGetGroup ("NAZWA RANGI")) )then
rangaTabela "NAZWA RANGI"
elseif (isObjectInACLGroup ("user."..account,aclGetGroup ("NAZWA RANGI")) )then
rangaTabela "NAZWA RANGI"
elseif (isObjectInACLGroup ("user."..account,aclGetGroup ("NAZWA RANGI")) )then
rangaTabela "NAZWA RANGI"
elseif (isObjectInACLGroup ("user."..account,aclGetGroup ("NAZWA RANGI")) )then
rangaTabela "NAZWA RANGI"
end
else
error("B??d: jeden gracz musi by? argumentem")
end
return rangaTabela
end


Podpis
Truck soon...
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-02-09, 19:33


AppleSir

Majster LUA






Wiek: 27
Na forum: 3046 dni
Posty: 19
Nick w MP: Przybysz



Respekt: 45,3

Ciastuu?, mi chodzi o to : ze pod S?u?ba pisze ranga z Acl

Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-02-09, 20:02


Kalizman







Wiek: 23
Na forum: 3651 dni
Posty: 1394

Piwa: 4619

Respekt: 358,8
Respekt: 358,8Respekt: 358,8Respekt: 358,8Respekt: 358,8

No to zamiast zmiennej rangaTabela, u?yj setElementData. Ca?a filozofia...

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-02-09, 20:04


Ciastuuś

Truck soon...






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

Piwa: 4297

Respekt: 640
Respekt: 640Respekt: 640

Chcia?bym tylko doda?, ?e gotowc?w nie dajemy, cho? czasami daje, ale to znowu z czystej ?wiadomo?ci tego, ?e komu? pomog?. R?wnie dobrze da?em teraz gotowca nie do ko?ca, ale znowu liczysz na kogo? kto Ci zrobi ca?y kod. To na prawd? nie jest trudne, a Kalizman, dobrze wyt?umaczy? Ci co masz zrobi?, a wi?c do dzie?a. Gdy Ci nie wyjdzie u?ycie setElementData podaj b??dy oraz kod z zawart? funkcj?.

Podpis
Truck soon...
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-02-09, 20:50


AppleSir

Majster LUA






Wiek: 27
Na forum: 3046 dni
Posty: 19
Nick w MP: Przybysz



Respekt: 45,3

Ciastuu?, dalej nie rozumiem... Dasz tego gotowca. Jestem Zielony w lua dopiero sie ucze.

Podpis
Postaw piwo autorowi tego posta
 

 
Tagi: scoreboardem :: acl
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