Creating a bot system based on .txt file
#1

Hi i am creating a bot system.
All messages that the bot are sending are from a .txt not from script.

It works. However.
It always stuck at the 1st line from the .txt and also it only takes the 1st whole word.
Not the whole word of the line.

Demonstration:

Код:
Hello i am bot of JakAdmin.
Steve will send these.

But instead the result is

Код:
Steve: Hello
Then it keeps sending.

How to fix it?

pawn Код:
#if BOT_FEATURE == true
    ChatTimer = SetTimer("BotChat", 1000*60*1, true);
    #endif

    #if BOT_FEATURE == true
    if(fexist("JakAdmin/Config/botdialogue.txt"))
    {
        new File:dialogue;
        new str[256];
        dialogue = fopen("JakAdmin/Config/botdialogue.txt", io_read);
        while(fread(dialogue, str, sizeof(str), false))
        {
            new idx;
            format(Chats[ChatCount], 256, "%s", strtok(str, idx));
            ChatCount++;
        }
        print("Bot Dialogue has been loaded!");
    }
    else
    {
        print("Bot Dialogue has not been loaded!");
    }
    #endif

#if BOT_FEATURE == true
forward BotChat();
public BotChat()
{
    if(ccount == sizeof(Chats)) ccount = 0;
    new str[256];
    format(str, sizeof(str), "%s: "white"%s", BOT_NAME, Chats[ccount]);
    SendClientMessageToAll(COLOR_GREEN, str); //Change the colour!
    format(str, sizeof(str), "%s: %s", BOT_NAME, Chats[ccount]);
    printf(str);
    return 1;
}
#endif
BOT_NAME is "Steve".
Reply


Messages In This Thread
Creating a bot system based on .txt file - by JaKe Elite - 23.04.2013, 03:48
Re: Creating a bot system based on .txt file - by Emmet_ - 23.04.2013, 10:09
Re: Creating a bot system based on .txt file - by JaKe Elite - 23.04.2013, 10:24
Re: Creating a bot system based on .txt file - by Sithis - 23.04.2013, 11:04

Forum Jump:


Users browsing this thread: 2 Guest(s)