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

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


ASIEK







Wiek: 30
Na forum: 2841 dni
Posty: 13

Piwa: 394

Respekt: 40

Ostrzeżeń: 60%
Wi?c tak problem polega na braku kolor?w w ScoreBoardzie ... dodawa?em ka?d? mo?liw? funkcj? local r , g ,b getPlayerNameTag ( theplayer ) i z bia?ego koloru w tabeli robi si? czarny kolor a tu w?a?nie chodzi o to aby kolory Administracji pobiera? ten scoreboard [ RCON ] Czerwony itd.

Podaj? kod , skryptu :
Kod:


local screenW, screenH = guiGetScreenSize()
local sx, sy = guiGetScreenSize()
local w, h=(sx/1680), (sy/1050)

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 tabulator = false
local czcionka = dxCreateFont("f.ttf", 13*w)
local czcionka2 = dxCreateFont("f.ttf", 18*w)


local k = 1
local n = 13
local m = 13

if not czcionka then
czcionka = "default"
end

local zakladki = {
id = "ID",
name = "Nazwa",
reputation = "RP",
organization = "Organizacja",
uid = "UID",
ping = "Ping",
faction = "Frakcja",
}

local ss = 1
local tabulator=false
local ping = {}


function sort(op1, op2)
if isElement(op1) and isElement(op2) then
return getElementData(op1, "id") < getElementData(op2, "id")
end
end

function gui()
local players = {}
for i,v in ipairs(getElementsByType("player")) do
table.insert(players, v)
end
table.sort(players, sort)
if getElementData(localPlayer, "player:logged") then

dxDrawImage(530*w, 307*h, 612*w, 490*h, "bg.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawImage(675*w, 195*h, 300*w, 125*h, "logo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)

dxDrawText(zakladki.id, 540*w, 336*h, 589*w, 360*h, tocolor(255, 255, 255, 255), 1.00, czcionka, "center", "center", false, false, false, false, false)
dxDrawText(zakladki.name, 632*w, 336*h, 681*w, 360*h, tocolor(255, 255, 255, 255), 1.00, czcionka, "center", "center", false, false, false, false, false)
dxDrawText(zakladki.uid, 724*w, 336*h, 773*w, 360*h, tocolor(255, 255, 255, 255), 1.00, czcionka, "center", "center", false, false, false, false, false)
dxDrawText(zakladki.reputation, 790*w, 336*h, 839*w, 360*h, tocolor(255, 255, 255, 255), 1.00, czcionka, "center", "center", false, false, false, false, false)
dxDrawText(zakladki.organization, 878*w, 336*h, 927*w, 360*h, tocolor(255, 255, 255, 255), 1.00, czcionka, "center", "center", false, false, false, false, false)
dxDrawText(zakladki.faction, 982*w, 336*h, 1031*w, 360*h, tocolor(255, 255, 255, 255), 1.00, czcionka, "center", "center", false, false, false, false, false)
dxDrawText(zakladki.ping, 1072*w, 336*h, 1121*w, 360*h, tocolor(255, 255, 255, 255), 1.00, czcionka, "center", "center", false, false, false, false, false)



dxDrawText(" "..tostring(#players).."/20", 535*w, 767*h, 1138*w, 787*h, tocolor(255, 255, 255, 255), 1.00*w, czcionka, "center", "center", false, false, false, false, false)
local x=0
for i,v in pairs(players) do
if i >= k and i <= n then
x=x+1
offsetY = (screenW/73)*(i)
local offsetY = (30*h)*(x-1)
local offsetY2 = (60*h)*(x-1)
local id = getElementData(v, "id") or "-"
local name = getPlayerName(v) or "error"
local reputation = getElementData(v, "player:reputation") or 0
local uid = getElementData(v, "player:uid") or "-"
local faction=getElementData(v,"player:faction") or "-"
local organization = getElementData(v, "player:organization") or "-"


if not(ping[v]) then
ping[v] = {}
ping[v].text = getPlayerPing(v)
ping[v].time = getTickCount()
elseif getTickCount( )-ping[v].time > 1500 then
ping[v].text = getPlayerPing(v)
ping[v].time = getTickCount()
end

local r,g,b = getPlayerNametagColor(v)


if isMouseIn(540*w, 371*h+offsetY, 588*w, 33*h) then
dxDrawImage(540*w, 371*h+offsetY, 588*w, 33*h, "bghover.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
else
dxDrawImage(540*w, 371*h+offsetY, 588*w, 33*h, "tabel.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
end



dxDrawText(id, 540*w, 376*h+offsetY2, 589*w, 400*h, tocolor(255, 255, 255, 255), 1.00, czcionka, "center", "center", false, false, false, true, false)
dxDrawText(name, 632*w, 376*h+offsetY2, 681*w, 400*h, tocolor(r,g,b, 255), 1.00, czcionka, "center", "center", false, false, false, true, false)
dxDrawText(uid, 724*w, 376*h+offsetY2, 773*w, 400*h, tocolor(255, 255, 255, 255), 1.00, czcionka, "center", "center", false, false, false, true, false)
dxDrawText(reputation, 790*w, 376*h+offsetY2, 839*w, 400*h, tocolor(255, 255, 255, 255), 1.00, czcionka, "center", "center", false, false, false, true, false)
dxDrawText(organization, 878*w, 376*h+offsetY2, 927*w, 400*h, tocolor(255, 255, 255, 255), 1.00, czcionka, "center", "center", false, false, false, true, false)
dxDrawText(faction, 982*w, 376*h+offsetY2, 1031*w, 400*h, tocolor(255, 255, 255, 255), 1.00, czcionka, "center", "center", false, false, false, true, false)
dxDrawText(ping[v].text, 1072*w, 376*h+offsetY2, 1121*w, 400*h, tocolor(255, 255, 255, 255), 1.00, czcionka, "center", "center", false, false, false, true, false)

end
end
end
end

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

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


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

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

bindKey("mouse2", "down", function()
if tabulator == false then return end
if isCursorShowing() == false then
showCursor(true)
else
showCursor(false)
end
end)

bindKey("TAB", "both", function()
if not getElementData(localPlayer,"player:logged") then return end
if tabulator == false then
tabulator = true
addEventHandler("onClientRender", root, gui)
else
tabulator = false
removeEventHandler("onClientRender", root, gui)
end
end)



SS : https://imgur.com/a/5RiOzl1

Chc? po prostu aby scoreboard pobiera? kolory administracji z nametag?w.[/code]

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-09-22, 02:16


DylemaT929

Nikt






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

Piwa: 3195

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

Podmie? i zobacz

local screenWscreenH guiGetScreenSize() 
local sxsy guiGetScreenSize() 
local wh=(sx/1680), (sy/1050) 

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 tabulator false 
local czcionka dxCreateFont("f.ttf"13*wlocal czcionka2 dxCreateFont("f.ttf"18*wlocal k 1 
local n 13 
local m 13 

if not czcionka then 
czcionka "default" 
end 

local zakladki = { 
id "ID"name "Nazwa"reputation "RP"organization "Organizacja"uid "UID"ping "Ping"faction "Frakcja", 
} 

local ss 1 
local tabulator=false 
local ping = {} 


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

function gui() 
local players = {} 
for i,v in ipairs(getElementsByType("player")) do 
table.insert(playersvend 
table.sort(playerssort) 
if getElementData(localPlayer"player:logged"then 

dxDrawImage(530*w307*h612*w490*h"bg.png"000tocolor(255255255255), falsedxDrawImage(675*w195*h300*w125*h"logo.png"000tocolor(255255255255), falsedxDrawText(zakladki.id540*w336*h589*w360*htocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsefalsefalsedxDrawText(zakladki.name632*w336*h681*w360*htocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsetruefalsedxDrawText(zakladki.uid724*w336*h773*w360*htocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsefalsefalsedxDrawText(zakladki.reputation790*w336*h839*w360*htocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsefalsefalsedxDrawText(zakladki.organization878*w336*h927*w360*htocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsefalsefalsedxDrawText(zakladki.faction982*w336*h1031*w360*htocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsefalsefalsedxDrawText(zakladki.ping1072*w336*h1121*w360*htocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsefalsefalsedxDrawText(" "..tostring(#players).."/20", 535*w, 767*h, 1138*w, 787*h, tocolor(255, 255, 255, 255), 1.00*w, czcionka, "center", "center", false, false, false, false, false)    
local x=0    
for i,v in pairs(players) do 
if >= and <= n then 
x=x+1 
offsetY = (screenW/73)*(ilocal offsetY = (30*h)*(x-1local offsetY2 = (60*h)*(x-1local id getElementData(v"id") or "-" 
local name getPlayerName(v) or "error" 
local reputation getElementData(v"player:reputation") or 0 
local uid getElementData(v"player:uid") or "-" 
local faction=getElementData(v,"player:faction") or "-" 
local organization getElementData(v"player:organization") or "-" 


if not(ping[v]) then 
ping[v] = {} 
ping[v].text getPlayerPing(vping[v].time getTickCount() 
elseif getTickCount( )-ping[v].time 1500 then 
ping[v].text getPlayerPing(vping[v].time getTickCount() 
end 

local r,g,getPlayerNametagColor(v) 


if isMouseIn(540*w371*h+offsetY588*w33*hthen 
dxDrawImage(540*w371*h+offsetY588*w33*h"bghover.png"000tocolor(255255255255), false) 
else 
dxDrawImage(540*w371*h+offsetY588*w33*h"tabel.png"000tocolor(255255255255), falseend 



dxDrawText(id540*w376*h+offsetY2589*w400*htocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsetruefalsedxDrawText(name632*w376*h+offsetY2681*w400*htocolor(r,g,b255), 1.00czcionka"center""center"falsefalsefalsetruefalsedxDrawText(uid724*w376*h+offsetY2773*w400*htocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsetruefalsedxDrawText(reputation790*w376*h+offsetY2839*w400*htocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsetruefalsedxDrawText(organization878*w376*h+offsetY2927*w400*htocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsetruefalsedxDrawText(faction982*w376*h+offsetY21031*w400*htocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsetruefalsedxDrawText(ping[v].text1072*w376*h+offsetY21121*w400*htocolor(255255255255), 1.00czcionka"center""center"falsefalsefalsetruefalseend 
end 
end 
end 

bindKey("mouse_wheel_down""both", function() 
if tabulator ~= true then return end 
scrollUp() 
endbindKey("mouse_wheel_up""both", function() 
if tabulator ~= true then return end 
scrollDown() 
end) 


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

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

bindKey("mouse2""down", function() 
if tabulator == false then return end 
if isCursorShowing() == false then 
showCursor(true) 
else    
showCursor(falseend 
endbindKey("TAB""both", function() 
if not getElementData(localPlayer,"player:logged"then return end 
if tabulator == false then 
tabulator true 
addEventHandler("onClientRender"rootgui) 
else 
tabulator false 
removeEventHandler("onClientRender"rootguiend 
end)


Postaw piwo autorowi tego posta
 

 
Tagi: scoreboard :: nie :: wyświetla :: się :: kolor :: rangi.
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Odpowiedz do tematu

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