SA-MP Forums Archive
RGBAToARGB for SetObjectMaterialText - 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: RGBAToARGB for SetObjectMaterialText (/showthread.php?tid=664006)



RGBAToARGB for SetObjectMaterialText - KaliDobrev - 17.02.2019

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?


Re: RGBAToARGB for SetObjectMaterialText - Calisthenics - 17.02.2019

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);



Re: RGBAToARGB for SetObjectMaterialText - KaliDobrev - 17.02.2019

Thank you!