[Tutorial] BotChat (Part 1)
#1

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.
Reply
#2

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

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
Reply
#4

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


Forum Jump:


Users browsing this thread: 1 Guest(s)