SA-MP Forums Archive
[Tutorial] BotChat (Part 1) - 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] BotChat (Part 1) (/showthread.php?tid=459946)



BotChat (Part 1) - kN1GhT - 25.08.2013

BotChat (1/3)




Hello SA-MP

Today I would be teaching you how to Build a Simple Bot Chat.

This is My First part of BotChat Tutorial..

Here i would be teaching you To make a botchat ..



First I will Tell You the necessary Incudes and Defines for this

Код:
#include <a_samp>

#define COLOR_PINK         0xFF60FFFF
We will be using the include a_samp...
also i would be using a coulor pink with the color code "FF60FFFF" so i am defining it as COLOR_PINK




Lets start with the coding




so We would be Building this Inside THe OnPlayerText Public Function
Код:
public OnPlayerText(playerid, text[])
what is this (playerid, text[])...

these are the Info You Are going to Get when someone texts something

playerid : This Would Give you Playerid Of the Player Who has Typed.

text[] : This would create a string named "Text" Whenever a Client types in something....

Suppose I type in the words "Hello" in my textbox... This would be Saved as the String named "text"


Now What do we need to Do?
WE now need to compare the string "Text" with a desired Word....


We need to comparing the string "text" with the word Hello using the strfind String function And Checking that hs the player Really entered Hello.

Код:
{
   if(!strfind(text,"Hello",true))
Now we need to write down what will happen if the text entered by the user has The word "hello" in it.

Код:
{
   if(!strfind(text,"Dave",true))
     {
	   SendClientMessageToAll(COLOR_PINK,"BOT: Hello Mate!");
	 }
}
so here basically we give a message to all the players when one player types in Hello as Hello Mate ...


Hope i Helped
A Second Edition is Out too in which i would be teaching you More Stuff On BotChat.



Re: BotChat (Part 1) - Luis- - 25.08.2013

Why not just post both parts here..? It'd make things so much easier. I guess you just want posts.


Re: BotChat (Part 1) - kN1GhT - 25.08.2013

Quote:
Originally Posted by Luis-
Посмотреть сообщение
Why not just post both parts here..? It'd make things so much easier. I guess you just want posts.
I did it because in the second part I am using functions and strings inside onplayer text


Re: BotChat (Part 1) - Luis- - 25.08.2013

So? It just confuses other people. Also, the decreasing my reputation was a stupid move mate.