Problem with OnPlayerText
#1

Hi guys,

I added a reaction test to my script and I added this function to my OnPlayerText:

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(strval(text) == ReactionAnswer && ReactionAnswer != -1)
    {
        OnPlayerWinReactionTest(playerid);
        return 0;
    }
    if(PlayerInfo[playerid][pAdmin] && text[0] == '@')
    {
        new msg[128];
        format(msg, sizeof(msg), "[Admin Chat]: %s [ID:%d]: %s", GetName(playerid), playerid, msg);
        SendAdminMessage(COLOR_ADMCMDCOLOR, msg);
    }
    if(PlayerInfo[playerid][pVIP] && text[0] == '!')
    {
        new msg[128];
        format(msg, sizeof(msg), "[VIP Chat]: %s [ID:%d]: %s", GetName(playerid), playerid, msg);
        SendVIPMessage(COLOR_YELLOW, msg);
    }
    new txt[128];
    format(txt, sizeof(txt), "[ID:%d]: %s", playerid, text);
    SendPlayerMessageToAll(playerid, txt);
    return 0;
}
When a person wins the reaction test, they can spam it over and over. How can I fix this problem ?

Kind regards,

Sean
Reply
#2

make a veriable set it on reaction start . . .
Reply
#3

My variables are:

pawn Код:
#define ReactionTestTime                (10)
#define ReactionTestMin                 (2000000)
#define ReactionTestMax                 (9999999)
#define ReactionTestPrize               (10000)
#define ReactionTestScore               (1)
forward ReactionTest();
forward OnPlayerWinReactionTest(playerid);
new ReactionAnswer = -1;
Reply
#4

try setting the veriable back to -1 when he wins
Reply
#5

Problem solved. Thanks anyway for helping.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)