SA-MP Forums Archive
Get color - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Get color (/showthread.php?tid=515522)

Pages: 1 2


Get color - audriuxxx - 26.05.2014

Hi,

How for ex, from this color:

0x808080AA

Get

0x80808000

I mean any color, change last symbols to 00


Re: Get color - Riddick94 - 26.05.2014

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


Re: Get color - Rittik - 26.05.2014

Last symbol to FF will be the best.


Re: Get color - Riddick94 - 26.05.2014

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.


Re: Get color - audriuxxx - 26.05.2014

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


Re: Get color - Riddick94 - 26.05.2014

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


Re: Get color - iFarbod - 26.05.2014

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



Re: Get color - audriuxxx - 26.05.2014

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


Re: Get color - Riddick94 - 26.05.2014

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.


Re: Get color - audriuxxx - 26.05.2014

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.


Re: Get color - Konstantinos - 26.05.2014

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)


Re: Get color - audriuxxx - 27.05.2014

I have to use that:

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



Re: Get color - Threshold - 27.05.2014

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.


Re: Get color - audriuxxx - 28.05.2014

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


SetPlayerMarkerForPlayer(playerid, Nextplayerid, ( GetPlayerColor( Nextplayerid ) & 0xFFFFFF00 ) );


Re: Get color - Vince - 28.05.2014

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.


Re: Get color - audriuxxx - 28.05.2014

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?


Re: Get color - RajatPawar - 28.05.2014

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


Re: Get color - audriuxxx - 28.05.2014

But why my script don't work?


Re: Get color - RajatPawar - 28.05.2014

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)


Re: Get color - audriuxxx - 28.05.2014

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