10.07.2012, 11:49
#iinclude <a_samp>
#ddefine COLOUR_BOT 0x33AA33AA
new BotName[24] = "Tony";
public OnPlayerConnect {Playerid
{
SendBotMessage{"i am programed to talk to you !"};
return 1;
}
forward SendBotMessage {Msg[]};
public SendBotMessage {Msg[]}
{
for{new playerid=0;playerid<MAX_PLAYERS;playerid++}
{
if{IsPlayerConnected{playerid==1 && GetPlayerColour{Playerid} !=0
{
new pName[18];
forward{pName,sizeof{pName,"%s",PlayerName{playeri d}};
new ColourSave =GetPlayerColour{playerid};
SetPlayerColour{playerid,COLOUR_BOT};
SetPlayerName{playerid,BotName};
SendPlayerMessageToALL{playerid,Msg};
SetPlayerColour{playerid,ColourSave};
SetPlayerName{playerid,pName};
return 1;
}
}
return 1;
}
stock PlayerName{Playerid}
{
new pName[MAX]_PLAYER_NAME];
GetPlayerName{playerid, pName2, MAX_PLAYER_NAME};
return pName2;
}
Public OnPlayerText{playerid, text[]}
{
if{!strcmp{text, "hi", true || !strcmp{text, "hello", true || !strcmp{text, "hey", true ||!strcmp{text, "sup", true}} // player words/sentences !
{
SendPlayerMessageToALL{playerid, text};
SendBotMessage{" How Are You Today!"}; // respond message
SendBotMessage{"Whats your name!"}; // respond message
return 0;
}
/* if!{strcmp{text, MESSAGE", true || !strcmp{text, "MESSAGE", true || !strcmp{text, "MESSAGE", true}}
{
SendPlayerMessageToALL{playerid, text};
SendBotMessage{MESSAGE!!!"};
ruturn 0;
}*/ // you can add more messages like this!
return 1;
}
#ddefine COLOUR_BOT 0x33AA33AA
new BotName[24] = "Tony";
public OnPlayerConnect {Playerid
{
SendBotMessage{"i am programed to talk to you !"};
return 1;
}
forward SendBotMessage {Msg[]};
public SendBotMessage {Msg[]}
{
for{new playerid=0;playerid<MAX_PLAYERS;playerid++}
{
if{IsPlayerConnected{playerid==1 && GetPlayerColour{Playerid} !=0
{
new pName[18];
forward{pName,sizeof{pName,"%s",PlayerName{playeri d}};
new ColourSave =GetPlayerColour{playerid};
SetPlayerColour{playerid,COLOUR_BOT};
SetPlayerName{playerid,BotName};
SendPlayerMessageToALL{playerid,Msg};
SetPlayerColour{playerid,ColourSave};
SetPlayerName{playerid,pName};
return 1;
}
}
return 1;
}
stock PlayerName{Playerid}
{
new pName[MAX]_PLAYER_NAME];
GetPlayerName{playerid, pName2, MAX_PLAYER_NAME};
return pName2;
}
Public OnPlayerText{playerid, text[]}
{
if{!strcmp{text, "hi", true || !strcmp{text, "hello", true || !strcmp{text, "hey", true ||!strcmp{text, "sup", true}} // player words/sentences !
{
SendPlayerMessageToALL{playerid, text};
SendBotMessage{" How Are You Today!"}; // respond message
SendBotMessage{"Whats your name!"}; // respond message
return 0;
}
/* if!{strcmp{text, MESSAGE", true || !strcmp{text, "MESSAGE", true || !strcmp{text, "MESSAGE", true}}
{
SendPlayerMessageToALL{playerid, text};
SendBotMessage{MESSAGE!!!"};
ruturn 0;
}*/ // you can add more messages like this!
return 1;
}