11.12.2010, 17:11
(
Последний раз редактировалось [MWR]Blood; 12.12.2010 в 17:17.
)
Hello, I was bored as hell and I decided to make a tutorial about how to make a simple helpbot (as textdraw)
For first, let's define the textdraw.
Great! Now let's create the messages that you want to appear.
Well done!
After that, we will have to create the textdraw.
Very nice!
We just created the textdraw.
What now? We should create a public function which displays randomly the messages.
Almost done!
Now, let's set a timer which will change the messages.
The final thing: Now we have to show the textdraw to the player!
Put the following code after OnPlayerConnect, or after OnPlayerSpawn.
We're done!
For first, let's define the textdraw.
pawn Код:
new Text:Txt;
pawn Код:
new HelpBot[][]=
{
"Add <IP Here> To your favourites!",
"Visit our forums at ...",
"Read the /rules before playing",
"If you're a newbie here, please read /help"
};
After that, we will have to create the textdraw.
pawn Код:
Txt = TextDrawCreate(2.000000, 429.000000, " ");
TextDrawAlignment(Txt, 0);
TextDrawBackgroundColor(Txt, 0xffffff33);
TextDrawFont(Txt, 1);
TextDrawLetterSize(Txt, 0.299999, 1.300000);
TextDrawColor(Txt, 0x0000ff99);
TextDrawSetOutline(Txt, 1);
TextDrawSetProportional(Txt, 1);
TextDrawSetShadow(Txt, 1);
We just created the textdraw.
What now? We should create a public function which displays randomly the messages.
pawn Код:
forward Bot();
public Bot()
{
TextDrawSetString(Text:Txt, HelpBot[random(sizeof(HelpBot))]);
return 1;
}
Now, let's set a timer which will change the messages.
pawn Код:
SetTimer("Bot",20000,1); //The messages will randomly change every 20 seconds.
Put the following code after OnPlayerConnect, or after OnPlayerSpawn.
pawn Код:
TextDrawShowForPlayer(playerid,Txt);