is it even possible?
#1

Example:

new Hexcolor[26];
format(Hexcolor,26,"#33CC00");
SetPlayerColor(playerid,Hexcolor);
Is this even possible?
Because it only makes my name black...
Maybe stupid question but I get sick of this day, everything goes wrong...
Reply
#2

you do it like this

pawn Код:
#define Hexcolor "{33CC00}"

SetPlayerColor(playerid,Hexcolor);
Reply
#3

No, because it's for family's, and I want to be able to change the colors ingame.
I don't ask how else I can do it, but I just ask if this is even possible.
Reply
#4

in that case you can use numbers for a color which they will be stored as variable
and just used it like example im using this
pawn Код:
GangZoneShowForAll(id,16711888);
this makes my gangzone to blue with abit of transparent in it
EDIT:
another example
pawn Код:
new Color = GetPVarInt(playerid, "16711888");
SetPlayerColor(playerid,Color);
Reply
#5

Uhm well I tested that too, but I gues that didn't work because I put the numbers inside a string, I'm going to try it again.
Reply
#6

Thanks for the help, it works.
Reply
#7

wierd, the decimal color codes doesn't get the color it should be I tried 10 different sites with hex en dec colors, but I gues that's a sa-mp bug.(again)
Reply
#8

use infernus pawn editor...he got a color picker

RR GG BB AA

just with numbers will be like...

99000000 = transparent red
00990000 = transparent green
00009900 = transparent blue
99009900 = transparent purple
99999900 = transparent grey
00999900 = transparent lightblue

transparent means that will not show the markers in map..if you want to show the markers just replace the last 00 for 99
Reply
#9

For your command this might be helpful:

https://sampwiki.blast.hk/wiki/Colors_Li...alue_with_pawn
Reply
#10

Use this function:
pawn Код:
stock hexstr( string[ ] ) // Function by ******
{
    new ret, val, i;
    if( string[ 0 ] == '0' && ( string[ 1 ] == 'x' || string[ 1 ] == 'X' ) ) i = 2;

    while( string[ i ] )
    {
        ret <<= 4;
        val = string[ i ++ ] - '0';
        if( val > 0x09 ) val -= 0x07;
        if( val > 0x0F ) val -= 0x20;
        if( val < 0x01 ) continue;
        if( val < 0x10 ) ret += val;
    }
    return ret;
}
Use like this:
Код:
new Hexcolor[ 26 ];
format( Hexcolor, 26, "#33CC00" );
SetPlayerColor( playerid, hexstr( Hexcolor ) );
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)