[Tutorial] Making a HelpBot as a textdraw
#1

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.
pawn Код:
new Text:Txt;
Great! Now let's create the messages that you want to appear.
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"
};
Well done!
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);
Very nice!
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;
}
Almost done!
Now, let's set a timer which will change the messages.
pawn Код:
SetTimer("Bot",20000,1); //The messages will randomly change every 20 seconds.
The final thing: Now we have to show the textdraw to the player!
Put the following code after OnPlayerConnect, or after OnPlayerSpawn.
pawn Код:
TextDrawShowForPlayer(playerid,Txt);
We're done!
Reply


Messages In This Thread
Making a HelpBot as a textdraw - by [MWR]Blood - 11.12.2010, 17:11
Re: Making a HelpBot as a textdraw - by HyperZ - 11.12.2010, 17:50
Re: Making a HelpBot as a textdraw - by WillyP - 11.12.2010, 17:51
Re: Making a HelpBot as a textdraw - by Jantjuh - 11.12.2010, 17:51
Re: Making a HelpBot as a textdraw - by MestreKiller - 11.12.2010, 19:14
Re: Making a HelpBot as a textdraw - by Stefan_Toretto - 11.12.2010, 19:40
Re: Making a HelpBot as a textdraw - by [MWR]Blood - 12.12.2010, 15:17
Re: Making a HelpBot as a textdraw - by MestreKiller - 12.12.2010, 16:58
Re: Making a HelpBot as a textdraw - by [MWR]Blood - 13.12.2010, 12:46
Re: Making a HelpBot as a textdraw - by MestreKiller - 13.12.2010, 17:57
Re: Making a HelpBot as a textdraw - by The_Gangstas - 13.12.2010, 23:49
Re: Making a HelpBot as a textdraw - by Mean - 25.12.2010, 16:59

Forum Jump:


Users browsing this thread: 5 Guest(s)