RGBAToARGB for SetObjectMaterialText
#1

pawn Code:
stock RGBAToARGB(col)
{
    return ((((col) << 24) & 0xFF000000) | (((col) >>> 8) & 0xFFFFFF));
}
pawn Code:
getPlayerCrewColor(playerid)
{
    new crew[32];
    if(!PLAYER_CREW[playerid][player_crew_VALID]) crew = "none";
    else format(crew, sizeof crew, "%s", CREW_INFO[ PLAYER_CREW[playerid][player_crew_INDEX] ][crew_COLOR] = RGBAToARGB(crew);
    return crew;
}
Error: error 033: array must be indexed (variable "crew")
error 001: expected token: ",", but found ";"

pawn Code:
new CrewColorGraffiti = getPlayerCrewColor(playerid);  
format(CrewNameGraffiti,sizeof(CrewNameGraffiti),"%s",getPlayerCrew(playerid));
SetObjectMaterialText(GraffitisObj[0], CrewNameGraffiti, 0, OBJECT_MATERIAL_SIZE_256x128, "Comic Sans MS", 24, 1, CrewColorGraffiti, 0x00000000, 0);
Error: error 035: argument type mismatch (argument

They help me solve it?
Reply
#2

Color is integer. `crew_COLOR` should be integer.
pawn Code:
// returns RGBA (integer)
getPlayerCrewColor(playerid)
{
    return !PLAYER_CREW[playerid][player_crew_VALID] ? -1 : CREW_INFO[ PLAYER_CREW[playerid][player_crew_INDEX] ][crew_COLOR];
}
pawn Code:
// converts RGBA to ARGB (integer)
new CrewColorGraffiti_ARGB = RGBAToARGB(getPlayerCrewColor(playerid));

SetObjectMaterialText(GraffitisObj[0], getPlayerCrew(playerid), 0, OBJECT_MATERIAL_SIZE_256x128, "Comic Sans MS", 24, 1, CrewColorGraffiti_ARGB, 0x00000000, 0);
Reply
#3

Thank you!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)