Get color
#1

Hi,

How for ex, from this color:

0x808080AA

Get

0x80808000

I mean any color, change last symbols to 00
Reply
#2

Last symbols are called ALPHA values. This is a HEX code and its colors are defined by RRGGBBAA. And what do you mean by get color? You want to store your color to the variable and then substract some amount from that or what?

0xRRGGBBAA

0xREDREDGREENGREENBLUEBLUEALPHAALPHA
Reply
#3

Last symbol to FF will be the best.
Reply
#4

Quote:
Originally Posted by Rittik
View Post
Last symbol to FF will be the best.
Do you actually even know what he means, and what you're trying to do? You just simply told him to change ALPHA value to FF which will remove whole transparency. But the point is, that we actually don't know what he's trying to achieve. I would treat your post as spam.
Reply
#5

I want to convert, because i have GetPlayerColor, and there is dark red, i need to get that color where transparenty will be 00.
Reply
#6

In that case, if I get you rightly, you need to set your alpha values to FF which will remove any transparency from your color.

So, your color will become this:
pawn Code:
0x808080FF
https://sampwiki.blast.hk/wiki/Colors_List
Reply
#7

You want make the player invisible?
pawn Code:
CMD:invisibleme(playerid, params[])
{
    #pragma unused params
    SetPlayerColor(playerid, 0x00000000);
    return 1;
}
Reply
#8

No... I can have any color i said GetPlayerColor, color player can be a lot of. That'is why i want to convert GetPlayerColor > To the same color, but transperety how i said will be 00. Like example.

if i getplayercolor is 0xFFFFFFAA

Then with function with i need i convert this to

0xFFFFFF00
Reply
#9

It will remove your transparency, players won't be visible at mini-map. Is that what you want?

Simply, you're saying now to have your colors (all of them) but change alpha value to '00' ? So color will still be there, but players will not be visible at the map?

First of all, you gonna need fix of the colors to achieve that:
https://sampwiki.blast.hk/wiki/ColorFix

And then in SetPlayerColor function change alpha channel to '00'. That's it.
Reply
#10

Don't care where i do them.. Just i need to know code. I don't convert all colors to 00, and i don't need that. I said color can be any! that'is why i need to use GetPlayerColor, but i need convert it to the same color but end will be 00, because i need that color from player color i will use there in other way. I need function, stock where i can put player getplayercolor, and there will convert my into color. No write my self or other shit.
Reply
#11

http://forum.sa-mp.com/showpost.php?...postcount=4321

The name is wrong though but it returns the colour with changed the alpha value. Just pass these arguments: (playerid, 0x00)
Reply
#12

I have to use that:

Code:
(GetPlayerColor(playerid) & ~0xFF) | clamp(0x00, 0x00, 0xFF)
Reply
#13

An easier way of writing this, just for piece of mind, is:
pawn Code:
GetPlayerColor(playerid) & (0xFFFFFF00);
This will change the alpha values to '00', hence making it a transparent marker.

Example of its usage:
pawn Code:
SetPlayerColor(playerid, GetPlayerColor(playerid) & (0xFFFFFF00));
This could be used in a command such as /invisible, which would make your map marker invisible to others.

pawn Code:
SetPlayerColor(playerid, GetPlayerColor(playerid) & (0xFFFFFFFF));
This would do the opposite and make the alpha values 'FF', hence your marker being full color and no transparency again. Like a /visible command.
Reply
#14

If i set player color, simple. But marker i will use


SetPlayerMarkerForPlayer(playerid, Nextplayerid, ( GetPlayerColor( Nextplayerid ) & 0xFFFFFF00 ) );
Reply
#15

Quote:
Originally Posted by BenzoAMG
View Post
pawn Code:
SetPlayerColor(playerid, GetPlayerColor(playerid) & (0xFFFFFFFF));
This would do the opposite and make the alpha values 'FF', hence your marker being full color and no transparency again. Like a /visible command.
This is incorrect. This will merely return the current color. Let's say the alpha is 0x99 (binary: 10011001) and you AND it with 0xFF (binary: 11111111):
Code:
10011001
&
11111111
---------
10011001
The output will only have the bits that are set (1) in BOTH operands.

To make the color fully visible you could OR with 0xFF (fully: 0x000000FF) instead (note: NOT 0xFFFFFFFF);

Code:
10011001
|
11111111
---------
11111111
The output will have the bits that are set (1) in EITHER operand.
Reply
#16

Code:
new NERODNAQWEFF;
        foreach(NERODNAQWEFF : Player)
        {
    
            	SetPlayerMarkerForPlayer(playerid, NERODNAQWEFF, ( GetPlayerColor( NERODNAQWEFF ) & 0xFFFFFF00 ) );
            
       
        }
I still see player markers.. I add this script onplayerspawn, if say more accurate when player spawn, and when i load player, from database then i use this script. But i still able to see every marker.. HOw this possible?
Reply
#17

Quote:
Originally Posted by audriuxxx
View Post
Code:
new NERODNAQWEFF;
        foreach(NERODNAQWEFF : Player)
        {
    
            	SetPlayerMarkerForPlayer(playerid, NERODNAQWEFF, ( GetPlayerColor( NERODNAQWEFF ) & 0xFFFFFF00 ) );
            
       
        }
I still see player markers.. I add this script onplayerspawn, if say more accurate when player spawn, and when i load player, from database then i use this script. But i still able to see every marker.. HOw this possible?
Oh man, just do this -

pawn Code:
foreach(new i : Player)
{
      SetPlayerMarkerVisibility(playerid, 0x00);
}
Do this inside a main loop for everyone if that's what you want
Reply
#18

But why my script don't work?
Reply
#19

Quote:
Originally Posted by audriuxxx
View Post
But why my script don't work?
https://sampwiki.blast.hk/wiki/SetPlayerMarkerForPlayer

Only ID 0's color will be changed (since the variable you are initialising will be set to 0)
Reply
#20

What variable? why ID 0, if i do cikle thru all players
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)