Jump to content

[Help] How to make a scoreboard?


Tokio

Recommended Posts

I want create a custom scoreboard.. But, how to add players to it with rectangle, and dxdrawtext(s), and when there are xy players, how to make scrollable?? 

Sorry for my bad english.. :c

Edited by 50cent
Link to comment

The easiest way without modifying a ton of things is just making the table as a variable and in the loop, looping through from n to n + scoreboard rows, then selecting the players with playerTable[ i ]. You can just increase or decrease "n" and that should make the scrolling working.

Edited by NeXuS™
Link to comment
30 minutes ago, NeXuS™ said:

The easiest way without modifying a ton of things is just making the table as a variable and in the loop, looping through from n to n + scoreboard rows, then selecting the players with playerTable[ i ]. You can just increase or decrease "n" and that should make the scrolling working.

I dont understand this :S can you show a example?

Link to comment
local scrollN = 0

local pTable = getElementsByType("player")

for i = scrollN, scrollN + 12 do
	local selectedP = pTable[i]
	...
end

You'll have to arrange the code, and add a way to increase and decrease the scrollN value.

Edited by NeXuS™
Link to comment
7 hours ago, NeXuS™ said:

local scrollN = 0

local pTable = getElementsByType("player")

for i = scrollN, scrollN + 12 do
	local selectedP = pTable[i]
	...
end

You'll have to arrange the code, and add a way to increase and decrease the scrollN value.

where to put in the code? after  "  for id, player in ipairs(all_players) do " or before?
 

Link to comment

I wont tell you exactly how to make your script. I'll explain that little snippet of the code.

local scrollN = 0 -- Settings scrolling state to 0, so the scrolling is at the top.

local pTable = getElementsByType("player") -- Getting the players.

for i = scrollN, scrollN + 12 do -- Using the scrollN value, we can scroll through the players in the pTable, increasing the scrollN value will make to skip the first N players in the table.
	local selectedP = pTable[i] -- Selecting the player from the playerTable using the "i" val.
	... -- Drawing player info.
end

 

  • Like 1
Link to comment

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.
×
×
  • Create New...