SA-MP Forums Archive
How to make textdraw appear randomly - 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: How to make textdraw appear randomly (/showthread.php?tid=150653)



How to make textdraw appear randomly - GamerZPro - 27.05.2010

How do i make random textdraw appear on the screen for every player. Kinda like Announcement system. It need to be easy to put a new line. :P

This is my current code, but it not appearing in my game.
Код:
#include <a_samp>
new Text:Text;

public OnFilterScriptInit()
{
	new var0[128];
	format(var0, 128, " ");
 	Text = TextDrawCreate(84.000000, 437.000000, var0);
 	TextDrawLetterSize(Text, 0.430000, 1.000000);
	TextDrawSetOutline(Text, 1);
	TextDrawFont(Text, 1);
	TextDrawColor(Text, -1);
	TextDrawSetOutline(Text, 0);
	TextDrawSetProportional(Text, 1);
	TextDrawSetShadow(Text, 1);
	SetTimer("TextDraw", 5000, true);

	return 1;
} //add this under ongamemodeinit

new aMessage[4][128] =
{
  {"Announcement 1"},
  {"Announcement 2"},
  {"Announcement 3"},
  {"Announcement 4"}
};

forward Timer();
public Timer() //SetTimer OnGameModeInit
{
  TextDrawSetString(Text:Text, aMessage[random(sizeof(aMessage))]);
  TextDrawShowForAll(Text:Text);
}



Re: How to make textdraw appear randomly - Bomber - 27.05.2010

OnPlayerConnect or OnPlayerSpawn:
TextDrawShowForPlayer(playerid, Text);


Re: How to make textdraw appear randomly - Conroy - 27.05.2010

It's not showing in game because you have the public declaration named to 'Timer', and the SetTimer is directed to 'TextDraw'.

Change the SetTimer to SetTimer("Timer", 5000, true);


Re: How to make textdraw appear randomly - Bomber - 27.05.2010

Quote:
Originally Posted by Conroy
It's not showing in game because you have the public declaration named to 'Timer', and the SetTimer is directed to 'TextDraw'.

Change the SetTimer to SetTimer("Timer", 5000, true);
Yea, you must change this too, then it should work.


Re: How to make textdraw appear randomly - GamerZPro - 27.05.2010

Thanks guys, its working now. :P :P