[FilterScript] [FS] Reaction-Test
#33

Quote:
Originally Posted by Kostas'
View Post
This should fix the indentation
pawn Code:
/*
    Release:
            » Reaction-Test Filterscript

    Author:
            » » RyDeR «

    Last Update:
            » 25/05/2010

    ChangeLog:
» v0.1a:
- Initial release

Bugs:
» No bugs

Version:
» v0.1a

Functions:
» /

Credits:
» /
*/


#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), \%s\" has won the reaction test. »", pName);
                SendClientMessageToAll(GREEN, string);
                format(string, sizeof(string), "« You have earned $%d + %d score points. »", xCash, xScore);
                SendClientMessage(playerid, GREEN, string);
                GivePlayerMoney(playerid, xCash);
                SetPlayerScore(playerid, GetPlayerScore(playerid) + xScore);
                xReactionTimer = SetTimer("xReactionTest", TIME, 1);
                xTestBusy = false;
            }
        }
    }
    return 1;
}


function xReactionProgress()
{
    switch(xTestBusy) {
        case true:
        {
            new
                string[128]
                ;
            format(string, sizeof(string), "« No-one won 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(10000) + 20000);
    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), "« Who first types %s wins $%d + %d score points. »", xChars, xCash, xScore);
    SendClientMessageToAll(PURPLE, string);
    KillTimer(xReactionTimer);
    xTestBusy = true;
    SetTimer("xReactionProgress", 30000, 0);
    return 1;
}
Thanks now working

+rep'ed
Reply


Messages In This Thread
[FS] Reaction-Test - by RyDeR` - 25.05.2010, 16:12
Re: [FS] Reaction-Test - by Niixie - 25.05.2010, 16:14
Re: [FS] Reaction-Test - by NewTorran - 25.05.2010, 16:15
Re: [FS] Reaction-Test - by ¤Adas¤ - 25.05.2010, 16:17
Re: [FS] Reaction-Test - by RyDeR` - 25.05.2010, 16:18
Re: [FS] Reaction-Test - by NewTorran - 25.05.2010, 16:21
Re: [FS] Reaction-Test - by RyDeR` - 25.05.2010, 16:22
Re: [FS] Reaction-Test - by NewTorran - 25.05.2010, 16:27
Re: [FS] Reaction-Test - by RyDeR` - 25.05.2010, 16:48
Re: [FS] Reaction-Test - by ViruZZzZ_ChiLLL - 25.05.2010, 17:52
Re: [FS] Reaction-Test - by XRVX - 25.05.2010, 17:53
Re: [FS] Reaction-Test - by !CryWolf - 25.05.2010, 18:26
Re: [FS] Reaction-Test - by RyDeR` - 25.05.2010, 18:43
Re: [FS] Reaction-Test - by Spik3 - 25.05.2010, 18:59
Re: [FS] Reaction-Test - by RyDeR` - 25.05.2010, 19:00
Re: [FS] Reaction-Test - by park4bmx - 25.05.2010, 19:37
Re: [FS] Reaction-Test - by RoamPT - 25.05.2010, 23:54
Re: [FS] Reaction-Test - by Bcklup - 26.05.2010, 07:20
Re: [FS] Reaction-Test - by ColdXX - 14.09.2010, 08:37
Re: [FS] Reaction-Test - by RyDeR` - 14.09.2010, 10:08
Re: [FS] Reaction-Test - by AndriusZ* - 14.09.2010, 11:22
Re: [FS] Reaction-Test - by Stigg - 14.09.2010, 14:01
Re: [FS] Reaction-Test - by RyDeR` - 14.09.2010, 14:41
Re: [FS] Reaction-Test - by ColdXX - 15.09.2010, 13:00
Re: [FS] Reaction-Test - by royal_king - 15.09.2010, 13:17
AW: [FS] Reaction-Test - by Numb3rs - 19.01.2011, 21:36
Re: [FS] Reaction-Test - by Davz*|*Criss - 31.01.2011, 09:54
Re: [FS] Reaction-Test - by Negat1Ve - 03.02.2011, 18:24
Re: [FS] Reaction-Test - by KotoK - 03.02.2011, 18:53
Re: [FS] Reaction-Test - by oFLu - 14.08.2011, 21:11
Re: [FS] Reaction-Test - by Neonman - 20.11.2011, 09:01
Re: [FS] Reaction-Test - by Kostas' - 20.11.2011, 09:13
Re: [FS] Reaction-Test - by Neonman - 20.11.2011, 10:16
Re: [FS] Reaction-Test - by Kostas' - 20.11.2011, 10:18
Re: [FS] Reaction-Test - by saikumar - 27.04.2014, 17:02
Re: [FS] Reaction-Test - by GeasyW - 27.04.2014, 17:55
Re: [FS] Reaction-Test - by Ghazal - 04.05.2014, 16:23
Re: [FS] Reaction-Test - by iRaiDeN - 04.05.2014, 16:26
Re: [FS] Reaction-Test - by VenomMancer - 23.03.2015, 07:50
Re: [FS] Reaction-Test - by mirza1221 - 25.03.2015, 00:19
Re: [FS] Reaction-Test - by ChristolisTV - 06.06.2015, 10:10
Re: [FS] Reaction-Test - by Malph - 25.10.2018, 13:46

Forum Jump:


Users browsing this thread: 8 Guest(s)