[FilterScript] [FS] Chat Bot
#8

Nice script, but any problems,
I changed this script to:

Quote:

/*
Shadow- : Chat Bot, Version 1
Credits to - Pandabear for helping me with minor bugs.
*/


#include <a_samp>

#define MAX_MESSAGES 100

#define BOTTIMER 999999 // 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] = "Draugas_Robotas"; // This will set the Bot's Name
new RandomMessages = 1; // 1 = On - 0 = Off ( 0 = only SendBotMessage() without RandomMessage - 1 = Everything will work)
new Max_Msg;
new BotMsg[MAX_PLAYERS][128];

forward Random(playerid);

new RandomMsg[][] =
{
"nebepasipisesnaxuijaude,"
};

public OnFilterScriptInit()
{
if(RandomMessages == 1)
{
SetTimer("SendRandomMessage",BOTTIMER,1);
}

AddRandomMessage("x x x xx x ");
AddRandomMessage("x x xx x x");
AddRandomMessage("x x x x x x");

print("Shadow's Chatbot Loaded");
return 1;
}

public OnPlayerConnect(playerid)
{
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(playeri d));
new ColorSave = GetPlayerColor(playerid);
SetPlayerColor(playerid,COLOR_BOT);
SetPlayerName(playerid,BotName);
SendPlayerMessageToAll(playerid,BotMsg[random(Max_Msg)]);
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(playeri d));
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(BotMsg[Max_Msg],128,"%s",msg);
Max_Msg++;
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, "", true) || !strcmp(text, "", true) || !strcmp(text, "", true) || !strcmp(text, "", true))
{
SendPlayerMessageToAll(playerid, text);
return 0;
}

if(!strcmp(text, "", true) || !strcmp(text, "", true) || !strcmp(text, "", true) || !strcmp(text, "", 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;
}

1. Now don't working team, gang and admins chats ( ! text ; @ text ; # text).
2. Don't show in chat the player ID after his nickname.
Reply


Messages In This Thread
[FS] Chat Bot - by Shadow_ - 09.06.2010, 20:33
Re: [FS] Chat Bot - by [L3th4l] - 09.06.2010, 20:44
Re: [FS] Chat Bot - by andreyeu2007 - 10.06.2010, 07:12
Re: [FS] Chat Bot - by Flake. - 10.06.2010, 08:53
Re: [FS] Chat Bot - by dcmd_crash - 10.06.2010, 09:32
Re: [FS] Chat Bot - by LasVegasMafiaStoriesRP - 10.06.2010, 09:52
Re: [FS] Chat Bot - by Shadow_ - 10.06.2010, 09:53
Re: [FS] Chat Bot - by Crasher33 - 10.06.2010, 16:33
Re: [FS] Chat Bot - by Shadow_ - 10.06.2010, 17:22
Re: [FS] Chat Bot - by Kar - 19.06.2010, 22:42
Re: [FS] Chat Bot - by Shadow_ - 20.06.2010, 18:29
Re: [FS] Chat Bot - by Niixie - 21.06.2010, 10:07
Re: [FS] Chat Bot - by Shadow_ - 21.06.2010, 10:18
Re: [FS] Chat Bot - by Astralis - 21.06.2010, 10:53
Re: [FS] Chat Bot - by Shadow_ - 21.06.2010, 10:54
Re: [FS] Chat Bot - by ~Ricky~ - 21.06.2010, 11:17
Re: [FS] Chat Bot - by Ghost_BB - 21.06.2010, 11:36
Re: [FS] Chat Bot - by Jeffry - 11.07.2010, 15:57
Re: [FS] Chat Bot - by markokk888 - 11.07.2010, 19:39
Re: [FS] Chat Bot - by iZN - 12.07.2010, 10:34
Re: [FS] Chat Bot - by Shadow_ - 13.11.2010, 19:37
Re: [FS] Chat Bot - by Abraham2nd - 14.11.2010, 10:19
Re: [FS] Chat Bot - by Lookin - 14.11.2010, 13:31
Re: [FS] Chat Bot - by Shadow_ - 16.11.2010, 12:44
Re: [FS] Chat Bot - by Lookin - 16.11.2010, 13:19
Re: [FS] Chat Bot - by Shadow_ - 17.11.2010, 18:48
Re: [FS] Chat Bot - by Lookin - 18.11.2010, 04:50
Re: [FS] Chat Bot - by Lookin - 20.11.2010, 14:03
Re: [FS] Chat Bot - by ScRaT - 20.11.2010, 14:04
Re: [FS] Chat Bot - by seifo - 20.11.2010, 20:50
Re: [FS] Chat Bot - by Banaaniaju - 17.10.2012, 15:29
Re: [FS] Chat Bot - by ProdrifterX - 18.10.2012, 14:04
Re: [FS] Chat Bot - by Hustlah - 18.10.2012, 22:57
Re: [FS] Chat Bot - by Hustlah - 18.10.2012, 23:09
Re: [FS] Chat Bot - by saikumar - 21.11.2013, 06:53
Re: [FS] Chat Bot - by JaKe Elite - 27.08.2016, 04:07
Re: [FS] Chat Bot - by youssef2016 - 27.08.2016, 22:51

Forum Jump:


Users browsing this thread: 2 Guest(s)