Jump to content

scoreboard color assignment


Shady1

Recommended Posts

hi, i wrote my scoreboard tabulation rank system, but i can't color the ranks,F2B Founder's color is red
I want Developer's color to be Blue, what should I do for that?
spacer.png
      if(isObjectInACLGroup("user."..accountName, aclGetGroup("Founder"))) then
         return "F2BFounder"
      elseif(isObjectInACLGroup("user."..accountName, aclGetGroup("Developer"))) then
         return "Developer"
      elseif(isObjectInACLGroup("user."..accountName, aclGetGroup("Admin"))) then
         return "Admin"
      elseif(isObjectInACLGroup("user."..accountName, aclGetGroup("Moderator"))) then
         return "Moderator"
      elseif(isObjectInACLGroup("user."..accountName, aclGetGroup("VIP"))) then
         return "VIP"
      else
         return "Member"
      end

Link to comment

Hello eoL|Shady,

let me continue our little chat we had through private messaging. Thank you for providing the image of your scoreboard resource. It looks like it is a customized dxscoreboard resource. There is even a player count included into the pane! Nice work.

Since you are using a custom resource I am not sure how much of it is actually intact and what has changed in comparison to the original. Based on the original I would try using the #RRGGBB color coding as mentioned for the dxDrawText function to color the cell text content. You could even use the original dxscoreboard scoreboardSetColumnTextFunction clientside function to prefix the text content with a color code.

Full red is #FF0000, full blue is #0000FF.

Edited by The_GTA
  • Thanks 1
Link to comment

I have assessed the situation by inspecting the dxscoreboard resource. It looks like my assumption was wrong that generic cells would support color coding. Instead, the color coding appears to be only supported for player and team names! With that let-down in mind I was able to find the root of the problem:

dxDrawText( content, topX+theX+s(1), 	y+s(1), topX+x+s(1+column.width), 	y+s(11)+dxGetFontHeight( fontscale(contentFont, scoreboardScale), contentFont ), 	tocolor( 0, 0, 0, a or 255 ), fontscale(contentFont, s(1)), contentFont, "left", "top", true, false, drawOverGUI )
dxDrawText( content, topX+theX, 		y, 		topX+x+s(column.width), 	y+dxGetFontHeight( fontscale(contentFont, scoreboardScale), contentFont ), 			tocolor( r or 255, g or 255, b or 255, a or 255 ), fontscale(contentFont, s(1)), contentFont, "left", "top", true, false, drawOverGUI )

At lines 750, 751 for player rows and 659, 660 for teams in the officially bundled scoreboard resource for the MTA server. It looks like you have to extend the drawing logic of this resource. I suggest you to try adding a cell-based color overwrite value that gets applied in all scenarios. Since that resource is written like a trainwreck, trying to please very special interests, I cannot guide you into a specific overhaul direction. You need to make sure that you apply proper book-keeping related to row removal and addition. Then you need to make the distinctions between player and team rows. It really looks like a mess, but good luck!

Also that player count appears to be a basic configuration option for the dxscoreboard resource, so the resource you use does not seem to be that custom in hindsight.

Edited by The_GTA
  • Thanks 1
Link to comment
On 23/11/2021 at 14:44, eoL|Shady said:

I'm glad you worked for me, and I thank you, you are a good person.

 

Thank you for the compliment! The biggest amount of work is yet for you to be made, my friend. But we should support each other as a community in the best way that we can, especially through experience. So don't shy away from consulting this scripting forums again. ?

EDIT: there appear to be session data difficulties in the MTA wiki (loss of session data?) so I cannot login, logout or edit wiki pages. Invalid CSRF Token. Thus let me dump this here...

EDIT: the wiki issues have been fixed thanks to @myonlake! A big kudos since thanks to him I was able to extend the wiki documentation of the dxscoreboard resource with useful hints about cell color support. It goes to show that reporting issues about MTA services does result in very quick and effective support by the MTA team.

Edited by The_GTA
Link to comment

I hadn't tried this, now I'm going to try this "content_color" XML

and : 
 

  1. <setting name="*allowColorcodedNames" value="true" friendlyname="Allow colorcoded names" group="General" accept="false,true" desc="Should the player's color code be used as the display color in scoreboard?" />
Edited by eoL|Shady
Link to comment
10 minutes ago, eoL|Shady said:

I hadn't tried this, now I'm going to try this "content_color" XML

It is very limited because it sets the color to all cells (as default if there is no higher priority color) and can be changed by the user.

Edited by The_GTA
Link to comment

what if i can put color in the names of the players but according to the ACL.
These are the ACLs, how can I assign color codes to people automatically, I couldn't find it
aclGetGroup("Founder")
aclGetGroup("Developer")
aclGetGroup("Admin")
aclGetGroup("Moderator")
aclGetGroup("Support")

Link to comment

No magical MTA functions are necessary to make this functionality. You just have to extend the aforementioned lines with different color values into the tocolor MTA function that is already being used. What you need is new data structures that store the color values as well as a strategy to extend the existing data structures. How about you spend the evening trying to figure that out and sharing your ideas, let's say, by the weekend? Read the code of the dxscoreboard resource intensively. I will be assessing them if you do.

Edited by The_GTA
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...