SA-MP Forums Archive
[Tutorial] Making a HelpBot as a textdraw - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] Making a HelpBot as a textdraw (/showthread.php?tid=198263)



Making a HelpBot as a textdraw - [MWR]Blood - 11.12.2010

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!


Re: Making a HelpBot as a textdraw - HyperZ - 11.12.2010

Nice Tutorial. :P


Re: Making a HelpBot as a textdraw - WillyP - 11.12.2010

Kewl for newbz.


Re: Making a HelpBot as a textdraw - Jantjuh - 11.12.2010

good tut!

-j


Re: Making a HelpBot as a textdraw - MestreKiller - 11.12.2010

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


Re: Making a HelpBot as a textdraw - Stefan_Toretto - 11.12.2010

Good Tutorial for Beginers


Re: Making a HelpBot as a textdraw - [MWR]Blood - 12.12.2010

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.


Re: Making a HelpBot as a textdraw - MestreKiller - 12.12.2010

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


Re: Making a HelpBot as a textdraw - [MWR]Blood - 13.12.2010

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


Re: Making a HelpBot as a textdraw - MestreKiller - 13.12.2010

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


Re: Making a HelpBot as a textdraw - The_Gangstas - 13.12.2010

any pics of the textdraw?


Re: Making a HelpBot as a textdraw - Mean - 25.12.2010

Love it better as a Message, still good.