Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Reaction Contest v1.0
- ---------------------------
- Made by Kostas
- ---------------------------
- Copyright(c), Kostas™
- *//*
- ================================================================================
- *//*
- ________________________________________________________________________________
- Credits:
- * The SA-MP Team
- - SA-MP Client + Server & making SA-MP
- * Sascha
- - Contest Function, Random Numbers, GetTickCount in Milliseconds,
- * Kostas(me)
- - Creating the Script
- ________________________________________________________________________________
- Information:
- Hello, thanks for reading this. I worked on this script for three days and I would appretiate
- if you don't re-release it as your own. Since the Reaction Contest(Filterscript) has been finished
- on November 18,2011 is free for everyone to use it!
- Script features:
- -Two Reaction types(Typing Part) & (Maths Part),
- -Maths includes three types of mathematical operation(addition '+', subtraction '-', multiplication '*')
- *//*
- ================================================================================
- *//*Includes*/
- #include <a_samp>
- /*Defines*/
- #define Loop(%0,%1) for(new %0 = 0; %0 != %1; %0++)
- #define function%0(%1) forward%0(%1); public%0(%1)
- #define CONTEST_PRIZE 40000
- #define CONTEST_TIME 3
- #define CONTEST_MATH 0
- #define CONTEST_TYPE 1
- /*Defines Colours*/
- #define COLOR_ORANGE 0xFF9600FF
- #define COLOR_RED 0xFF0000FF
- /*Variables*/
- new rName[MAX_PLAYER_NAME], string[128], ReactionTest[2], ReactionTimer,
- ContestType = -1, MathsResult, Characters[][] =
- {
- "A", "B", "C", "D", "E", "F", "G", "H", "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",
- "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x",
- "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"
- },
- Chars[17] = "";
- /*
- ================================================================================
- *//*Main Part*/
- public OnFilterScriptInit()
- {
- ReactionTimer = SetTimerEx("Contest_Function", (1000*60*CONTEST_TIME), false, "i", 1);
- return 1;
- }
- public OnFilterScriptExit()
- {
- KillTimer(ReactionTimer);
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- switch(ContestType) {
- case CONTEST_MATH:
- {
- if(strval(text) == MathsResult) {
- GetPlayerName(playerid, rName, sizeof(rName));
- ReactionTest[1] = GetTickCount();
- new timeresult = ReactionTest[1] - ReactionTest[0];
- format(string, sizeof(string), "[Reakcióteszt]: %s megnyerte a reakciótesztet ( ''%i'' ) %d másodperc alatt! Ezért kapott %d$-t!", rName, MathsResult, timeresult,CONTEST_PRIZE);
- SendClientMessageToAll(COLOR_RED, string);
- GivePlayerMoney(playerid, CONTEST_PRIZE);
- ReactionTimer = SetTimerEx("Contest_Function", (1000*60*CONTEST_TIME), false, "i", 1);
- ContestType = false;
- }
- }
- case CONTEST_TYPE:
- {
- if(!strcmp(Chars, text, false)) {
- GetPlayerName(playerid, rName, sizeof(rName));
- ReactionTest[1] = GetTickCount();
- new timeresult = ReactionTest[1] - ReactionTest[0];
- format(string, sizeof(string), "[Reakcióteszt]: %s megnyerte a reakciótesztet ( ''%i'' ) %d másodperc alatt! Ezért kapott %d$-t!", rName, Chars, timeresult,CONTEST_PRIZE);
- SendClientMessageToAll(COLOR_RED, string);
- GivePlayerMoney(playerid, CONTEST_PRIZE);
- ReactionTimer = SetTimerEx("Contest_Function", (1000*60*CONTEST_TIME), false, "i", 1);
- ContestType = false;
- }
- }
- }
- return 1;
- }
- forward Contest_Function(type);
- public Contest_Function(type)
- {
- switch(type) {
- case 0:
- {
- new xLength = (10);
- format(Chars, sizeof(Chars), "");
- Loop(x, xLength) format(Chars, sizeof(Chars), "%s%s", Chars, Characters[random(sizeof(Characters))][0]);
- format(string, sizeof(string), "[Reakcióteszt]: Ha beírod ezt: '%s', és te vagy az első, akkor kapsz %d$-t!", Chars, CONTEST_PRIZE);
- SendClientMessageToAll(COLOR_RED, string);
- KillTimer(ReactionTimer);
- ReactionTest[0] = GetTickCount();
- ContestType = true;
- ContestType = CONTEST_TYPE;
- ReactionTimer = SetTimerEx("Contest_Function", (1000*60*CONTEST_TIME), false, "i", 1);
- return 1;
- }
- case 1:
- {
- new number1 = random(101), number2 = random(101), maths = random(2);
- if(maths == 0) {
- MathsResult = number1 + number2;
- format(string, sizeof(string), "[Reakcióteszt]: Ha kiszámolod ezt: '%d + %d', és te vagy az első akkor kapsz %d$-t", number1, number2,CONTEST_PRIZE);
- }
- else if (maths == 2) {
- MathsResult = number1 - number2;
- format(string, sizeof(string), "[Reakcióteszt]: Ha kiszámolod ezt: '%d - %d', és te vagy az első akkor kapsz %d$-t", number1, number2,CONTEST_PRIZE);
- }
- else {
- MathsResult = number1 * number2;
- format(string, sizeof(string), "[Reakcióteszt]: Ha kiszámolod ezt: '%d x %d', és te vagy az első akkor kapsz %d$-t", number1, number2,CONTEST_PRIZE);
- }
- SendClientMessageToAll(COLOR_RED, string);
- KillTimer(ReactionTimer);
- ReactionTest[0] = GetTickCount();
- ContestType = true;
- ContestType = CONTEST_MATH;
- ReactionTimer = SetTimerEx("Contest_Function", (1000*60*CONTEST_TIME), false, "i", 0);
- return 1;
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement