23.05.2013, 10:59
Hi guys,I decided to make a tutorial about how to make a simple helpbot (as textdraw)
First, let's define the text-draw.
Now let's create the messages that you want to show.
After that, we will have to create the textdraw.
We just created the textdraw.
We should create a public function which displays the messages randomly.
Now, let's set a timer which will change the messages.
Now we have to show the textdraw to the player!
Put the following code after OnPlayerConnect, or after OnPlayerSpawn.
[pawn]TextDrawShowForPlayer(playerid,Txt);/pawn]
And,DONE!
First, let's define the text-draw.
pawn Code:
new Text:Txt;
pawn Code:
new HelpBot[][]=
{
"Add <IP Here> To your favourites!",
"Visit our forums at ...",
"Read the /rules before playing",
"If you're a newbiehere, please read /help"
};
pawn Code:
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 should create a public function which displays the messages randomly.
pawn Code:
forward Bot();
public Bot()
{
TextDrawSetString(Text:Txt, HelpBot[random(sizeof(HelpBot))]);
return 1;
}
pawn Code:
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);/pawn]
And,DONE!