01.09.2012, 23:12
Hi everybody there...
Today, I'm gonna show you, How to make a "BOT" that replies almost all words a player says.
Fine... Let's start...
-----------------------------------------------------------------------------------------
1.-Before do anything, We must add the following include at the top of your script...
2.-You have to go to the following function:
3.-Onto it, We have to add the following things:
4.-
5.-
6.-
The whole function will be like this:
So Now You can add your own Words And Replies...
Thank you for see my Tutorial.
Today, I'm gonna show you, How to make a "BOT" that replies almost all words a player says.
Fine... Let's start...
-----------------------------------------------------------------------------------------
1.-Before do anything, We must add the following include at the top of your script...
pawn Code:
#include <a_samp>//Obviously, we have to add a_samp include which contains all the information to work...
2.-You have to go to the following function:
pawn Code:
public OnPlayerText(playerid, text[]) //At this function, We're gonna write, a text and the response from the "BOT" if we call it like this...
{
return 1;
}
3.-Onto it, We have to add the following things:
pawn Code:
if(!strcmp(text, "Hello Bot", true)) // Here we have to insert the text, This function will check if the player has said this word
pawn Code:
{
new string[128]; GetPlayerName(playerid,string,sizeof(string));
format(string,sizeof(string),"%s[%d]: %s",string,playerid, text);//Here we are going to give the format, when the player says that word...
pawn Code:
SendClientMessageToAll(GetPlayerColor(playerid), string);//Here we are going to add the function, to send the text...
SendClientMessageToAll(green, "[BOT]: Hey Wassup!");//Here is the reply...In other words, What the bot will reply to the player... °Don't forget to add the "#define green 0x33FF33AA" Or you'll get an error
pawn Code:
return 0;//We have to add return 0;//To stop the BOT says it.
}//Close the bracket.
pawn Code:
public OnPlayerText(playerid, text[])
{
if(!strcmp(text, "Hi Bot", true))
{
new string[128]; GetPlayerName(playerid,string,sizeof(string));
format(string,sizeof(string),"%s[%d]: %s",string,playerid, text);
SendClientMessageToAll(GetPlayerColor(playerid), string);
SendClientMessageToAll(green, "[BOT]iThe_Bot: Hey Wassup!");
return 0;
}
return 1;
}
Thank you for see my Tutorial.