25.08.2013, 16:59
BotChat(2/3)
Welcome to the second tutorial of my BotChat...
U are Advised to Read MY first Tutorial on BotChat if u Want to Understand this Tutorial Completely [RECOMENDED for Learners with no knowledge of scripting] Here.
Though This is pretty Self Explanatory(u need basic scripting knowledge)
First I will Tell You the necessary Incudes and Defines for this
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
so We would be Building this Inside THe OnPlayerText Public Function
Now Lets Do something Else....
How About we Make it Perticular and specify which person has said hey and then use his name in the output..
SO how do we do it?
First We need the name of the player who has said hey.......so we use the function GetPlayerName
first we define a new Local Variable "name" inside the if condition
Now lets use the GetPlayerName function and get the name of the person who has typed Hey
Ahh We ot The Players name ....
Now We Shall Create a string of the Bot's response
First we Create a new Variable Named as "response"
Now lets feed a value to our response using the already defined Variable "Name"
Now Lets send a message to all players
Hope I Helped You
A Third Tutorial IS Out TOO in Which YOU Will Learn More On THIS.
U are Advised to Read MY first Tutorial on BotChat if u Want to Understand this Tutorial Completely [RECOMENDED for Learners with no knowledge of scripting] Here.
Though This is pretty Self Explanatory(u need basic scripting knowledge)
First I will Tell You the necessary Incudes and Defines for this
Code:
#include <a_samp> #define COLOR_PINK 0xFF60FFFF
also i would be using a coulor pink with the color code "FF60FFFF" so i am defining it as COLOR_PINK
so We would be Building this Inside THe OnPlayerText Public Function
Code:
public OnPlayerText(playerid, text[])
Now Lets Do something Else....
How About we Make it Perticular and specify which person has said hey and then use his name in the output..
SO how do we do it?
First We need the name of the player who has said hey.......so we use the function GetPlayerName
first we define a new Local Variable "name" inside the if condition
Code:
if(!strfind(text,"Hey",true)) { new name[24]; }
Code:
if(!strfind(text,"Hey",true)) { new name[24]; GetPlayerName(playerid,name,sizeof(name)) }
Now We Shall Create a string of the Bot's response
First we Create a new Variable Named as "response"
Code:
if(!strfind(text,"Hey",true)) { new name[24]; GetPlayerName(playerid,name,sizeof(name)) new response[120]; }
Code:
if(!strfind(text,"Hey",true)) { new name[24]; GetPlayerName(playerid,name,sizeof(name)) new response[120]; format(response,sizeof(response),"BOT : HELLO %s",name); }
Code:
if(!strfind(text,"Hey",true)) { new name[24]; GetPlayerName(playerid,name,sizeof(name)) new response[120]; format(response,sizeof(response),"BOT : HELLO %s",name); SendClientMessageToAll(COLOR_PINK,response); }
A Third Tutorial IS Out TOO in Which YOU Will Learn More On THIS.