SetMaterialObjectText problem
#1

Hey, I want to create a tag system but I have a problem with colors
pawn Код:
new string[256];
new tag[60];
new tagcouleur;
format(tag, sizeof(tag), "%s", inputtext);
if(TagCouleur[playerid] == 1) tagcouleur = HexToInt("FF0000FF"); //rouge
if(TagCouleur[playerid] == 2) tagcouleur = HexToInt("0000FFFF"); //bleu
if(TagCouleur[playerid] == 3) tagcouleur = HexToInt("00FF00FF"); //vert
if(TagCouleur[playerid] == 4) tagcouleur = HexToInt("840000FF"); //rouge foncй
if(TagCouleur[playerid] == 5) tagcouleur = HexToInt("843A00FF"); //marron
TagID[playerid] = CreateObject(19482, PosTag[playerid][0], PosTag[playerid][1], PosTag[playerid][2], 0.0, 0.0, 90.0);
SetObjectMaterialText(TagID[playerid], tag, 0, OBJECT_MATERIAL_SIZE_256x128, "Arial", Tag[playerid], 0, tagcouleur, 0x00000000, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
EditObject(playerid, TagID[playerid]);
return true;
Here is the code, can someone tell me what's wrong with this pawn code ? Thanks.
Reply
#2

Quote:
Originally Posted by streetpeace
Посмотреть сообщение
I have a problem with colors
What, exactly? Vague descriptions don't help at all.

Few more points to note:
  1. Colors are numbers! You don't need HexToInt here!
  2. Use a switch statement.
    pawn Код:
    switch(TagCouleur[playerid])
    {
        case 1: tagcouleur = 0xFF0000FF; //rouge
        case 2: tagcouleur = 0x0000FFFF; //bleu
        case 3: tagcouleur = 0x00FF00FF; //vert
        case 4: tagcouleur = 0x840000FF; //rouge foncй
        case 5: tagcouleur = 0x843A00FF; //marron
    }
  3. You're copying "inputtext" to "tag" without any real purpose.
Reply
#3

So, I'm going to explain :

I'm creating a tag system. I've done a color tag dialog but when I want to create the tag with SetMaterialObjectText, it doesn't work!
I don't think the color are numbers because there is "FF" and F is a letter, don't it ?
Reply
#4



Reply
#5

Yes. So, how can I solve this problem please ? I've already tested all the possible "solutions" but no one works
Reply
#6

someone ?
Reply
#7

I need help.
Reply
#8

Didn't Vince post what's wrong?
Reply
#9

Yeah but It doesn't work :/
pawn Код:
new string[256];
new tagcouleur;
switch(TagCouleur[playerid])
{
    case 1: tagcouleur = 0xFF0000FF; //red
        case 2: tagcouleur = 0x0000FFFF; //blue
    case 3: tagcouleur = 0x00FF00FF; //green
    case 4: tagcouleur = 0x840000FF; //dark red
    case 5: tagcouleur = 0x843A00FF; //brown
}
TagID[playerid] = CreateObject(19482, PosTag[playerid][0], PosTag[playerid][1], PosTag[playerid][2], 0.0, 0.0, 90.0);
SetObjectMaterialText(TagID[playerid], inputtext, 0, OBJECT_MATERIAL_SIZE_256x128, "Arial", Tag[playerid], 0, tagcouleur, 0x00000000, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
Reply
#10

so ?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)