botsay command help
#1

everything is fine but when i start botsay from irc and i typed in game that message to win a cookies but its not working i typed correct but nothing happens

pawn Код:
new bool:Starts = false,
        TypeGame = -1,
        targetword[128],
        Timerx;

forward KillTest();


public OnGameModeInit()
{
    // Don't use these lines if it's a filterscript
    SetGameModeText("Blank Script");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    Starts = false;
    TypeGame = -1;
    KillTimer(Timerx);
    return 1;
}

public OnGameModeExit()
{
    Starts = false;
    TypeGame = -1;
    KillTimer(Timerx);
    return 1;
}

public OnPlayerText(playerid, text[])
{
    if(TypeGame == 1) //Typing
    {
            if(strcmp(text, targetword,true)== 1)
            {
                    new str[150],Player,name[24];
                    format(str, sizeof(str), "* BotSay Comp >> Congrats %s (ID:%d), you won a cookie!", name, playerid,targetword);
                    SendClientMessageToAll(-1, str);
                    format(str, sizeof(str), "* 9,3BotSay Comp >> Congrats %s (ID:%d), you won a cookie!", name, playerid,targetword);
                    IRC_GroupSay(groupID, "#yrs" , str);
                    format(str, sizeof(str), "0,10*Admin spork007 (#cs.echo) gave a cookie to %s (ID:%d) [Total Cookies %d]",name, playerid, PlayerInfo[Player][Cookie]);
                    IRC_GroupSay(groupID, "#yrs" , str);
                    PlayerInfo[Player][Cookie] += 1;
                    PlaySoundForAll(1190);
                    GameTextForPlayer(Player, "~g~~h~~h~Cookie", 3, 3000);
                    Starts = false;
                    TypeGame = -1;
                    KillTimer(Timerx);
                    return 0;
            }
    }
    return 1;
}

public KillTest()
{
        if(Starts == true)
        {

                Starts = false;
                TypeGame = -1;

        }
        KillTimer(Timerx);
        return 1;
}

IRCCMD:botsay(botid, channel[], user[], host[], params[])
{

        new str[128], Player;
        if(sscanf(params, "s[128]", targetword))
        {
             return IRC_GroupSay(groupID, channel, "4USAGE: !botsay <text>");
        }

        if(TypeGame == 1)
        {
            return IRC_GroupSay(groupID, channel, "4You can not start botsay! botsay is already started by someone" );
        }

        format(str, sizeof(str), "BotSay Comp >> Type '%s' first to win a cookie! '", targetword);
        PlayerInfo[ Player ][Cookie] += 1;
        GameTextForPlayer(Player, "~g~~h~~h~Cookie",3 ,3000);
        SendClientMessageToAll(COLOR_YELLOW, str);
        format(str, sizeof(str), "9,3* BotSay Comp >> Type '%s' first to win a cookie! (you must be ingame to answer)'", targetword);
        IRC_GroupSay(groupID, channel, str);
        Starts = true;
        TypeGame = 1;
        Timerx = SetTimer("KillTest", 300000, false);
        return 1;
}
Reply
#2

change strcmp(text, targetword,true)== 1 to strcmp(text, targetword,true)== 0
Reply
#3

thanks but i already solved it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)