22.03.2012, 07:25
(
Последний раз редактировалось Dripac; 22.03.2012 в 08:23.
)
Random Messages - Textdraws
First of all we have to define the following things: Add the codes anywhere at the top of your script
Then we have to define the textdraw
Now we have to define all the messages which will show for the players
You can change it to colors you like, look here for the color names
https://sampwiki.blast.hk/wiki/Colors_List
------------------------------------------------------------------------
Now we have to add the timer, you can define for how long time a message will stay
Add the following codes under OnGameModeInit
Now we have to add the textdraw, put this also under OnGameModeInit
If you don't like this textdraw, you can make your own by using a editor
--------------------------------------------------
Now we have to make a public function for the timer, add this anywhere in your gamemode, for example i have it above OnGameModeInit
Now to show the textdraw for the players add the following under OnPlayerSpawn
You can also add it under OnPlayerConnect
You can see an example how it will looks like on my ******* channel, http://www.*******.com/user/sunsetcityrp
Thats it, hope i helped
First of all we have to define the following things: Add the codes anywhere at the top of your script
pawn Код:
forward RandomMessage(); // This is the forward for the timer
pawn Код:
new Text:randommsg; // This is to define the textdraw that we are going to use
pawn Код:
new RandomMessages[][] =
{
"~y~Community Name: ~w~Your Text ~g~here.",
"~y~Community Name: ~w~Your Text ~r~here.",
"~y~Community Name: ~w~Your Text ~y~here.",
"~y~Community Name: ~w~Your Text ~b~here."
// You can define more messages, but make sure you have , everywhere, except at the last message
};
https://sampwiki.blast.hk/wiki/Colors_List
------------------------------------------------------------------------
Now we have to add the timer, you can define for how long time a message will stay
Add the following codes under OnGameModeInit
pawn Код:
SetTimer("RandomMessage",8000,1); // 8000 is for 8 seconds, if you want 50 seconds use 50000
pawn Код:
randommsg = TextDrawCreate(7.000000, 427.000000, "You don't need to add any text here");
TextDrawBackgroundColor(randommsg, 255);
TextDrawFont(randommsg, 1);
TextDrawLetterSize(randommsg, 0.379999, 1.499999);
TextDrawColor(randommsg, -1);
TextDrawSetOutline(randommsg, 1);
TextDrawSetProportional(randommsg, 1);
--------------------------------------------------
Now we have to make a public function for the timer, add this anywhere in your gamemode, for example i have it above OnGameModeInit
pawn Код:
public RandomMessage()
{
TextDrawSetString(randommsg, RandomMessages[random(sizeof(RandomMessages))]); // We need this to make the timer working
return 1;
}
pawn Код:
TextDrawShowForPlayer(playerid, randommsg);
You can see an example how it will looks like on my ******* channel, http://www.*******.com/user/sunsetcityrp
Thats it, hope i helped