SA-MP Forums Archive
New Problem With The Reaction Test!!! - 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: New Problem With The Reaction Test!!! (/showthread.php?tid=376542)



New Problem With The Reaction Test!!! - ThePrograme - 10.09.2012

1.Ok if you don't know i needed help with reaction test but i solved that now i have another problem when the reaction test starts in game it doesn't show how much money and score.

2.Can somebody tell me were to change on how much time the reaction test appears and disapears.

For help here is the code:
pawn Код:
#include <a_samp>

#if !defined Loop
#define Loop(%0,%1) \
    for(new %0 = 0; %0 != %1; %0++)
#endif

#if !defined function
#define function%0(%1) \
    forward%0(%1); public%0(%1)
#endif

#if !defined PURPLE
#define PURPLE \
    0xBF60FFFF
#endif

#if !defined GREEN
#define GREEN \
    0x94D317FF
#endif

#if !defined TIME
#define TIME \
    180000
#endif

new
    xCharacters[][] =
    {
        "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
        "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
        "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
        "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
        "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "!", "#", "$",
        "%", "&", "/", "(", ")", "=", "?", "*", "+", "'", "ˇ", "^", "{",
        "}", "[", "]", "\", """, "|", "Ђ", ";", ":", ",", ".", "_", "-",
        ">", "<"
    },
    xChars[16] = "",
    xReactionTimer,
    xCash,
    xScore,
    bool: xTestBusy
;

public OnFilterScriptInit()
{
    xReactionTimer = SetTimer("xReactionTest", TIME, 1);
    return 1;
}

public OnFilterScriptExit()
{
    KillTimer(xReactionTimer);
    return 1;
}

public OnPlayerText(playerid, text[])
{
    switch(xTestBusy)
    {
        case true:
        {
            if(!strcmp(xChars, text, false))
            {
                new
                    string[128],
                    pName[MAX_PLAYER_NAME]
                ;
                GetPlayerName(playerid, pName, sizeof(pName));
                format(string, sizeof(string), "[REACTION TEST]: %s (%i) Has Won And Earned $%s With %s Score!", pName, playerid, xCash, xScore);
                SendClientMessageToAll(GREEN, string);
                GivePlayerMoney(playerid, xCash);
                SetPlayerScore(playerid, GetPlayerScore(playerid) + xScore);
                xReactionTimer = SetTimer("xReactionTest", TIME, 1);
                xTestBusy = false;
                return false;
            }
        }
    }
    return true;
}

function xReactionProgress()
{
    switch(xTestBusy)
    {
        case true:
        {
            new
                string[128]
            ;
            format(string, sizeof(string), "No One Manage To Win The Reaction Test.New One Starting In %d Minutes. »", (TIME/60000));
            SendClientMessageToAll(PURPLE, string);
            xReactionTimer = SetTimer("xReactionTest", TIME, 1);
        }
    }
    return 1;
}

function xReactionTest()
{
    new
        xLength = (random(8) + 2),
        string[128]
    ;
    xCash = (random(1000) + 7000);
    xScore = (random(2)+1);
    format(xChars, sizeof(xChars), "");
    Loop(x, xLength) format(xChars, sizeof(xChars), "%s%s", xChars, xCharacters[random(sizeof(xCharacters))][0]);
    format(string, sizeof(string), "[REACTION TEST]: Who First Types %s Wins $%s With %s Score!", xChars, xCash, xScore);
    SendClientMessageToAll(PURPLE, string);
    KillTimer(xReactionTimer);
    xTestBusy = true;
    SetTimer("xReactionProgress", 30000, 0);
    return 1;
}



Re: New Problem With The Reaction Test!!! - FalconX - 10.09.2012

1. Money and Scores are numbers so it should be "%d" instead of "%s".

2. You can change the time by changing "180000" to what ever you want, 180000 is 3 minutes.

https://www.******.com.kw/search?q=m...ond+to+minutes


Re: New Problem With The Reaction Test!!! - ThePrograme - 10.09.2012

Oh thanks man +rep


Re: New Problem With The Reaction Test!!! - [LB]BlAcK_DeViL - 10.09.2012

Good