12.01.2011, 04:55
I installed the ChatBot system witch can be found here. I customized the pwn settings (name of bot,messages etc.) and put the filterscript in. Game was able to run the filterscript and I even tried restarting the server, but I cannot seem to get the bot to work. Its like it refuses to talk. This is my new server I am trying. Heres the pwn code, could anyone see something causing it not to work. I am a major n00b at this stuff 

Код:
/*
Shadow- : Chat Bot, Version 1
Credits to - Pandabear for helping me with minor bugs.
*/
#include <a_samp>
#define MAX_MESSAGES 100
#define TIMER 30000 // This will set the Timer Length (Miliseconds) For the Random Messages
#define COLOR_BOT 0xFF00FFFF // This will set the Bot's Color (Pink by Default)
new BotName[24] = "HelpBot"; // This will set the Bot's Name
new RANDOMMSG = 1; // 1 = On - 0 = Off ( 0 = only SendBotMessage() without RandomMessage - 1 = Everything will work)
new MAXMESSAGE;
new BOTMESSAGE[MAX_PLAYERS][128];
forward Random(playerid);
new RandomMsg[][] =
{
"Hey,",
"Sup, ",
"Hiya, ",
"Wasssup, "
};
public OnFilterScriptInit()
{
if(RANDOMMSG == 1)
{
SetTimer("SendRandomMessage",TIMER,1);
}
AddRandomMessage("Need Help? Ask an admin.");
AddRandomMessage("Don't you just love Death-Matching?");
print("Shadow's Chatbot Loaded");
return 1;
}
public OnPlayerConnect(playerid)
{
SendBotMessage("Welcome to Hardcore Death-Match.");
return 1;
}
forward SendRandomMessage();
public SendRandomMessage()
{
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,BOTMESSAGE[random(MAXMESSAGE)]);
SetPlayerColor(playerid,ColorSave);
SetPlayerName(playerid,pName);
return 1;
}
}
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 AddRandomMessage(msg[])
{
format(BOTMESSAGE[MAXMESSAGE],128,"%s",msg);
MAXMESSAGE++;
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, "Ha", true) || !strcmp(text, "lol", true) || !strcmp(text, "rofl", true) || !strcmp(text, "lmao", true))
{
SendPlayerMessageToAll(playerid, text);
SendBotMessage("lol");
return 0;
}
if(!strcmp(text, "Hi", true) || !strcmp(text, "Hello", true) || !strcmp(text, "HelpBot", true) || !strcmp(text, "Hiya", true))
{
SendPlayerMessageToAll(playerid, text);
Random(playerid);
return 0;
}
return 1;
}
public Random(playerid)
{
new str[128];
new randMSG = random(sizeof(RandomMsg));
format(str, sizeof(str), "%s %s", RandomMsg[randMSG], PlayerName(playerid));
SendBotMessage(str);
return 1;
}


