DBY

[ Source Code ] 3D Scoreboard

Recommended Posts

I was bored and long time without do any script so I started looking in the wiki some functions what I not used yet and I found dxDrawMaterialLine3D. You have a video and code about a scoreboard what I made for test this function. Maybe this can be useful for you ( take scrollbar, etc ).

 

 

Client-Side code:

 

Spoiler

local renderTarget = dxCreateRenderTarget( 1000, 1000, true )
local posX, posY, posZ = 14, 0, 2.8
local scroll = 0

local players = { }

for i = 1, math.random( 15, 36 ) do

	table.insert( players, { "Row #" .. #players, math.random( 50, 180 ) } )
	
end

addEventHandler( "onClientRender", root,
	function( )
		dxSetRenderTarget( renderTarget, true )
		
			local offsetY = 100
			
			for i = 1, #players do
				
				local posX, posY, width, height = 0, offsetY - scroll, 970, 80
				
				dxDrawRectangle( posX, posY, width, height, tocolor( 0, 0, 0, 200 ) )
				dxDrawText( players[ i ][ 1 ], posX + 30, posY, posX + 30 + width, posY + height, tocolor( 255, 255, 255, 255 ), 3, "default-bold", "left", "center" )
				dxDrawText( players[ i ][ 2 ], posX + ( width - 30 ), posY, posX + ( width - 30 ), posY + height, tocolor( 255, 255, 255, 255 ), 3, "default-bold", "right", "center" )
				offsetY = offsetY + 80
				
			end
			
			local contentH = #players * 80
			local viewableRatio = 900 / contentH
			local scrollH = 900 * viewableRatio
			
			dxDrawRectangle( 970, 100, 30, 900, tocolor( 0, 0, 0, 230 ) )
			dxDrawRectangle( 970, 100 + ( scroll * viewableRatio ), 30, scrollH, tocolor( 255, 255, 255, 230 ) )
			dxDrawRectangle( 0, 0, 1000, 100, tocolor( 0, 0, 0, 255 ) )
			dxDrawText( "3D Scoreboard                  " .. #players .. "/100", 0, 0, 1000, 100, tocolor( 255, 255, 255, 255 ), 5, "default-bold", "center", "center" )
			
			if ( getKeyState( "pgdn" ) ) then
			
				scroll = math.min( scroll + 15, contentH - 900 )
				
			elseif ( getKeyState( "pgup" ) ) then
			
				scroll = math.max( scroll - 15, 0 )
				
			end
		
		dxSetRenderTarget( )
		dxDrawMaterialLine3D( posX, posY, posZ + 5, posX, posY, posZ, renderTarget, 5, tocolor( 255, 255, 255, 255 ), 0, 0, 0 )
	end
)

 

 

Edited by danibayez
  • Like 7

Share this post


Link to post

I like seeing people sharing which others the knownledge adquired in an individual learning process without waiting any kind of benefits. Respect.

  • Like 2

Share this post


Link to post

Thanks for sharing this, i'm defenitly using this as a way to see what players are currenty playing in the arena in my Pvp Minigame. Will show some pictures of this later on

Share this post


Link to post
3 hours ago, Syntrax# said:

Thanks for sharing this, i'm defenitly using this as a way to see what players are currenty playing in the arena in my Pvp Minigame. Will show some pictures of this later on

See my code useful for you made me happy. I'm waiting your pictures :D

Share this post


Link to post
3 hours ago, danibayez said:

See my code useful for you made me happy. I'm waiting your pictures :D

i've edited the code abit to create a kind of selection menu and i've to say it did work out pretty well i'm pretty happy with the results.Ofcourse i keep the credits to you since you've made this gridlist :D

 

  • Like 1

Share this post


Link to post

Edited version now supports rotating vehicle and number on the right has been changed

  • Like 3

Share this post


Link to post
1 hour ago, aka Blue said:

@Syntrax# Nice. ¿You gonna post the code?

No i'm currently going to use it for my RoleplayGaming server called Dynasty Network

Share this post


Link to post

Nice

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.