SA-MP Forums Archive
[Tutorial] How to make Texdraw random messages! - 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: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] How to make Texdraw random messages! (/showthread.php?tid=423720)



How to make Texdraw random messages! - Beljulji - 19.03.2013

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.


Re: How to make Texdraw random messages! - Gamer_007 - 19.03.2013

This Tut. was already posted.anyway,Nice


Re: How to make Texdraw random messages! - Beljulji - 19.03.2013

Quote:
Originally Posted by Gamer_007
View Post
This Tut. was already posted.anyway,Nice
well i didnt know what tutorial to make so i made this one even i know that there is another one!


Re: How to make Texdraw random messages! - qazwsx - 23.07.2013

Hahaha another good tutorial here
Thanks mane


Re: How to make Texdraw random messages! - MiFi - 24.07.2013

Good job!