Custom TextDraw Color
#1

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)

Reply
#2

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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)