chatbot help
#1

i currently downloaded a chatbot and discovered that it doesn't kick in

pawn Code:
#include <a_samp>

#define MAX_MESSAGES 100

#define BOTTIMER 50000 // 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] = "Lookinbot"; // 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[][] =
{
    "Hey,",
    "Sup, ",
    "Hiya, ",
    "Wasssup, "
};

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

    AddRandomMessage("Hey");
    AddRandomMessage("the pcrp forums are good looking!");
    AddRandomMessage("I'm a chatbot");
    AddRandomMessage("Lookin Updates the server once a week");
    AddRandomMessage("OMG ITS AN INFERNUS!");
    AddRandomMessage("I'm in love with this server");
    AddRandomMessage("Stop Using Hacks you noob");
    AddRandomMessage("Don't Make me Ban you");
    AddRandomMessage("Try /help people");
    AddRandomMessage("Go to the forums to check out our VIP privlages");
    AddRandomMessage("I wouldnt if I were you!");
    print("LookinBot Loaded");
    return 1;
}

public OnPlayerConnect(playerid)
{
    SendBotMessage("Welcome to 'My Server' Please Read the /rules or ill rape you.");
    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,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(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(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, "Ha", true) || !strcmp(text, "lol", true) || !strcmp(text, "rofl", true) || !strcmp(text, "lmao", true))
    {
        SendPlayerMessageToAll(playerid, text);
        SendBotMessage("ROFL!");
        return 0;
    }

    if(!strcmp(text, "Hi", true) || !strcmp(text, "Sup", true) || !strcmp(text, "Lookinbot", true) || !strcmp(text, "Hiya", true))
    {
        SendPlayerMessageToAll(playerid, text);
        Random(playerid);
        return 0;
    }

    if(!strcmp(text, "me?", true))
    {
        SendPlayerMessageToAll(playerid, text);
        SendBotMessage("Yes you");
        return 0;
    }
   
    if(!strcmp(text, "fuck", true) || !strcmp(text, "bitch", true) || !strcmp(text, "dick", true) || !strcmp(text, "slut", true))
    {
        SendPlayerMessageToAll(playerid, text);
        SendBotMessage("Watch the Mouth! :)");
        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;
}
anyone got any idea's why?
Reply
#2

What do you mean that it doesn't kick in?
Doesn't it work? Does it error when compleing? What happens?

What kind of problem are you looking for?
Reply
#3

it doesn't work it compiles fine when i put it in my server it doesn't load (in game) but my console says its loaded
Reply
#4

could it be the fact i have 3 textdraws and my lookinsamaw script in there?
Reply
#5

Do you mean none of the messages send, or only some, like the bot's?

Also make sure you are staying in the server long enough to let the messages be sent.
Reply
#6

yeah its not sending any messages what so ever and yeah i am the last time i stayed for an hour waiting xD

This forum requires that you wait 120 seconds between posts. Please try again in 47 seconds.
Reply
#7

You are 100% positive the filterscript is completely loaded? Show me the server log text when you start the server.

You could also try removing all other filterscripts but that one, and see if it works (If there are any others).

This forum requires that you wait 120 seconds between posts. Please try again in 26 seconds.
Reply
#8

Quote:
Originally Posted by Grim_
View Post
You are 100% positive the filterscript is completely loaded? Show me the server log text when you start the server.

You could also try removing all other filterscripts but that one, and see if it works (If there are any others).

This forum requires that you wait 120 seconds between posts. Please try again in 26 seconds.
Code:
SA-MP Dedicated Server
----------------------
v0.3b R2, ©2005-2010 SA-MP Team

[20:22:03] 
[20:22:03] Server Plugins
[20:22:03] --------------
[20:22:03]  Loaded 0 plugins.

[20:22:03] 
[20:22:03] Filter Scripts
[20:22:03] ---------------
[20:22:03]   Loading filter script 'LookinBot.amx'...
[20:22:03] LookinBot Loaded
[20:22:03]   Loaded 1 filter scripts.

[20:22:03] Total vehicles from files: 0
[20:22:03] 
---------------------------------------
[20:22:03] Running Grand Larceny - by the SA-MP team

[20:22:03] ---------------------------------------

[20:22:03] Number of vehicle models: 0
tryed using the gamemode grandlarc just in case it was my gamemode
Reply
#9

Alright, thanks for showing.

I'll take the filterscript myself and mess around with it for awhile until I can get it working. Please also note it is 2:26 AM here, so I might fall asleep before even copying and pasting it =P
Reply
#10

thats fine mate i appreciate the help and your a lot like me stay up all night n sleep all day =D
Reply
#11

Okay, I've found the problem, as I suspected. Here is the line that is causing the problems, for both messages:
pawn Code:
if(IsPlayerConnected(playerid)==1 && GetPlayerColor(playerid) != 0)
Simply remove the "GetPlayerColor(playerid) != 0" part and it will all be fixed.

And the only reason I'm up so late is that I have a party planned for me at 5 AM at a friends. Happy birthday to me !
Reply
#12

Quote:
Originally Posted by Grim_
View Post
Okay, I've found the problem, as I suspected. Here is the line that is causing the problems, for both messages:
pawn Code:
if(IsPlayerConnected(playerid)==1 && GetPlayerColor(playerid) != 0)
Simply remove the "GetPlayerColor(playerid) != 0" part and it will all be fixed.

And the only reason I'm up so late is that I have a party planned for me at 5 AM at a friends. Happy birthday to me !
omg im such a dick! xD why didnt i see that thanks dude most epic fail on my behalf

and happy birthday dude!
Reply
#13

Thank you, it's gonna be a good one

This forum requires that you wait 120 seconds between posts. Please try again in 65 seconds. - Would've been
Reply
#14

lol i swear This forum requires that you wait 120 seconds between posts. Please try again in 65 seconds. messages are out to get up ae they drive everyone mental lol

This forum requires that you wait 120 seconds between posts. Please try again in 42 seconds.
^^See
Reply
#15

ok i ot it working thanks to Grim_ =D
but now it sets everyones name to who ever player id 0 is any idea's?
Reply
#16

Same problem here, its very annoying
Reply
#17

Firstly, happy birthday Grim :P

Code:
if(IsPlayerConnected(playerid)==1 && GetPlayerColor(playerid) != 0)
As explained by SA-MP, if a player doesn't have his colour changed by the script (SetPlayerColor), the players colour will be 0.

Just use a integer, when the player connects check if it's a bot (strcmp it's name), then set the integer (im_a_bot)to the playerid.
Code:
new im_a_bot = -1;
Code:
public OnPlayerConnect(playerid)
{
    if(strcmp("Rac3r(Bot)", PlayerName(playerid), true)==0)im_a_bot = playerid;
    return 1; // end of code, obviously
}
Then, instead of a MAX_PLAYERS loop, just use:
Code:
public SendBotMessage(msg[])
{    
    if(im_a_bot != -1)
    {
         new pName[18];            
         format(pName,sizeof(pName),"%s",PlayerName(im_a_bot));
         .....// and so on;
Use your head, make a check OnPlayerDisconnect, if the chatting bot disconnects, set im_a_bot to -1.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)