SA-MP Forums Archive
TextDraw fight? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: TextDraw fight? (/showthread.php?tid=238716)



TextDraw fight? - Mmartin - 12.03.2011

Hello Ladies and Gentlemen! (Oh, more less Gentlemen ).
So, i have textdraw in "OnGameModeInit" called by TDShowForAll.
Then, i have td in command /td <id> <text>.
When i type /td, the textdraw from ongamemodeinit is invisible. But why? I have two variables for textdraws.
Video: (ignore the music, The Lonely Island rocks! ) [ame]http://www.youtube.com/watch?v=Et5SBvcyats[/ame]
Codes:

OnGameModeInit
[code]TextDrawDestroy(web);
web = TextDrawCreate(500,5,"www.lila.net");
TextDrawUseBox(web, 0);
TextDrawBoxColor(web, 0x00000055);
TextDrawTextSize(web,600,100);
TextDrawFont(web, 1);
TextDrawSetShadow(web,1); // no shadow
TextDrawSetOutline(web,3); // thickness 1
TextDrawBackgroundColor(web,0x000000FF);
TextDrawColor(web,0xFFFFFFFF);
TextDrawAlignment(web,1);
TextDrawLetterSize(web,0.5,1.5);
TextDrawShowForAll(web);
[code]
/td
Код:
dcmd_td(playerid,params[])
	{
	     new ID = strval(params);
	     new par = chrfind(' ',params) + 1;
	     new str[200];
	     if(!params[0] || !par || !params[par]) return hlaska(playerid,"Show TextDraw: /td <id> <text>");
	     if(!IsPlayerConnected(ID)) return hlaska(playerid,"Invalid Playerid!");
	     format(str,200,params[par]);
		 MyTextdraw(ID,str,10);
	     printf("[TD]Admin: %s | Player: %s | Text: %s",meno(playerid),meno(ID),params[par]);
	     return 1;
	}
MyTextdraw:
Код:
stock MyTextdraw(playerid,text[],time)
		{
		   				TextDrawHideForPlayer(playerid,PlayerTextdraw[playerid]);
				        TextDrawDestroy(PlayerTextdraw[playerid]);
						PlayerTextdraw[playerid] = TextDrawCreate(500,220,text);
						TextDrawUseBox(PlayerTextdraw[playerid], 1);
						TextDrawBoxColor(PlayerTextdraw[playerid], 0x00000055);
						TextDrawTextSize(PlayerTextdraw[playerid],600,100);
						TextDrawFont(PlayerTextdraw[playerid], 1);
						TextDrawSetShadow(PlayerTextdraw[playerid],0); // no shadow
					    TextDrawSetOutline(PlayerTextdraw[playerid],1); // thickness 1
					    TextDrawBackgroundColor(PlayerTextdraw[playerid],0x00000055);
					    TextDrawColor(PlayerTextdraw[playerid],0xFFFFFFFF);
					    TextDrawAlignment(PlayerTextdraw[playerid],1);
						TextDrawLetterSize(PlayerTextdraw[playerid],0.3,1.3);
						TextDrawShowForPlayer(playerid,PlayerTextdraw[playerid]);
						TextDrawTimer[playerid]=time;
		}
Any idea?


Re: TextDraw fight? - iMonk3y - 12.03.2011

"(Oh, more less Gentlemen)" Where's the equality?

Firstly, TextDrawDestroy(web); should be under OnGameModeExit() callback.

Secondly, TextDrawShowForAll(web); won't show for anyone, since it's under OnGameModeInit() which is called when a gamemode starts - there's no-one online at that time.
Add TextDrawShowForPlayer(playerid, web); under OnPlayerConnect().

I didn't enter too deep into your code.. The rest is in your hands..


Re: TextDraw fight? - Mmartin - 12.03.2011

Oh, sorry dude, equality on first place, i know... Peace!
So, I gave it to OnPlayerConnect, but it still doesn't work. It's the same Still, when I call MyTextdraw, web disappears. I have no idea to solve this problem.

But thanks for help so much


Re: TextDraw fight? - iMonk3y - 12.03.2011

Oh another thing, you don't need to destroy textdraw, use TextDrawSetString instead.


Re: TextDraw fight? - Mmartin - 12.03.2011

Quote:
Originally Posted by iMonk3y
Посмотреть сообщение
Oh another thing, you don't need to destroy textdraw, use TextDrawSetString instead.
Aaaaw, awesome! Thanks Now it works perfectly!
Thank you so much, again