19.03.2013, 03:06
1. We need to define timer:
2. We need to define texdraw:
3.Now we need to define messages that will show for players:
4. Now timer, add this code under OnGameModeInit:
5. Put this code under OnGameModeInit:
6.Now add public function for timer, add it anywhere you want.
7. And Finally last step is make messages show when player connect or spawn.
Hope i helped you, anyway this is my first tut so maybe im not so good at this for now.
Code:
forward RandomMessage();
Code:
new Text:randommsg;
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. };
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
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);
Code:
public RandomMessage() { TextDrawSetString(randommsg, RandomMessages[random(sizeof(RandomMessages))]); // without this timer wont work! return 1; }
Code:
TextDrawShowForPlayer(playerid, randommsg); // add this under OnPlayerSpawn (you can add it under OnPlayerConnect too!)