[Tutorial] How to make Texdraw random messages!
#1

1. We need to define timer:

Code:
forward RandomMessage();
2. We need to define texdraw:

Code:
new Text:randommsg;
3.Now we need to define messages that will show for players:

Code:
new RandomMessages[][] =
{
    "~g~Message1",
    "~r~Message2",
    "~y~Message3",
    "~b~Message4"
 // You can add more messages but just make shure that you have "," everywhere just not on last message.
};
4. Now timer, add this code under OnGameModeInit:

Code:
SetTimer("RandomMessage",60000,1); // 60000 is for 1 Minute, if you want more or less seconds change "60000" to number you want 1 second = 1000 miliseconds
5. Put this code under OnGameModeInit:

Code:
randommsg = TextDrawCreate(7.000000, 427.000000, "");
TextDrawBackgroundColor(randommsg, 255);
TextDrawFont(randommsg, 1);
TextDrawLetterSize(randommsg, 0.379999, 1.499999);
TextDrawColor(randommsg, -1);
TextDrawSetOutline(randommsg, 1);
TextDrawSetProportional(randommsg, 1);
6.Now add public function for timer, add it anywhere you want.

Code:
public RandomMessage()
{
        TextDrawSetString(randommsg, RandomMessages[random(sizeof(RandomMessages))]); // without this timer wont work!
        return 1;
}
7. And Finally last step is make messages show when player connect or spawn.

Code:
TextDrawShowForPlayer(playerid, randommsg); // add this under OnPlayerSpawn (you can add it under OnPlayerConnect too!)
Hope i helped you, anyway this is my first tut so maybe im not so good at this for now.
Reply


Messages In This Thread
How to make Texdraw random messages! - by Beljulji - 19.03.2013, 03:06
Re: How to make Texdraw random messages! - by Gamer_007 - 19.03.2013, 04:38
Re: How to make Texdraw random messages! - by Beljulji - 19.03.2013, 05:34
Re: How to make Texdraw random messages! - by qazwsx - 23.07.2013, 06:14
Re: How to make Texdraw random messages! - by MiFi - 24.07.2013, 12:20

Forum Jump:


Users browsing this thread: 1 Guest(s)