SA-MP Forums Archive
Custom TextDraw Color - 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: Custom TextDraw Color (/showthread.php?tid=661966)



Custom TextDraw Color - valelelex - 20.12.2018

I want to set a custom color for TextDrawBox from inputtext in a dialog:

Код:
if(strlen(inputtext) != 6) return SendClientMessage(playerid, COLOR_LIGHTRED, "Culoarea trebuie sa fie din 6 caractere!");
new str[128];
format(str,sizeof(str), "0x%sFF", inputtext);
PlayerTextDrawUseBox(playerid, SS[playerid], str);
And I receive this error:
Quote:

error 035: argument type mismatch (argument 3)




Re: Custom TextDraw Color - NaS - 20.12.2018

PlayerTextDrawUseBox doesn't expect a string.
It expects a 1 (for box on) or 0 (box off).

https://sampwiki.blast.hk/wiki/PlayerTextDrawUseBox

The color of the box is changed using PlayerTextDrawBoxColor.
So you need to enable the box and then set its color seperately.

https://sampwiki.blast.hk/wiki/PlayerTextDrawBoxColor

But you cannot use the input directly as it is a string, and not a number.
If you use sscanf, you can use it to get the color as integer from the string easily:

PHP код:
new color;
sscanf(inputtext"x"color); 
Or find an include or function that converts a string hex color to integer.