29.04.2012, 23:28
I have this so far...
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.
The string gets deleted and restored properly, I just need the HEX code to work properly in a message!
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;
}
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;
}