SA-MP Forums Archive
How to make transparent textdraws - 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: How to make transparent textdraws (/showthread.php?tid=421417)



How to make transparent textdraws - Saadat - 09.03.2013

I have these text draws, for my server. Used everywhere, not only this. Every Menu.



How Can I make them transparent?
What is the color code for transparent?

my textdraws:
Код:
	///////////////
	//^ Textdraws//
	//|          //
	//|          //
	//Y	X----->  //
	///////////////

	Clock = TextDrawCreate(549.0, 24.0, "00:00");
	TextDrawLetterSize(Clock, 0.55, 2.0);
	TextDrawFont(Clock, 3);
	TextDrawBackgroundColor(Clock, 0x000000AA);
	TextDrawSetOutline(Clock, 2);

	DaysOfWeek = TextDrawCreate(549.0, 7.0, WeekDays[GameDay]);
	TextDrawAlignment(DaysOfWeek, 1);
	TextDrawBackgroundColor(DaysOfWeek, 0x000000FF);
	TextDrawFont(DaysOfWeek, 2);
	TextDrawLetterSize(DaysOfWeek, 0.2999, 1.2);
	TextDrawColor(DaysOfWeek, 0xFFFFFFFF);
	TextDrawSetOutline(DaysOfWeek, 1);
	TextDrawSetProportional(DaysOfWeek, true);
	TextDrawSetShadow(DaysOfWeek, 1);

	Lotto1 = TextDrawCreate(334.000000, 281.000000, "~g~Daily Lottery Draw~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ");
	TextDrawAlignment(Lotto1, 2);
	TextDrawBackgroundColor(Lotto1, 255);
	TextDrawFont(Lotto1, 3);
	TextDrawLetterSize(Lotto1, 0.500000, 1.000000);
	TextDrawColor(Lotto1, -1);
	TextDrawSetOutline(Lotto1, 0);
	TextDrawSetProportional(Lotto1, 1);
	TextDrawSetShadow(Lotto1, 1);
	TextDrawUseBox(Lotto1, 1);
	TextDrawBoxColor(Lotto1, 255);
	TextDrawTextSize(Lotto1, 560.000000, 319.000000);

	Lotto2 = TextDrawCreate(330.000000, 302.000000, "Todays Number ~p~64 ~w~Jackpot ~g~$6982345");
	TextDrawAlignment(Lotto2, 2);
	TextDrawBackgroundColor(Lotto2, 255);
	TextDrawFont(Lotto2, 1);
	TextDrawLetterSize(Lotto2, 0.300000, 0.899999);
	TextDrawColor(Lotto2, -1);
	TextDrawSetOutline(Lotto2, 0);
	TextDrawSetProportional(Lotto2, 1);
	TextDrawSetShadow(Lotto2, 1);

	AdminAnnouncement = TextDrawCreate(319.000000, 181.000000, " ");
	TextDrawAlignment(AdminAnnouncement, 2);
	TextDrawBackgroundColor(AdminAnnouncement, 255);
	TextDrawFont(AdminAnnouncement, 3);
	TextDrawLetterSize(AdminAnnouncement, 1.099999, 2.499999);
	TextDrawColor(AdminAnnouncement, -1);
	TextDrawSetOutline(AdminAnnouncement, 0);
	TextDrawSetProportional(AdminAnnouncement, 1);
	TextDrawSetShadow(AdminAnnouncement, 1);


	// Create Intro textdraw for when a player joins the server:
	format(string, sizeof(string),  " ~n~~y~SirJohn's~n~~b~Cops ~w~And ~r~Robbers~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ");
	Intro0 = TextDrawCreate(319.000000, 119.000000, string);
	TextDrawAlignment(Intro0, 2);
	TextDrawBackgroundColor(Intro0, 255);
	TextDrawFont(Intro0, 3);
	TextDrawLetterSize(Intro0, 1.539999, 2.000000);
	TextDrawColor(Intro0, -1);
	TextDrawSetOutline(Intro0, 0);
	TextDrawSetProportional(Intro0, 1);
	TextDrawSetShadow(Intro0, 1);
	TextDrawUseBox(Intro0, 1);
	TextDrawBoxColor(Intro0, 255);
	TextDrawTextSize(Intro0, 586.000000, 530.000000);

	format(string, sizeof(string), "~g~%s", ServerInfo[sMapName]);
	Intro1 = TextDrawCreate(319.000000, 193.000000, string);
	TextDrawAlignment(Intro1, 2);
	TextDrawBackgroundColor(Intro1, 255);
	TextDrawFont(Intro1, 1);
	TextDrawLetterSize(Intro1, 0.719999, 1.199999);
	TextDrawColor(Intro1, -1);
	TextDrawSetOutline(Intro1, 0);
	TextDrawSetProportional(Intro1, 1);
	TextDrawSetShadow(Intro1, 1);

	Intro2 = TextDrawCreate(319.000000, 223.000000, "- This Is ~r~NOT ~w~a Deathmatch Server.~n~- Do ~r~NOT ~w~Attack People For No Reason~n~Or You Will Be Kicked / Banned~n~- Respect Admins And Other Players~n~ ~n~- Type ~y~/help ~w~For Help And Game Information.~n~- Type ~y~/rules ~w~For Server Rules");
	TextDrawAlignment(Intro2, 2);
	TextDrawBackgroundColor(Intro2, 255);
	TextDrawFont(Intro2, 1);
	TextDrawLetterSize(Intro2, 0.449999, 1.200000);
	TextDrawColor(Intro2, -1);
	TextDrawSetOutline(Intro2, 0);
	TextDrawSetProportional(Intro2, 1);
	TextDrawSetShadow(Intro2, 1);

	format(string, sizeof(string), "~y~Version %s", VERSION);
	Intro3 = TextDrawCreate(310.000000, 315.000000, string);
	TextDrawAlignment(Intro3, 2);
	TextDrawBackgroundColor(Intro3, 255);
	TextDrawFont(Intro3, 1);
	TextDrawLetterSize(Intro3, 0.639999, 1.300000);
	TextDrawColor(Intro3, -1);
	TextDrawSetOutline(Intro3, 0);
	TextDrawSetProportional(Intro3, 1);
	TextDrawSetShadow(Intro3, 1);

	format(string, sizeof(string), "~b~%s", WEBSITE);
	Intro4 = TextDrawCreate(315.000000, 344.000000, string);
	TextDrawAlignment(Intro4, 2);
	TextDrawBackgroundColor(Intro4, 255);
	TextDrawFont(Intro4, 3);
	TextDrawLetterSize(Intro4, 0.790000, 1.400000);
	TextDrawColor(Intro4, -1);
	TextDrawSetOutline(Intro4, 0);
	TextDrawSetProportional(Intro4, 1);
	TextDrawSetShadow(Intro4, 1);


   	for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
	{

	ZoneName[playerid] = TextDrawCreate(31.0, 429.0, " ");
	TextDrawAlignment(ZoneName[playerid],1);
	TextDrawFont(ZoneName[playerid],1);
	TextDrawLetterSize(ZoneName[playerid],0.280000,1.100000);
	TextDrawSetOutline(ZoneName[playerid],1);
	TextDrawSetProportional(ZoneName[playerid],1);
	TextDrawSetShadow(ZoneName[playerid],1);

	StatsDisplay[playerid] = TextDrawCreate(574.000000, 382.000000, "~b~Courier Mission ~w~- Time: ~g~00:00");
	TextDrawAlignment(StatsDisplay[playerid], 2);
	TextDrawBackgroundColor(StatsDisplay[playerid], 255);
	TextDrawFont(StatsDisplay[playerid], 1);
	TextDrawLetterSize(StatsDisplay[playerid], 0.230000, 1.300000);
	TextDrawColor(StatsDisplay[playerid], -1);
	TextDrawSetOutline(StatsDisplay[playerid], 0);
	TextDrawSetProportional(StatsDisplay[playerid], 1);
	TextDrawSetShadow(StatsDisplay[playerid], 1);

	SpeedoDisplay[playerid] = TextDrawCreate(587.000000, 422.000000, " ");
	TextDrawAlignment(SpeedoDisplay[playerid], 2);
	TextDrawBackgroundColor(SpeedoDisplay[playerid], 255);
	TextDrawFont(SpeedoDisplay[playerid], 1);
	TextDrawLetterSize(SpeedoDisplay[playerid], 0.340000, 1.200000);
	TextDrawColor(SpeedoDisplay[playerid], -1);
	TextDrawSetOutline(SpeedoDisplay[playerid], 0);
	TextDrawSetProportional(SpeedoDisplay[playerid], 1);
	TextDrawSetShadow(SpeedoDisplay[playerid], 1);

	AnnouncementToPlayer[playerid] = TextDrawCreate(319.000000, 181.000000, " ");
	TextDrawAlignment(AnnouncementToPlayer[playerid], 2);
	TextDrawBackgroundColor(AnnouncementToPlayer[playerid], 255);
	TextDrawFont(AnnouncementToPlayer[playerid], 3);
	TextDrawLetterSize(AnnouncementToPlayer[playerid], 1.099999, 2.499999);
	TextDrawColor(AnnouncementToPlayer[playerid], -1);
	TextDrawSetOutline(AnnouncementToPlayer[playerid], 0);
	TextDrawSetProportional(AnnouncementToPlayer[playerid], 1);
	TextDrawSetShadow(AnnouncementToPlayer[playerid], 1);


	format(TextDrawAdMessageStr[playerid][0], 256, " ");
	format(TextDrawAdMessageStr[playerid][1], 256, " ");
	format(TextDrawAdMessageStr[playerid][2], 256, " ");

    TextDrawAdMessage[playerid][0] = TextDrawCreate(342.000000, 400.000000, TextDrawAdMessageStr[playerid][0]);
	TextDrawAlignment(TextDrawAdMessage[playerid][0],2);
	TextDrawFont(TextDrawAdMessage[playerid][0],1);
	TextDrawLetterSize(TextDrawAdMessage[playerid][0],0.280000,1.100000);
	TextDrawSetOutline(TextDrawAdMessage[playerid][0],1);
	TextDrawSetProportional(TextDrawAdMessage[playerid][0],1);
	TextDrawSetShadow(TextDrawAdMessage[playerid][0],1);

	TextDrawAdMessage[playerid][1] = TextDrawCreate(342.000000, 377.000000, TextDrawAdMessageStr[playerid][1]);
	TextDrawAlignment(TextDrawAdMessage[playerid][1],2);
	TextDrawFont(TextDrawAdMessage[playerid][1],1);
	TextDrawLetterSize(TextDrawAdMessage[playerid][1],0.280000,1.100000);
	TextDrawSetOutline(TextDrawAdMessage[playerid][1],1);
	TextDrawSetProportional(TextDrawAdMessage[playerid][1],1);
	TextDrawSetShadow(TextDrawAdMessage[playerid][1],1);

	TextDrawAdMessage[playerid][2] = TextDrawCreate(342.000000, 356.000000, TextDrawAdMessageStr[playerid][2]);
	TextDrawAlignment(TextDrawAdMessage[playerid][2],2);
	TextDrawFont(TextDrawAdMessage[playerid][2],1);
	TextDrawLetterSize(TextDrawAdMessage[playerid][2],0.280000,1.100000);
	TextDrawSetOutline(TextDrawAdMessage[playerid][2],1);
	TextDrawSetProportional(TextDrawAdMessage[playerid][2],1);
	TextDrawSetShadow(TextDrawAdMessage[playerid][2],1);



	Menu_Title[playerid] = TextDrawCreate(116.000000, 120.000000, " ");
	TextDrawAlignment(Menu_Title[playerid], 2);
	TextDrawBackgroundColor(Menu_Title[playerid], 255);
	TextDrawFont(Menu_Title[playerid], 3);
	TextDrawLetterSize(Menu_Title[playerid], 0.509999, 1.400000);
	TextDrawColor(Menu_Title[playerid], -1);
	TextDrawSetOutline(Menu_Title[playerid], 0);
	TextDrawSetProportional(Menu_Title[playerid], 1);
	TextDrawSetShadow(Menu_Title[playerid], 1);
	TextDrawUseBox(Menu_Title[playerid], 1);
	TextDrawBoxColor(Menu_Title[playerid], 255);
	TextDrawTextSize(Menu_Title[playerid], 23.000000, 206.000000);

	Menu_Stats[playerid] = TextDrawCreate(115.000000, 162.000000, " ");
	TextDrawAlignment(Menu_Stats[playerid], 2);
	TextDrawBackgroundColor(Menu_Stats[playerid], 255);
	TextDrawFont(Menu_Stats[playerid], 1);
	TextDrawLetterSize(Menu_Stats[playerid], 0.240000, 1.200000);
	TextDrawColor(Menu_Stats[playerid], -1);
	TextDrawSetOutline(Menu_Stats[playerid], 0);
	TextDrawSetProportional(Menu_Stats[playerid], 1);
	TextDrawSetShadow(Menu_Stats[playerid], 1);

	Menu_StatsCont[playerid] = TextDrawCreate(115.000000, 162.000000, " ");
	TextDrawAlignment(Menu_StatsCont[playerid], 2);
	TextDrawBackgroundColor(Menu_StatsCont[playerid], 255);
	TextDrawFont(Menu_StatsCont[playerid], 1);
	TextDrawLetterSize(Menu_StatsCont[playerid], 0.240000, 1.200000);
	TextDrawColor(Menu_StatsCont[playerid], -1);
	TextDrawSetOutline(Menu_StatsCont[playerid], 0);
	TextDrawSetProportional(Menu_StatsCont[playerid], 1);
	TextDrawSetShadow(Menu_StatsCont[playerid], 1);

	Menu_End[playerid] = TextDrawCreate(115.000000, 202.000000, " ");
	TextDrawAlignment(Menu_End[playerid], 2);
	TextDrawBackgroundColor(Menu_End[playerid], 255);
	TextDrawFont(Menu_End[playerid], 1);
	TextDrawLetterSize(Menu_End[playerid], 0.240000, 1.200000);
	TextDrawColor(Menu_End[playerid], -1);
	TextDrawSetOutline(Menu_End[playerid], 0);
	TextDrawSetProportional(Menu_End[playerid], 1);
	TextDrawSetShadow(Menu_End[playerid], 1);



	new Float:ChatBoxY = 162.000000;

    for(new r = 0; r < MAX_TEXTDRAW_ROWS; r++)
	{

	Menu_Column1[playerid][r] = TextDrawCreate(22.000000, ChatBoxY, "~y~1 ~w~- ~g~Item 1");
	TextDrawBackgroundColor(Menu_Column1[playerid][r], 255);
	TextDrawFont(Menu_Column1[playerid][r], 1);
	TextDrawLetterSize(Menu_Column1[playerid][r], 0.240000, 1.200000);
	TextDrawColor(Menu_Column1[playerid][r], -1);
	TextDrawSetOutline(Menu_Column1[playerid][r], 0);
	TextDrawSetProportional(Menu_Column1[playerid][r], 1);
	TextDrawSetShadow(Menu_Column1[playerid][r], 1);

	Menu_Column2[playerid][r] = TextDrawCreate(162.000000, ChatBoxY, "~b~$100000000");
	TextDrawBackgroundColor(Menu_Column2[playerid][r], 255);
	TextDrawFont(Menu_Column2[playerid][r], 1);
	TextDrawLetterSize(Menu_Column2[playerid][r], 0.240000, 1.200000);
	TextDrawColor(Menu_Column2[playerid][r], -1);
	TextDrawSetOutline(Menu_Column2[playerid][r], 0);
	TextDrawSetProportional(Menu_Column2[playerid][r], 1);
	TextDrawSetShadow(Menu_Column2[playerid][r], 1);

	ChatBoxY += 10.000000;
 	//printf("%f",ChatBoxY);
	}




	// Create Middle textdraw For /help /rules /tutorial:
	MediumTextdraw0[playerid] = TextDrawCreate(330.000000, 103.000000, " ~n~~b~SirJohn's ~w~Cops~n~and Robbers~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ");
	TextDrawAlignment(MediumTextdraw0[playerid], 2);
	TextDrawBackgroundColor(MediumTextdraw0[playerid], 255);
	TextDrawFont(MediumTextdraw0[playerid], 3);
	TextDrawLetterSize(MediumTextdraw0[playerid], 1.229998, 2.000000);
	TextDrawColor(MediumTextdraw0[playerid], -1);
	TextDrawSetOutline(MediumTextdraw0[playerid], 0);
	TextDrawSetProportional(MediumTextdraw0[playerid], 1);
	TextDrawSetShadow(MediumTextdraw0[playerid], 1);
	TextDrawUseBox(MediumTextdraw0[playerid], 1);
	TextDrawBoxColor(MediumTextdraw0[playerid], 255);
	TextDrawTextSize(MediumTextdraw0[playerid], 605.000000, 408.000000);

	MediumTextdraw1[playerid] = TextDrawCreate(322.000000, 174.000000, "~r~SERVER RULES");
	TextDrawAlignment(MediumTextdraw1[playerid], 2);
	TextDrawBackgroundColor(MediumTextdraw1[playerid], 255);
	TextDrawFont(MediumTextdraw1[playerid], 1);
	TextDrawLetterSize(MediumTextdraw1[playerid], 0.719999, 1.199998);
	TextDrawColor(MediumTextdraw1[playerid], -1);
	TextDrawSetOutline(MediumTextdraw1[playerid], 0);
	TextDrawSetProportional(MediumTextdraw1[playerid], 1);
	TextDrawSetShadow(MediumTextdraw1[playerid], 1);

	MediumTextdraw2[playerid] = TextDrawCreate(321.000000, 201.000000, "- This Is ~r~NOT ~w~a Deathmatch Server.");
	TextDrawAlignment(MediumTextdraw2[playerid], 2);
	TextDrawBackgroundColor(MediumTextdraw2[playerid], 255);
	TextDrawFont(MediumTextdraw2[playerid], 1);
	TextDrawLetterSize(MediumTextdraw2[playerid], 0.419999, 1.000000);
	TextDrawColor(MediumTextdraw2[playerid], -1);
	TextDrawSetOutline(MediumTextdraw2[playerid], 0);
	TextDrawSetProportional(MediumTextdraw2[playerid], 1);
	TextDrawSetShadow(MediumTextdraw2[playerid], 1);

	MediumTextdraw3[playerid] = TextDrawCreate(321.000000, 201.000000, "- This Is ~r~NOT ~w~a Deathmatch Server.");
	TextDrawAlignment(MediumTextdraw3[playerid], 2);
	TextDrawBackgroundColor(MediumTextdraw3[playerid], 255);
	TextDrawFont(MediumTextdraw3[playerid], 1);
	TextDrawLetterSize(MediumTextdraw3[playerid], 0.419999, 1.000000);
	TextDrawColor(MediumTextdraw3[playerid], -1);
	TextDrawSetOutline(MediumTextdraw3[playerid], 0);
	TextDrawSetProportional(MediumTextdraw3[playerid], 1);
	TextDrawSetShadow(MediumTextdraw3[playerid], 1);



	// Create Small textdraw for /version:
	SmallTextdraw0[playerid] = TextDrawCreate(360.000000, 193.000000, " ~n~~b~SirJohn's ~w~Cops and Robbers~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ");
	TextDrawAlignment(SmallTextdraw0[playerid], 2);
	TextDrawBackgroundColor(SmallTextdraw0[playerid], 255);
	TextDrawFont(SmallTextdraw0[playerid], 3);
	TextDrawLetterSize(SmallTextdraw0[playerid], 0.589996, 1.599998);
	TextDrawColor(SmallTextdraw0[playerid], -1);
	TextDrawSetOutline(SmallTextdraw0[playerid], 0);
	TextDrawSetProportional(SmallTextdraw0[playerid], 1);
	TextDrawSetShadow(SmallTextdraw0[playerid], 1);
	TextDrawUseBox(SmallTextdraw0[playerid], 1);
	TextDrawBoxColor(SmallTextdraw0[playerid], 255);
	TextDrawTextSize(SmallTextdraw0[playerid], 585.000000, 329.000000);

	SmallTextdraw1[playerid] = TextDrawCreate(359.000000, 237.000000, " ~n~ ~n~ ~n~ ~n~~b~www.crazybobs.net");
	TextDrawAlignment(SmallTextdraw1[playerid], 2);
	TextDrawBackgroundColor(SmallTextdraw1[playerid], 255);
	TextDrawFont(SmallTextdraw1[playerid], 2);
	TextDrawLetterSize(SmallTextdraw1[playerid], 0.469999, 2.099999);
	TextDrawColor(SmallTextdraw1[playerid], -1);
	TextDrawSetOutline(SmallTextdraw1[playerid], 0);
	TextDrawSetProportional(SmallTextdraw1[playerid], 1);
	TextDrawSetShadow(SmallTextdraw1[playerid], 1);

	SmallTextdraw2[playerid] = TextDrawCreate(361.000000, 240.000000, "This is ~r~NOT ~w~a Deathmatch Server.~n~Do ~r~NOT ~w~Attack People For No Reason~n~Or You Will Be Kicked / Banned~n~ ");
	TextDrawAlignment(SmallTextdraw2[playerid], 2);
	TextDrawBackgroundColor(SmallTextdraw2[playerid], 255);
	TextDrawFont(SmallTextdraw2[playerid], 1);
	TextDrawLetterSize(SmallTextdraw2[playerid], 0.359999, 1.000000);
	TextDrawColor(SmallTextdraw2[playerid], -1);
	TextDrawSetOutline(SmallTextdraw2[playerid], 0);
	TextDrawSetProportional(SmallTextdraw2[playerid], 1);
	TextDrawSetShadow(SmallTextdraw2[playerid], 1);

	}
Please Help...


Re: How to make transparent textdraws - Threshold - 09.03.2013

There are such things called 'Alpha' values, which are added onto the end of a hexadecimal value such as 0xFF0000FF, where the final two characters/numbers (in this case, FF), are alpha values, and determine the amount of transparency. FF being no transparency, 00 being complete transparency.

Read this for more info on alpha values.
https://sampwiki.blast.hk/wiki/Colors#Al...ransparency.29

For the kind of transparency you're requesting, I would recommend from a 6-8 (66 or 8
So, simply change this line:
pawn Код:
TextDrawBackgroundColor(Intro0, 255);
To this:
pawn Код:
TextDrawBackgroundColor(Intro0, 0x00000077);
"0x000000" represents the color black. The 77 is the alpha values, determining the transparency. If this is TOO TRANSPARENT, increase the number to 88 or 99, after 99 comes AA, then BB etc. (FF being the maximum). If, however, the textdraw is NOT TRANSPARENT ENOUGH, you can decrease the value to 55 or 44. (00 being the minimum/basically no background is visible)

Good luck, I hope I've at least pointed you in the right direction.


Re: How to make transparent textdraws - Bennyy - 09.03.2013

Thanks Benzo Really helped me out - hope it helped the OP


Re: How to make transparent textdraws - Saadat - 09.03.2013

Thanks a lot BenzoAMG.
You Helped me a lot. (PROBLEM NOT FIXED THOUGH)
But you showed me the what to do. Now I can try to fix this.