hi i need help with my script
#1

#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;
}
Reply
#2

if you tell the problem you have , maybe we can help you and put your code in a quote so we can see it more clear..
Reply
#3

Here we are bro! Compiled without error, didn't tested!

pawn Код:
#define COLOR_BOT 0xFF00FFFF

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 && GetPlayerColor(playerid) != 0)
        {
            new pName[18];
            format(pName,sizeof(pName),"%s",PlayerName(playerid));
            new ColorSave = GetPlayerColor(playerid);
            SetPlayerColor(playerid,COLOR_BOT);
            SetPlayerName(playerid,BotName);
            SendPlayerMessageToAll(playerid,msg);
            SetPlayerColor(playerid,ColorSave);
            SetPlayerName(playerid,pName);
            return 1;
        }
    }
    return 1;
}

stock PlayerName(playerid)
{
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
    return pName;
}

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;
    }
    return 1;
}
If you still have error send your script and i will add it to your script!
Reply
#4

try this too :
Код:
#include <a_samp>

#define COLOR_BOT 0xFF00FFFF // Bot colors (its Pink Now)

new BotName[24] = "BotName"; // Bot's Name




public OnFilterScriptInit()
{


	print("===========================");
	print("ChatBot ");
	print("===========================");
	return 1;
}

public OnPlayerConnect(playerid)
{
	SendBotMessage("Welcome, This Server is Using me !");
	return 1;
}


forward SendBotMessage(msg[]);
public SendBotMessage(msg[])
{
	for(new playerid=0;playerid<MAX_PLAYERS;playerid++)
	{
	    if(IsPlayerConnected(playerid)==1 && GetPlayerColor(playerid) != 0)
	    {
			new pName[18];
			format(pName,sizeof(pName),"%s",PlayerName(playerid));
			new ColorSave = GetPlayerColor(playerid);
			SetPlayerColor(playerid,COLOR_BOT);
			SetPlayerName(playerid,BotName);
			SendPlayerMessageToAll(playerid,msg);
			SetPlayerColor(playerid,ColorSave);
			SetPlayerName(playerid,pName);
			return 1;
		}
	}
	return 1;
}

stock PlayerName(playerid)
{
	new pName2[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, "yo", true))
	{
    	SendPlayerMessageToAll(playerid, text);
		SendBotMessage("Hey Honey!");
		return 0;
	}
	/*    if(!strcmp(text, "MESSAGE", true) || !strcmp(text, "MESSAGE", true) || !strcmp(text, "MESSAGE", true) || !strcmp(text, "MESSAGE", true))
	{
    	SendPlayerMessageToAll(playerid, text);
		SendBotMessage("MESSAGE!!!");
		return 0;
	}*/ // Use this to add more!

	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)