Using a string to set 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: Using a string to set textdraw color (
/showthread.php?tid=636626)
Using a string to set textdraw color -
Amads - 01.07.2017
Is it possible to do something like that?
PHP Code:
new str[16];
new strJoin[8];
strcat(str, "0xFF0000");
format(strJoin, sizeof(strJoin), "%d", 10+amount*-1); // amount is my variable
strcat(str, strJoin);
PlayerTextDrawColor(playerid, txtpDmg[playerid], str); // line 1606
I get an error:
PHP Code:
(1606) : error 035: argument type mismatch (argument 3)
Re: Using a string to set textdraw color -
Freedom. - 01.07.2017
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);
Re: Using a string to set textdraw color -
Amads - 01.07.2017
Nevermind, got it
PHP Code:
new hex;
sscanf(str, "x", hex);
PlayerTextDrawColor(playerid, txtpDmg[playerid], hex);