Skip to content
This repository was archived by the owner on Apr 7, 2023. It is now read-only.

fix names with color codes coloring the whole console output. #34

Merged
merged 2 commits into from
Oct 27, 2018

Conversation

vecchiotom
Copy link
Contributor

this adds a reset color code at the end of each name that is printed in console by hardcap, making sure if they contain colorcodes within them, they won't color the whole console output.

@Firecul
Copy link
Contributor

Firecul commented Sep 26, 2018

Why did you use ^7 out of curiosity, would ^0 for white not be more appropriate?
Or are you relying on 7 not actually being configured on 99.9% of servers to have a colour?

@iQuadCore
Copy link

According to https://forum.fivem.net/t/chat-formatting-colors-bold-underline/67641, using ^r would be the most appropriate to reset any kinds of formatting, including bold, underline, etc.

I believe it would be better to edit the way print function is handled by server console (if possible) rather than just editing cfx-server-data - this would prevent the same behaviour from other custom resources.

@vecchiotom
Copy link
Contributor Author

@Firecul @iQuadCore ^7 is the right code to reset the color. i'll show you: as you can see here the 8th element of the array is the reset color code. this means that it has key 7, since in c++ you start counting elements from 0. @iQuadCore ^r would result in nothing being shown in console, since as you can see here fivem checks for a digit after the ^ character, r is not a digit, nor is it a valid color code.

@vecchiotom
Copy link
Contributor Author

moreover, ^7 is what is currenty being utilized by fivem as well to reset the color, here and here.

@Firecul
Copy link
Contributor

Firecul commented Sep 27, 2018

Ok fair enough then. Consistency is better than making something new

@blattersturm blattersturm merged commit c49db60 into citizenfx:master Oct 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants