SA-MP Forums Archive
[Include] Coloured Text Draws - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] Coloured Text Draws (/showthread.php?tid=647321)



Coloured Text Draws - OneDay - 03.01.2018

The last thread is gone. I made an include to use {RRGGBB} in TextDraw instead of ~r~:

https://github.com/On3d4y/TextDrawColour.inc

Examples:

PHP Code:
TextDrawCreate(2.000000100.000000"{000005}={00000A}={00000F}={000014}={000019}={00001E}={000023}={000028}={00002D}={000032}={000037}={00003C}={000041}={000046}={00004B}={000050}={000055}={00005A}={00005F}={000064}={000069}={00006E}={000073}={000078}={00007D}={000082}={000087}={00008C}={000091}={000096}={00009B}={0000A0}={0000A5}={0000AA}={0000AF}={0000B4}={0000B9}={0000BE}={0000C3}={0000C8}={0000CD}={0000D2}={0000D7}={0000DC}={0000E1}={0000E6}={0000EB}={0000F0}={0000F5}={0000FA}={0000FF}={FF0000}OneDay{0000FF}={0000FA}={0000F5}={0000F0}={0000EB}={0000E6}={0000E1}={0000DC}={0000D7}={0000D2}={0000CD}={0000C8}={0000C3}={0000BE}={0000B9}={0000B4}={0000AF}={0000AA}={0000A5}={0000A0}={00009B}={000096}={000091}={00008C}={000087}={000082}={00007D}={000078}={000073}={00006E}={000069}={000064}={00005F}={00005A}={000055}={000050}={00004B}={000046}={000041}={00003C}={000037}={000032}={00002D}={000028}={000023}={00001E}={000019}={000014}={00000F}={00000A}={000005}={000000}="); 
PHP Code:
CreatePlayerTextDraw(playerid10.000000310.000000"{000000}F{000040}u{000080}l{0000C0}l {00AAAA}C{AAAA00}o{A000A0}l{444000}o{000444}u{444444}r {033300}T{066600}e{099900}x{0CCC00}t {000000}D{400000}r{800000}a{C00000}w{FF0000}s"); 
All TextDraw and PlayerTextDraw functions are hooked:

PHP Code:
        new Text:TextDrawCreate(120.000000300.000000"{00FF00}Hello World");
        
TextDrawFont(t0);
        
TextDrawFont(t3);
        
TextDrawTextSize(t200.0500.0);
        
TextDrawColor(t0x000000FF);
        
TextDrawSetProportional(t1);
        
TextDrawSetShadow(t0);
        
TextDrawAlignment(t1);
        
TextDrawBoxColor(t0x00FF00AA);
        
TextDrawUseBox(t1);
        
TextDrawShowForPlayer(playeridt); 
And this adds a new alignment:

PHP Code:
TextDrawAlignment(t4); 
This is like 3, but wraps correct.

Also more new functions:

PHP Code:
stock Text:TextDrawCreate(Float:xFloat:ytext[]);
stock TextDrawDestroy(Text:text);
stock TextDrawLetterSize(Text:textFloat:xFloat:y);
stock TextDrawTextSize(Text:textFloat:xFloat:y);
stock TextDrawAlignment(Text:textalignment);
stock TextDrawColor(Text:textcolor);
stock TextDrawUseBox(Text:text, use);
stock TextDrawBoxColor(Text:textcolor);
stock TextDrawSetShadow(Text:textsize);
stock TextDrawSetOutline(Text:textsize);
stock TextDrawBackgroundColor(Text:textcolor);
stock TextDrawFont(Text:textfont);
stock TextDrawSetProportional(Text:textset);
stock TextDrawSetSelectable(Text:textset);
stock TextDrawSetPos(Text:textFloat:xFloat:y);
stock TextDrawShowForPlayer(playeridText:text);
stock TextDrawHideForPlayer(playeridText:text);
stock TextDrawShowForAll(Text:text);
stock TextDrawHideForAll(Text:text);
stock TextDrawSetString(Text:textstring[]);
stock TextDrawSetPreviewModel(Text:textmodelindex);
stock TextDrawSetPreviewRot(Text:textFloat:fRotXFloat:fRotYFloat:fRotZFloat:fZoom 1.0);
stock TextDrawSetPreviewVehCol(Text:textcolor1color2);
stock bool:TextDrawGetLetterSize(Text:text, &Float:x, &Float:y);
stock bool:TextDrawGetTextSize(Text:text, &Float:x, &Float:y);
stock bool:TextDrawGetAlignment(Text:text, &alignment);
stock bool:TextDrawGetColor(Text:text, &color);
stock bool:TextDrawGetUseBox(Text:text, &bool:use);
stock bool:TextDrawGetBoxColor(Text:text, &color);
stock bool:TextDrawGetShadow(Text:text, &size);
stock bool:TextDrawGetOutline(Text:text, &size);
stock bool:TextDrawGetBackgroundColor(Text:text, &color);
stock bool:TextDrawGetFont(Text:text, &font);
stock bool:TextDrawGetProportional(Text:text, &bool:set);
stock bool:TextDrawGetSelectable(Text:text, &bool:set);
stock bool:TextDrawGetPos(Text:text, &Float:x, &Float:y);
stock bool:TextDrawGetString(Text:textstring[], size sizeof (string));
stock bool:TextDrawGetPreviewModel(Text:text, &modelindex);
stock bool:TextDrawGetPreviewRot(Text:text, &Float:fRotX, &Float:fRotY, &Float:fRotZ, &Float:fZoom 1.0);
stock bool:TextDrawGetPreviewVehCol(Text:text, &color1, &color2);
stock PlayerText:CreatePlayerTextDraw(playeridFloat:xFloat:ytext[]);
stock PlayerTextDrawDestroy(playeridPlayerText:text);
stock PlayerTextDrawLetterSize(playeridPlayerText:textFloat:xFloat:y);
stock PlayerTextDrawTextSize(playeridPlayerText:textFloat:xFloat:y);
stock PlayerTextDrawAlignment(playeridPlayerText:textalignment);
stock PlayerTextDrawColor(playeridPlayerText:textcolor);
stock PlayerTextDrawUseBox(playeridPlayerText:text, use);
stock PlayerTextDrawBoxColor(playeridPlayerText:textcolor);
stock PlayerTextDrawSetShadow(playeridPlayerText:textsize);
stock PlayerTextDrawSetOutline(playeridPlayerText:textsize);
stock PlayerTextDrawBackgroundColor(playeridPlayerText:textcolor);
stock PlayerTextDrawFont(playeridPlayerText:textfont);
stock PlayerTextDrawSetProportional(playeridPlayerText:textset);
stock PlayerTextDrawSetSelectable(playeridPlayerText:textset);
stock PlayerTextDrawSetPos(playeridPlayerText:textFloat:xFloat:y);
stock PlayerTextDrawShow(playeridPlayerText:text);
stock PlayerTextDrawHide(playeridPlayerText:text);
stock PlayerTextDrawSetString(playeridPlayerText:textstring[]);
stock PlayerTextDrawSetPreviewModel(playeridPlayerText:textmodelindex);
stock PlayerTextDrawSetPreviewRot(playeridPlayerText:textFloat:fRotXFloat:fRotYFloat:fRotZFloat:fZoom 1.0);
stock PlayerTextDrawSetPreviewVehCol(playeridPlayerText:textcolor1color2);
stock bool:PlayerTextDrawGetLetterSize(playeridPlayerText:text, &Float:x, &Float:y);
stock bool:PlayerTextDrawGetTextSize(playeridPlayerText:text, &Float:x, &Float:y);
stock bool:PlayerTextDrawGetAlignment(playeridPlayerText:text, &alignment);
stock bool:PlayerTextDrawGetColor(playeridPlayerText:text, &color);
stock bool:PlayerTextDrawGetUseBox(playeridPlayerText:text, &bool:use);
stock bool:PlayerTextDrawGetBoxColor(playeridPlayerText:text, &color);
stock bool:PlayerTextDrawGetShadow(playeridPlayerText:text, &size);
stock bool:PlayerTextDrawGetOutline(playeridPlayerText:text, &size);
stock bool:PlayerTDGetBackgroundColor(playeridPlayerText:text, &color);
stock bool:PlayerTextDrawGetFont(playeridPlayerText:text, &font);
stock bool:PlayerTextDrawGetProportional(playeridPlayerText:text, &bool:set);
stock bool:PlayerTextDrawGetSelectable(playeridPlayerText:text, &bool:set);
stock bool:PlayerTextDrawGetPos(playeridPlayerText:text, &Float:x, &Float:y);
stock bool:PlayerTextDrawGetString(playeridPlayerText:textstring[], size sizeof (string));
stock bool:PlayerTextDrawGetPreviewModel(playeridPlayerText:text, &modelindex);
stock bool:PlayerTextDrawGetPreviewRot(playeridPlayerText:text, &Float:fRotX, &Float:fRotY, &Float:fRotZ, &Float:fZoom 1.0);
stock bool:PlayerTextDrawGetPreviewVehCol(playeridPlayerText:text, &color1, &color2); 



Re: Coloured Text Draws - RogueDrifter - 03.01.2018

Now i understand what you meant, but wasn't that possible through formatting a string and setting the textdraw's string?


Re: Coloured Text Draws - OneDay - 03.01.2018

No. You can use ~g~ and ~r~ for colours, but not {00FF00} and {FF0000}. This: "{00FF00}Hello" becomes "?00FF00$Hello" and black before.


Re: Coloured Text Draws - RogueDrifter - 03.01.2018

Quote:
Originally Posted by OneDay
View Post
No. You can use ~g~ and ~r~ for colours, but not {00FF00} and {FF0000}. This: "{00FF00}Hello" becomes "?00FF00$Hello" and black before.
Ahaa, goodjob man this would be very useful when getting custom colors instead of using textdrawcolor, +rep in 24 hours... lol


Re: Coloured Text Draws - Admireal - 03.01.2018

Nice.
I will use.


Re: Coloured Text Draws - NatzuK - 02.06.2018

Nice.


Re: Coloured Text Draws - Gammix - 02.06.2018

I can see a good amount of effort put into this, good job!


Re: Coloured Text Draws - Verc - 03.06.2018

Do I have to change every textdraw that contains ~r~,~g~ or such to rgb code?


Re: Coloured Text Draws - GTLS - 03.06.2018

Wait, I thought textdraws and GameText are different. I think they probably work on same logic but to be clear, This thread would be called Custom Colored GameText not textdraws as Textdraws already uses RGB format while GameText dont.


Re: Coloured Text Draws - almiighty - 03.06.2018

Quote:
Originally Posted by GTLS
View Post
Wait, I thought textdraws and GameText are different. I think they probably work on same logic but to be clear, This thread would be called Custom Colored GameText not textdraws as Textdraws already uses RGB format while GameText dont.
are you dumb?

No. You can use ~g~ and ~r~ for colours, but not {00FF00} and {FF0000}. This: "{00FF00}Hello" becomes "?00FF00$Hello" and black before.