Nickqq

Scoreboard N/A players bug

Recommended Posts

I am having trouble with my scoreboard. When a player connect as N / A (before logging in), the scoreboard does not appear. and when the player logs in, he appears again. Client:

 

local scx,scy = guiGetScreenSize()
local renderTarget = dxCreateRenderTarget( 480, 480,true);
local scroll = 0
function DrawText (text, xc,yc, w, h, color,Size,Size1,fonts,alignX,alignY)
return dxDrawText(text,xc, yc, w + xc, h + yc, color,Size,Size1,fonts,alignX,alignY, true, false, false, true)
end
local viss = false

function tabs ()
if getKeyState("tab") then
viss = true
dxSetRenderTarget(renderTarget,true)
--dxSetBlendMode("overwrite")
dxSetBlendMode("modulate_add")

dxDrawRectangle(0, 20, 480, 460,tocolor(0,0,0,160))
dxDrawRectangle(0, 20, 20, 460,tocolor(0,0,0,255))
local y = 0
for i,v in pairs(getElementsByType('player')) do
    if getLocalPlayer() == v then dxDrawRectangle(20, 40+y-scroll, 460, 20,tocolor(200,0,0,180)) end
    DrawText(""..getElementData(v,"ID") or 0,0,40+y,20,20,tocolor(255,255,255,255),1,1,"sans","center","center")
    if getElementData(v, 'gruppaADM')then dxDrawImage(24,46+y-scroll,12,12,"img/a.png") end
    DrawText(getPlayerName(v),40,40+y-scroll,20,20,tocolor(255,255,255,255),1,1,"sans","left","center")
	DrawText("Logado",190,40+y-scroll,50,20,tocolor(255,255,255,255),1,1,"sans","center","center")
    DrawText(""..getElementData(v,"Country") ,260,40+y-scroll,50,20,tocolor(255,255,255,255),1,1,"sans","center","center")
    DrawText(""..getElementData(v,"На сервере") or "0с 0м",320,40+y-scroll,50,20,tocolor(255,255,255,240),1,1,"sans","center","center")
    DrawText("  "..getPlayerPing(v),420,40+y-scroll,50,20,tocolor(255,255,255,240),1,1,"sans","center","center")
    y = y + 22
end
DrawText(#getElementsByType('player')..'/30     ',0, 0, 480,20,tocolor(255,255,255,240),1.1,1.1,"sans","right","center")
dxDrawRectangle(0, 20, 480, 20,tocolor(0,0,0,255))

DrawText("ID",0,20,20,20,tocolor(255,255,255,240),1,1,"sans","center","center")

DrawText("Nick",20,20,170,20,tocolor(255,255,255,240),1,1,"sans","center","center")
--dxDrawRectangle(220,20,80,20,tocolor(255,255,255,255))getElementsByType('player')
DrawText("Status",190,20,50,20,tocolor(255,255,255,240),1,1,"sans","center","center")
DrawText("País",260,20,50,20,tocolor(255,255,255,240),1,1,"sans","center","center")
DrawText("Tempo",320,20,50,20,tocolor(255,255,255,240),1,1,"sans","center","center")
DrawText("Clã",370,20,50,20,tocolor(255,255,255,240),1,1,"sans","center","center")
DrawText("  Ping",420,20,50,20,tocolor(255,255,255,240),1,1,"sans","center","center")
--dxSetBlendMode("blend")
dxSetBlendMode("blend")
dxSetRenderTarget()
dxDrawImage(scx/2-240, scy/2-225, 480, 480, renderTarget)
else
viss = false
end
end
addEventHandler("onClientRender",root,tabs)


function scrollUP (key)
    if not viss then return end
	if #getElementsByType('player') > 20 then
	if key == "mouse_wheel_up" then
		scroll = math.max( scroll - 35, 0 )
	elseif key == "mouse_wheel_down" then
		scroll =  math.min( scroll + 35, (#getElementsByType('player')*22.5) - 460 )
	end
	end
end
bindKey('mouse_wheel_up', 'down', scrollUP) 
bindKey('mouse_wheel_down', 'down', scrollUP)

 

Thanks!!

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.