SA-MP Forums Archive
SetMaterialObjectText problem - 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: SetMaterialObjectText problem (/showthread.php?tid=550863)



SetMaterialObjectText problem - streetpeace - 15.12.2014

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.


Re: SetMaterialObjectText problem - Vince - 15.12.2014

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.



Re : SetMaterialObjectText problem - streetpeace - 15.12.2014

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 ?


Re: SetMaterialObjectText problem - Vince - 15.12.2014






Re : SetMaterialObjectText problem - streetpeace - 15.12.2014

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


Re : SetMaterialObjectText problem - streetpeace - 15.12.2014

someone ?


Re : SetMaterialObjectText problem - streetpeace - 16.12.2014

I need help.


Re: SetMaterialObjectText problem - Stinged - 16.12.2014

Didn't Vince post what's wrong?


Re : SetMaterialObjectText problem - streetpeace - 16.12.2014

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



Re : SetMaterialObjectText problem - streetpeace - 16.12.2014

so ?