sscanf HEX values help
#1

Hello dear reader,

I am busy working on a system attaching objects with text to vehicles, you have to input the textcolor and the background/object color, somehow the HEX values processed by sscanf turn out wrong, this is the code;
pawn Код:
new vehicleid, set[10], model, tekst[128], res, fsize, side[10], textcolor, backcolor;
if(!sscanf(params, "ds[10]s[10]ds[128]ddhh", vehicleid, set, side, model, tekst, res, fsize, textcolor, backcolor))
    {
    vText[vehicleid][slot][tColor] = textcolor;
    vText[vehicleid][slot][bColor] = backcolor;
    }
   
// The vText enum

enum vtext
{
    tColor,
    bColor
}
new vText[MAX_VEHICLES][4][vtext];
I would really swear this exact code has been working in the past but even if I know it for sure it isn't working now so I really need help on this, the weird thing is that the sscanf page says the next;
Quote:
Originally Posted by sscanf github page
"h" Specifier

This is a Simple Specifier, written as either h or x and representing hex numbers (that is, base 16 numbers written using the digits 0-9 and A-F, with an optional 0x prefix).

Valid inputs:
Код:
 0
 10
 A
 b2434FF1
 0x101
 0XEEE
Invalid inputs:
Код:
 -0x101
 0xG213
When I check the B2434F(F1) color in an online color picker it shows me the color you can see in the screenshot (Click image to enlarge):


But when I use it in the game (As background color as you can see in the screenshot) it turns out blue:


If anyone knows what's causing it/how to solve it you would really help me!

Best regards,
Jesse
Reply
#2

fontcolor The color of the text, in ARGB format.
backcolor The background color, in ARGB format.

You got the wrong color format dude.
Reply
#3

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
fontcolor The color of the text, in ARGB format.
backcolor The background color, in ARGB format.

You got the wrong color format dude.
I was just going to post I found that out, thanks for attempting to help me tough but I already fixed it for myself too, let me still give you some reputation points.
I need to add that the alpha of the background color is bugging, because if you do 0024C5C9 FFFFFFFF the text will be transparant and the background will be white, as it's supposed to be, do you do FFFFFFFF 0024C5C9 the text will be white and the background will be blue-ish (The right color), so that means the alpha of the background color isn't working as it should, easy fix!, just do 00000000 and it will still be 'transparant'. I will still make a bugreport about this but for now this would be the easy fix.

Best regards,
Jesse
Reply
#4

That is kind of interesting I do know some of the lower alpha values might result in transparency as well even though it shouldn't be there seems to be some sort of threshold value.
Reply
#5

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
That is kind of interesting I do know some of the lower alpha values might result in transparency as well even though it shouldn't be there seems to be some sort of threshold value.
Before posting this bug report I searched the bug reports forum and found an older report about this bug, you should also read the older topic I'm linking to in that post, someone says the background alpha can be 00 (0) or FF (255), any other value will result in FF (255).

Best regards,
Jesse
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)