How to make textdraw appear randomly
#1

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);
}
Reply
#2

OnPlayerConnect or OnPlayerSpawn:
TextDrawShowForPlayer(playerid, Text);
Reply
#3

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);
Reply
#4

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.
Reply
#5

Thanks guys, its working now. :P :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)