Colour embedding help
#1

I have this so far...

pawn Code:
public OnPlayerText(playerid, text[])
{
    new
        tStr [ 156 ],
        p_Name [ MAX_PLAYER_NAME ];
       
    GetPlayerName( playerid, p_Name, sizeof( p_Name ) );
       
    printf("%s", accInfo [ playerid ] [ Colour ] ); // 0xFFFFFFFF
    strdel( accInfo [ playerid ] [ Colour ], 0, 2 );
    strdel( accInfo [ playerid ] [ Colour ], 6, 8 );
    printf("%s", accInfo [ playerid ] [ Colour ] ); // FFFFFF ( proper format )
       
    format( tStr, sizeof( tStr ), ""#IDCOLOUR"~%d~ "#accInfo[playerid][Colour]"%s "#IDCOLOUR"-> "#WHITE"%s", playerid, p_Name, text );
    SendClientMessageToAll( -1, tStr );
    return false;
}
The line I'm having trouble with is the colour embedding with the account variable. How would I go about doing it?

EDIT: Just tried a new method, to no avail.. I'm confused.

pawn Code:
public OnPlayerText(playerid, text[])
{
    new
        tStr [ 156 ],
        p_Name [ MAX_PLAYER_NAME ], originalColour [ 15 ];
       
    GetPlayerName( playerid, p_Name, sizeof( p_Name ) );
       
    format( originalColour, 15, accInfo [ playerid ] [ Colour ] );
    printf("%s", accInfo [ playerid ] [ Colour ] );
    strdel( accInfo [ playerid ] [ Colour ], 0, 2 );
    printf("%s", accInfo [ playerid ] [ Colour ] );
    strdel( accInfo [ playerid ] [ Colour ], 6, 8 );
    printf("%s", accInfo [ playerid ] [ Colour ] );
       
    format( tStr, sizeof( tStr ), ""#IDCOLOUR"~%d~ "accInfo[playerid][Colour]"%s "#IDCOLOUR"-> "#WHITE"%s", playerid, p_Name, text );
    SendClientMessageToAll( -1, tStr );
   
    accInfo [ playerid ] [ Colour ] = originalColour;
    printf("%s", accInfo [ playerid ] [ Colour ] );
    return false;
}
The string gets deleted and restored properly, I just need the HEX code to work properly in a message!
Reply
#2

pawn Code:
public OnPlayerText(playerid, text[])
{
    new
        tStr [ 156 ],
        p_Name [ MAX_PLAYER_NAME ];

    GetPlayerName( playerid, p_Name, sizeof( p_Name ) );

    format( tStr, sizeof( tStr ), ""#IDCOLOUR"~%d~ {%06x}%s "#IDCOLOUR"-> "#WHITE"%s", playerid, (accInfo[playerid][Colour] >>> 8), p_Name, text );
    SendClientMessageToAll( -1, tStr );
    return false;
}
Reply
#3

Jesus christ, could you complicate it any more..?
Reply
#4

LOLWHAT?

pawn Code:
public OnPlayerText(playerid, text[])
{
    new
        tStr [ 156 ],
        p_Name [ MAX_PLAYER_NAME ];
       
    GetPlayerName( playerid, p_Name, sizeof( p_Name ) );
       
    printf("%s", accInfo [ playerid ] [ Colour ] ); // 0xFFFFFFFF
    strdel( accInfo [ playerid ] [ Colour ], 0, 2 );
    strdel( accInfo [ playerid ] [ Colour ], 6, 8 );
    printf("%s", accInfo [ playerid ] [ Colour ] ); // FFFFFF ( proper format )
       
    format( tStr, sizeof( tStr ), ""#IDCOLOUR"~%d~ {%s}%s "#IDCOLOUR"-> "#WHITE"%s", playerid, accInfo[playerid][Colour], p_Name, text );
    SendClientMessageToAll( -1, tStr );
    return false;
}
Reply
#5

Quote:
Originally Posted by Jefff
View Post
pawn Code:
public OnPlayerText(playerid, text[])
{
    new
        tStr [ 156 ],
        p_Name [ MAX_PLAYER_NAME ];

    GetPlayerName( playerid, p_Name, sizeof( p_Name ) );

    format( tStr, sizeof( tStr ), ""#IDCOLOUR"~%d~ {%06x}%s "#IDCOLOUR"-> "#WHITE"%s", playerid, (accInfo[playerid][Colour] >>> 8), p_Name, text );
    SendClientMessageToAll( -1, tStr );
    return false;
}
Uhhhhhhhhhh........

Quote:
Originally Posted by MP2
View Post
Jesus christ, could you complicate it any more..?
I'm sure I probably could.

Quote:
Originally Posted by Kar
View Post
LOLWHAT?

pawn Code:
public OnPlayerText(playerid, text[])
{
    new
        tStr [ 156 ],
        p_Name [ MAX_PLAYER_NAME ];
       
    GetPlayerName( playerid, p_Name, sizeof( p_Name ) );
       
    printf("%s", accInfo [ playerid ] [ Colour ] ); // 0xFFFFFFFF
    strdel( accInfo [ playerid ] [ Colour ], 0, 2 );
    strdel( accInfo [ playerid ] [ Colour ], 6, 8 );
    printf("%s", accInfo [ playerid ] [ Colour ] ); // FFFFFF ( proper format )
       
    format( tStr, sizeof( tStr ), ""#IDCOLOUR"~%d~ {%s}%s "#IDCOLOUR"-> "#WHITE"%s", playerid, accInfo[playerid][Colour], p_Name, text );
    SendClientMessageToAll( -1, tStr );
    return false;
}
Thank you.
Reply
#6

Quote:
Originally Posted by 2KY
View Post
I'm sure I probably could.
@Jefff.
Reply
#7

Quote:
Originally Posted by MP2
View Post
@Jefff.
Apologies.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)