[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
#2

Nice Tutorial. :P
Reply
#3

Kewl for newbz.
Reply
#4

good tut!

-j
Reply
#5

settimer is global when you have with playerid
pawn Код:
SetTimer(playerid,"Bot",20000,1); //The messages will randomly change every 20 seconds.
it will give error
it should be settimerex
Reply
#6

Good Tutorial for Beginers
Reply
#7

Quote:
Originally Posted by [OC]MestreKiller
Посмотреть сообщение
settimer is global when you have with playerid
pawn Код:
SetTimer(playerid,"Bot",20000,1); //The messages will randomly change every 20 seconds.
it will give error
it should be settimerex
Not really. Try it if you want to, I bet it's not going to work.
Reply
#8

Quote:
Originally Posted by Delux13
Посмотреть сообщение
Not really. Try it if you want to, I bet it's not going to work.
how the fuck can you try settimer(playerid ? ofc its gunna give error!!!!!!
i just tryed and it sayed error
see the diference between this and this
Reply
#9

Quote:
Originally Posted by [OC]MestreKiller
Посмотреть сообщение
how the fuck can you try settimer(playerid ? ofc its gunna give error!!!!!!
i just tryed and it sayed error
see the diference between this and this
FFS yeah, i was abit sleepy
Edited it now though
Reply
#10

Quote:
Originally Posted by Delux13
Посмотреть сообщение
FFS yeah, i was abit sleepy
Edited it now though
ahh!!! now it works fine for your comprehension 8/10
Reply
#11

any pics of the textdraw?
Reply
#12

Love it better as a Message, still good.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)