25.08.2013, 16:11
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
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
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.
Now we need to write down what will happen if the text entered by the user has The word "hello" in it.
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.
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
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[])
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))
Код:
{ if(!strfind(text,"Dave",true)) { SendClientMessageToAll(COLOR_PINK,"BOT: Hello Mate!"); } }
Hope i Helped
A Second Edition is Out too in which i would be teaching you More Stuff On BotChat.