SA-MP Forums Archive
Help with Dynamic TextDraw - 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: Help with Dynamic TextDraw (/showthread.php?tid=101957)



Help with Dynamic TextDraw - simstosh - 12.10.2009

Hi. I'm editing my GF script.
I have an idea to create a Advertisement with text draw, and when a user uses /ad blablabla, he changes the text of the variable and shows the new advertisement. I see this on a server.
But i'm trying to add a Textdraw on GM but she doesn't show for players. I've tried TextDrawShowForPlayer, TextDrawShowForAll, i've created commands to do this, put the codes on OnGameModeInit, OnPlayerSpawn, etc, but only unsucessful tries.

Код:
new adtext[256];
new adcmd[256];
new AdAvailable;
new ShowAds[MAX_PLAYERS];
new Text:advertisement;
forward UpdateAdvertisement();
Код:
public OnPlayerSpawn(playerid)
{
	format(adcmd, sizeof(adcmd), "Anuncie! Venha ate o ABC Studio e faca seu anuncio!");
	format(adtext, sizeof(adtext), "%s", adcmd);
	advertisement = TextDrawCreate(136, 455, adtext);
	TextDrawUseBox(advertisement, 0);
	TextDrawFont(advertisement, 1);
	TextDrawSetShadow(advertisement,0);
	TextDrawSetOutline(advertisement,1);
	TextDrawBackgroundColor(advertisement,0x008700FF);
	TextDrawColor(advertisement,0xFFFFFFFF);
	TextDrawShowForPlayer(playerid, advertisement);
Код:
AD command
...
			SafeGivePlayerMoney(playerid, - payout);
			SBizzInfo[7][sbTill] += payout;
			ExtortionSBiz(7, payout);
			format(adcmd, sizeof(adcmd), "Anuncio: %s | Tel: %d", result, PlayerInfo[playerid][pPnumber]);
			//OOCNews(TEAM_GROVE_COLOR,string);
			format(string, sizeof(string), "~r~Pagou $%d~n~~w~Mensagem: %d Caracteres", payout, idx);
			GameTextForPlayer(playerid, string, 5000, 1);
			SetTimer("UpdateAdvertisement", 60000, 0);
Код:
public UpdateAdvertisement()
{
	format(adcmd, 256, "Anuncie! Venha ate o ABC Studio e faca seu anuncio!");
}
Anybody helps me? (Textdraws aren't show :/)


Re: Help with Dynamic TextDraw - simstosh - 13.10.2009

I've edited, added and fixing some things. The Textdraw doesn't show because the invalid values of his position.
And i've made more changes to update the textdraw (destroy/create, etc).

Now is working.