Color Transparency
#1

Does anyone has any idea how to set the transparency of color without defening one color and the to define 10 colors with different transparency. Like you want black color in transparency. And it would be

new black100 = 0x000000FF
black90 = 0x000000AA
black80 = 0x00000099

and so on...

So what I'm asking does anyone has idea how to make a function like SetColorTransparency(color, transparency) or something like that. I just need some tips of how to make it. Tnx
Reply
#2

Use RGBAToHex.
Reply
#3

Quote:
Originally Posted by MenaceX^
Use RGBAToHex.
Will do Tnx.
Reply
#4

I realy dont know how to do this. I know in very stupid way like to define over 100 colors and to use it in 100 different cases. Like when player choses the color and it will check the color and it will give the correct transparency level. There has to be easier way to do it.

Basicly what I'm trying to do is this.

like

0xFFFFFF??

This ?? to be replaced with transparency level that player choses.
I'm working on one GM and my brain just stopped. I have so much calculating and so many thing to do and on this I just freeze. I can't think and to came up with some color selecting system with transparency.

And this HexToInt and IntToHex I need to first come up with system to use them and that is where I need you help.

I'm making that first players selects it's color via text like "black" "green" or some other color. That was easy to make and the color is set to like if black 0x000000FF and when player selects the color than he must select the level of transparency. I know how to make that like this: if player choses 90% it will be 0x000000BB and that is much work to do with all the colors and all the transparency combinations.

So I need just some tips how to make such system. I'm not asking for code I'm just asking for help how to make the system, because I cant get any idea on my mind.

Thank you
Reply
#5

Not sure if this is exactly what you need but...
try to use
pawn Код:
yourcolour & 0xFFFFFF??
where ?? is transparency
I got it from here - https://sampwiki.blast.hk/wiki/SetPlayerMarkerForPlayer
Reply
#6

Thank you for your reply.

The scripting is not a problem but thinking for me in this moments it is. I'm sick (nothing serius just some temperature) and I just freeze with creating the system.

I can make this like I said in very stupid way that will take over 500 lines in my script and there will be many conditions wich will probably slow down the script.

I was thinking on something like this. First color that player choses is 100% with no transparency and it will be 0xCOLORCODEFF
And to make some variable like ChosenColor = 0xCOLORCODE
On this ChosenColor will not be any transparency level.

Now when player confirms that he did chose the right color the next thing is to chose the transparency of that color.

This part is just in words not scripted

Now lets say player choses 90% transparency and lets say that is BB
And to add something like this TransparencyLevel = BB;

It will be PlayerColor = ChosenColor + TransparencyLevel = 0xCOLORCODEBB

And still how to merge those two variables in one wich will be the color.

Or to make function like SetPlayerColor(color, transparency)

and it will be used like SetPlayerColor(0x000000, BB) and that will be merged in 0x00000BB. But how to merge two strings in one?
Reply
#7

I still don't understand, why ain't you using RGBAToHex?
Reply
#8

Quote:
Originally Posted by Dujma
It will be PlayerColor = ChosenColor + TransparencyLevel = 0xCOLORCODEBB
PlayerColor = ChosenColor & 0xFFFFFF??;
If I am not mistaken.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)