Using a string to set textdraw color
#1

Is it possible to do something like that?

PHP Code:
                new str[16];
                new 
strJoin[8];
                
                
strcat(str"0xFF0000");
                
format(strJoinsizeof(strJoin), "%d"10+amount*-1); // amount is my variable
                
strcat(strstrJoin);
                
                
PlayerTextDrawColor(playeridtxtpDmg[playerid], str); // line 1606 
I get an error:
PHP Code:
(1606) : error 035argument type mismatch (argument 3
Reply
#2

Nope.

Code:
PlayerTextDrawColor(playerid, txtpDmg[playerid], ADD_COLOR_CODE_HERE);
PlayerTextDrawColor(playerid, txtpDmg[playerid], COLOR_RED);
You can use this.
https://sampwiki.blast.hk/wiki/TextDraw_Text_Codes

Code:
format(strJoin, sizeof(strJoin), "~r~%d", 10+amount*-1);
PlayerTextDrawSetString(playerid, txtpDmg[playerid], strJoin);
Reply
#3

Nevermind, got it

PHP Code:
new hex;
sscanf(str"x"hex);
PlayerTextDrawColor(playeridtxtpDmg[playerid], hex); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)