[ajuda] FS CHAT BOT
#1

Galera,й o seguinte,eu tenho um chat bot aqui,que tipo,quando eu vou digitar /bot falar Oi,ai aparece no chat:

Ryder:r Oi

Mais sai um ''R'' No comeзo,e nгo estou conseguindo tirar,se alguem puder me ajudar! :/

pawn Код:
#include <a_samp>

//CONFIGURATION:
new BotName[30] = "Ryder";
new BotAge[20] = "16";
#define BotColour 0x00FFFFAA

#define ColourSync

new EmptyQuestionResponces[][] = {
"Vocк й administrador",
"Tudo Bem??"
};


#define AgeQuestion "Como Vocк Esta??"

new Sayings[][] = { // The different sayings the bot says if a user types 'Botname' or 'Botname?'.
"Ola,Sou o Ryder,Estou aqui para ajudar os players.",
"Nгo sabe os Comandos/Teleportes? /comandos",
"Nunca Chingue Algum Player/Administrador,caso contrбrio,pode levar um BAN!",
"Brasil Shock Wave Owna!",
"Viu algum xiter? /report [seu relatуrio]!"
};

new Answers[][] = { // Answers to questions
"Sim",
"Nгo",
"Talvez",
"Quem sabe...",
"Pera,Estou Ocupado..."
};

#define RandomSpeech // COMMENT THIS OUT TO STOP RANDOM SPEECH
#define RandomSayTime 300000 // 5 minutes, change to what you want, 1 minute = 60000 MS

new RandomStuff[][] = { //Things that the bot says every 5 minutes (defualt)
"Ola,Sou o Ryder,Estou aqui para ajudar os players.",
"Nгo sabe os Comandos/Teleportes? /comandos''",
"Nunca Chingue Algum Player/Administrador,caso contrбrio,pode levar um BAN!",
"Brasil Shock Wave Owna!",
"Quer ver os Administradores Online? /Admins",
"Viu algum xiter? /report [seu relatуrio]!"
};

new TalkingAboutMe[][] = { //Things that the bot says if it detects its name being said.
"Ola,Sou o Ryder,Estou aqui para ajudar os players.",
"Nгo sabe os Comandos/Teleportes? /comandos",
"Nunca Chingue Algum Player/Administrador,caso contrбrio,pode levar um BAN!",
"Brasil Shock Wave Owna!",
"Viu algum xiter? /report [seu relatуrio]!"
};

// END OF CONFIGURATION!!! Only edit below this line if you know what your doing!!

#define COLOR_YELLOW 0x33AA33FF
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_BRIGHTRED 0xFF0000AA
#define COLOR_WHITE 0xFFFFFFAA

new String[MAX_PLAYERS][200];
new BotOn = 1;
forward Send(playerid);
forward Random();
forward ColourSet(playerid);

new PlayerColours[] = {
0xFF8C13FF, // dark orange
0xC715FFFF, // Medium violet red
0x20B2AAFF, // sea green
0xDC143CFF, // crimson
0x6495EDFF, // cornflower blue
0xf0e68cFF, // khaki
0x778899FF, // light slate grey
0xFF1493FF, // deeppink
0xF4A460FF, // sandy
0xEE82EEFF, // violet
0xFFD720FF, // gold
0x8b4513FF, // chocolate
0x4949A0FF, // midnight blue
0x148b8bFF, // dark cyan
0x14ff7fFF, // spring green
0x556b2fFF,  // olive green
0x0FD9FAFF,
0x10DC29FF,
0x534081FF,
0x0495CDFF,
0xEF6CE8FF,
0xBD34DAFF,
0x247C1BFF,
0x0C8E5DFF,
0x635B03FF,
0xCB7ED3FF,
0x65ADEBFF,
0x5C1ACCFF,
0xF2F853FF,
0x11F891FF,
0x7B39AAFF,
0x53EB10FF,
0x54137DFF,
0x275222FF,
0xF09F5BFF,
0x3D0A4FFF,
0x22F767FF,
0xD63034FF,
0x9A6980FF,
0xDFB935FF,
0x3793FAFF,
0x90239DFF,
0xE9AB2FFF,
0xAF2FF3FF,
0x057F94FF,
0xB98519FF,
0x388EEAFF,
0x028151FF,
0xA55043FF,
0x0DE018FF,
0x93AB1CFF,
0x95BAF0FF,
0x369976FF,
0x18F71FFF,
0x4B8987FF,
0x491B9EFF,
0x829DC7FF,
0xBCE635FF,
0xCEA6DFFF,
0x20D4ADFF,
0x2D74FDFF,
0x3C1C0DFF,
0x12D6D4FF,
0x48C000FF,
0x2A51E2FF,
0xE3AC12FF,
0xFC42A8FF,
0x2FC827FF,
0x1A30BFFF,
0xB740C2FF,
0x42ACF5FF,
0x2FD9DEFF,
0xFAFB71FF,
0x05D1CDFF,
0xC471BDFF,
0x94436EFF,
0xC1F7ECFF,
0xCE79EEFF,
0xBD1EF2FF,
0x93B7E4FF,
0x3214AAFF,
0x184D3BFF,
0xAE4B99FF,
0x7E49D7FF,
0x4C436EFF,
0xFA24CCFF,
0xCE76BEFF,
0xA04E0AFF,
0x9F945CFF,
0xDCDE3DFF,
0x10C9C5FF,
0x70524DFF,
0x0BE472FF,
0x8A2CD7FF,
0x6152C2FF,
0xCF72A9FF,
0xE59338FF,
0xEEDC2DFF,
0xD8C762FF,
0x3FE65CFF
};

#define FILTERSCRIPT

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
    print("\n-----------------------------");
    print("Chat Bot 0.2 Beta by DragSta");
    print("-----------------------------\n");
    print("__ Configuracao do bot __");
    print("----------------------------");
    printf("Nome do bot: %s", BotName);
    print("----------------------------");
    printf("Idade do bot: %s", BotAge);
    print("----------------------------");
    print("Respostas para questoes vazias:");
    for(new resp; resp < sizeof(EmptyQuestionResponces); resp++)
    {
        printf("%s", EmptyQuestionResponces[resp]);
    }
    print("----------------------------");
    print("Bot:");
    for(new Say; Say < sizeof(Sayings); Say++)
    {
        printf("%s", Sayings[Say]);
    }
    print("----------------------------");
    print("Respostas do bot:");
    for(new ans; ans < sizeof(Answers); ans++)
    {
        printf("%s", Answers[ans]);
    }
    print("----------------------------");
    print("'Falar de mim' respostas:");
    for(new Talking; Talking < sizeof(TalkingAboutMe); Talking++)
    {
        printf("%s", TalkingAboutMe[Talking]);
    }
    print("----------------------------");
    #if defined RandomSpeech
    print("Discurso randфmico: Ativado");
    print("Discurso randфmico:");
    for(new Ran; Ran < sizeof(RandomStuff); Ran++)
    {
        printf("%s", RandomStuff[Ran]);
    }
    print("----------------------------\n");
    SetTimer("Random", RandomSayTime, 1);
    #else
    print("Discurso randфmico: Desativado");
    print("----------------------------\n");
    #endif
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnPlayerConnect(playerid)
{
    #if defined ColourSync
    SetTimerEx("ColourSet",1000,0,"i", playerid);
    #endif
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}

public OnPlayerSpawn(playerid)
{
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    new BotStr1[200];
    format(BotStr1, sizeof(BotStr1), "%s?", BotName);
    new BotStr2[200];
    format(BotStr2, sizeof(BotStr2), "%s:", BotName);
    new BotStr3[200];
    format(BotStr3, sizeof(BotStr3), "%s: %s", BotName, AgeQuestion);

    if(strcmp(BotName, text, true) == 0)
    {
        if(BotOn == 1)
        {
            new Name[MAX_PLAYER_NAME];
            GetPlayerName(playerid, Name, sizeof(Name));
            format(String[playerid], 200, "%s, %s", Name, Sayings[random(sizeof(Sayings))]);
            //SetTimerEx("Send",170,0,"i", playerid, String[playerid]);
            SetTimerEx("Send",170,0,"i", playerid);
            return 1;
        }
    }
    else if(strcmp(BotStr1, text, true) == 0)
    {
        if(BotOn == 1)
        {
            new Name[MAX_PLAYER_NAME];
            GetPlayerName(playerid, Name, sizeof(Name));
            format(String[playerid], 200, "%s, %s", Name, Sayings[random(sizeof(Sayings))]);
            //SetTimerEx("Send",170,0,"i", playerid, String[playerid]);
            SetTimerEx("Send",170,0,"i", playerid);
            return 1;
        }
    }
    else if(strcmp(BotStr3, text, true) == 0)
    {
        if(BotOn == 1)
        {
            new Name[MAX_PLAYER_NAME];
            GetPlayerName(playerid, Name, sizeof(Name));
            format(String[playerid], 200, "%s, eu sou tenho %d a mais que vocк.", Name, BotAge);
            //SetTimerEx("Send",170,0,"i", playerid, String[playerid]);
            SetTimerEx("Send",170,0,"i", playerid);
            return 1;
        }
    }
    else if(strfind(text, BotStr2, true) != -1 && strfind(text, "?", true, 0) != -1)
    {
        if(BotOn == 1)
        {
            new Name[MAX_PLAYER_NAME];
            GetPlayerName(playerid, Name, sizeof(Name));
            format(String[playerid], 200, "%s, %s", Name, Answers[random(sizeof(Sayings))]);
            //SetTimerEx("Send",170,0,"i", playerid, String[playerid]);
            SetTimerEx("Send",170,0,"i", playerid);
            return 1;
        }
    }
    else if(strcmp(BotStr2, text, true) == 0)
    {
        if(BotOn == 1)
        {
            new Name[MAX_PLAYER_NAME];
            GetPlayerName(playerid, Name, sizeof(Name));
            format(String[playerid], 200, "Errrm %s, %s", Name, EmptyQuestionResponces[random(sizeof(EmptyQuestionResponces))]);
            //SetTimerEx("Send",170,0,"i", playerid, String[playerid]);
            SetTimerEx("Send",170,0,"i", playerid);
            return 1;
        }
    }
    else if(strfind(text, BotName, true) != -1)
    {
        if(BotOn == 1)
        {
            new Name[MAX_PLAYER_NAME];
            GetPlayerName(playerid, Name, sizeof(Name));
            format(String[playerid], 200, "%s, %s", Name, TalkingAboutMe[random(sizeof(TalkingAboutMe))] );
            //SetTimerEx("Send",170,0,"i", playerid, String[playerid]);
            SetTimerEx("Send",170,0,"i", playerid);
            return 1;
        }
    }
    return 1;
}

public OnPlayerPrivmsg(playerid, recieverid, text[])
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    new tmp[256];
    new idx;
    new cmd[256];
    cmd = strtok(cmdtext, idx);

    if (strcmp("/ryder", cmdtext, true, 10) == 0)
    {
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "~~> Funзгo do Administrador Ryder <~~");
        SendClientMessage(playerid, COLOR_YELLOW, "Ola,sou o Ryder,Administrador do Brasil Shock Wave.");
        SendClientMessage(playerid, COLOR_YELLOW, "Estou aqui para ajudar Vocкs,Players.");
        SendClientMessage(playerid, COLOR_WHITE, "Estou sempre de olho em vocкs,tomem cuidado!");// do NOT Remove this line!
        return 1;
    }

    if(strcmp(cmd, "/bot", true) == 0)
    {
        new botcmd;
        tmp = strtok(cmdtext, idx);
        if(!IsPlayerAdmin(playerid))
        {
            SendClientMessage(playerid,0xFF0000AA, "| ERRO | Vocк nгo й Administrador!");
            return 1;
        }
        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "Use: /bot [nome/idade/dizer/raw/alternar]");
            return 1;
        }

        if(strcmp(tmp, "nome", true)==0)
            botcmd = 1;
        else if(strcmp(tmp, "falar", true)==0)
            botcmd = 2;
        else if(strcmp(tmp, "raw", true)==0)
            botcmd = 3;
        else if(strcmp(tmp, "alternar", true)==0)
            botcmd = 4;
        else if(strcmp(tmp, "idade", true)==0)
            botcmd = 5;

        tmp = strtok(cmdtext, idx);
        if(botcmd < 6 && !strlen(tmp)) {
            if(botcmd==0)
                SendClientMessage(playerid, COLOR_WHITE, "USE: /bot [nome/falar/raw/alternar]");
            else if(botcmd==1)
                SendClientMessage(playerid, COLOR_WHITE, "USE: /bot [nome] [nome]");
            else if(botcmd==2)
                SendClientMessage(playerid, COLOR_WHITE, "USE: /bot [falar] [msg]");
            else if(botcmd==3)
                SendClientMessage(playerid, COLOR_WHITE, "USE: /bot [raw] [raw data]");
            else if(botcmd==4)
                SendClientMessage(playerid, COLOR_WHITE, "USE: /bot [alternar] [on | off]");
            else if(botcmd==5)
                SendClientMessage(playerid, COLOR_WHITE, "USE: /bot [idade] [idade]");
            return 1;
        }


        if(botcmd==1)//Bot Name
        {
            if(BotOn == 0)
            {
                SendClientMessage(playerid, COLOR_WHITE, "O bot estб desligado entгo vocк nгo pode usar o cmd.");
                return 1;
            }
            new Thing[200], Name[MAX_PLAYER_NAME];
            GetPlayerName(playerid, Name, sizeof(Name));
            format(Thing, sizeof(Thing), "| INFO | O Administrador %s Mudou o Nome do Bot de %s para %s", Name, BotName, tmp);
            SendClientMessageToAll(COLOR_YELLOW, Thing);
            format(BotName, sizeof(BotName), "%s", tmp);
            return 1;
        } else if (botcmd==2)//Bot say
        {
            if(BotOn == 0)
            {
                SendClientMessage(playerid, COLOR_WHITE, "O bot estб desligado entгo vocк nгo pode usar o cmd.");
                return 1;
            }
            SendBotMsg(playerid, cmdtext[9]);
            return 1;
        } else if (botcmd==3)//Bot raw
        {
            if(BotOn == 0)
            {
                SendClientMessage(playerid, COLOR_WHITE, "O bot estб desligado entгo vocк nгo pode usar o cmd.");
                return 1;
            }
            SendBotRaw(playerid, cmdtext[9]);
            return 1;
        } else if (botcmd==4)//Bot toggle
        {
            if(strcmp(tmp, "on", true) == 0)
            {
                if(BotOn == 1)
                {
                    SendClientMessage(playerid, COLOR_YELLOW, "O bot jб estб ligado!");
                }
                else
                {
                    BotOn = 1;
                    SendClientMessageToAll(COLOR_YELLOW, "Os servidores do bot foram ligados!");
                }
            } else if(strcmp(tmp, "off", true) == 0)
            {
                if(BotOn == 0)
                {
                    SendClientMessage(playerid, COLOR_YELLOW, "O bot jб estб desligado!");
                }
                else
                {
                    BotOn = 0;
                    SendClientMessageToAll(COLOR_YELLOW, "Os servidores do bot foram desligados!");
                }
            }
        } else if (botcmd==5)//Bot age
        {
            if(BotOn == 0)
            {
                SendClientMessage(playerid, COLOR_WHITE, "O bot estб desligado entгo vocк nгo pode usar o cmd.");
                return 1;
            }
            new Thing[200], Name[MAX_PLAYER_NAME];
            new AGE;
            AGE = strval(tmp);
            GetPlayerName(playerid, Name, sizeof(Name));
            format(Thing, sizeof(Thing), "| INFO | O Administrador %s mudou a idade do Administrador Ryder de %s para %d.", Name, BotAge, AGE);
            SendClientMessageToAll(0x0080FFAA, Thing);
            format(BotAge, sizeof(BotAge), "%d", AGE);
            return 1;
        }
        return 1;
    }

    return 0;
}

public OnPlayerInfoChange(playerid)
{
    return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public Send(playerid)
{
    SendBotMsg(playerid, String[playerid]);
}

stock SendBotMsg(senderid, const Strr[])
{
    if(BotOn == 0)
    {
        SendClientMessage(senderid, COLOR_WHITE, "O bot estб desligado entгo vocк nгo pode usar o cmd.");
    }
    new Name[MAX_PLAYER_NAME];
    new Colour = GetPlayerColor(senderid);
    SetPlayerColor(senderid, BotColour);
    GetPlayerName(senderid, Name, sizeof(Name));
    SetPlayerName(senderid, BotName);
    SendPlayerMessageToAll(senderid, Strr);
    SetPlayerName(senderid, Name);
    SetPlayerColor(senderid, Colour);
}

stock SendBotRaw(senderid, const Strr[])
{
    if(BotOn == 0)
    {
        SendClientMessage(senderid, COLOR_WHITE, "O bot estб desligado entгo vocк nгo pode usar o cmd.");
    }
    new Name[MAX_PLAYER_NAME];
    GetPlayerName(senderid, Name, sizeof(Name));
    SetPlayerName(senderid, BotName);
    CallRemoteFunction("OnPlayerCommandText","is",senderid,Strr);
    SetPlayerName(senderid, Name);
}

public Random()
{
    if(IsPlayerConnected(0))
    {
        SendBotMsg(0,RandomStuff[random(sizeof(RandomStuff))]);
    } else if(IsPlayerConnected(1))
    {
        SendBotMsg(1,RandomStuff[random(sizeof(RandomStuff))]);
    } else if(IsPlayerConnected(2))
    {
        SendBotMsg(2,RandomStuff[random(sizeof(RandomStuff))]);
    } else if(IsPlayerConnected(3))
    {
        SendBotMsg(3,RandomStuff[random(sizeof(RandomStuff))]);
    } else if(IsPlayerConnected(4))
    {
        SendBotMsg(4,RandomStuff[random(sizeof(RandomStuff))]);
    } else if(IsPlayerConnected(1))
    {
        SendBotMsg(5,RandomStuff[random(sizeof(RandomStuff))]);
    } else if(IsPlayerConnected(2))
    {
        SendBotMsg(6,RandomStuff[random(sizeof(RandomStuff))]);
    } else if(IsPlayerConnected(3))
    {
        SendBotMsg(7,RandomStuff[random(sizeof(RandomStuff))]);
    } else if(IsPlayerConnected(4))
    {
        SendBotMsg(8,RandomStuff[random(sizeof(RandomStuff))]);
    }
}

public ColourSet(playerid)
{
    SetPlayerColor(playerid, PlayerColours[playerid]);
}

strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
Reply


Messages In This Thread
[ajuda] FS CHAT BOT - by Allanrokeiro - 17.02.2011, 14:31
Re: [ajuda] FS CHAT BOT - by Macintosh - 17.02.2011, 15:35
Re: [ajuda] FS CHAT BOT - by Allanrokeiro - 17.02.2011, 16:41
Re: [ajuda] FS CHAT BOT - by Macintosh - 17.02.2011, 16:54
Re: [ajuda] FS CHAT BOT - by Baddark2131 - 17.02.2011, 23:45
Re: [ajuda] FS CHAT BOT - by CyNiC - 18.02.2011, 01:59
Re: [ajuda] FS CHAT BOT - by Allanrokeiro - 18.02.2011, 13:36

Forum Jump:


Users browsing this thread: 4 Guest(s)