SA-MP Forums Archive
Problem with OnPlayerText - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem with OnPlayerText (/showthread.php?tid=366963)



Problem with OnPlayerText - sniperwars - 08.08.2012

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


AW: Problem with OnPlayerText - Tigerkiller - 08.08.2012

make a veriable set it on reaction start . . .


Re: Problem with OnPlayerText - sniperwars - 08.08.2012

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;



AW: Problem with OnPlayerText - Tigerkiller - 08.08.2012

try setting the veriable back to -1 when he wins


Re: Problem with OnPlayerText - sniperwars - 10.08.2012

Problem solved. Thanks anyway for helping.