02.01.2013, 17:23
Ok i have this reaction test but i have a problem. The problem is that when te reaction test is over you can stll win it.
pawn Код:
#include <a_samp>
#define blue2 0x0247FEFF
#if !defined function
#define function%0(%1) \
forward%0(%1); public%0(%1)
#endif
#if !defined Loop
#define Loop(%0,%1) \
for(new %0 = 0; %0 != %1; %0++)
#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
;
function xReactionProgress()
{
switch(xTestBusy)
{
case true:
{
new
string[128]
;
format(string, sizeof(string), "[REACTION TEST] : No One Manage To Win The Reaction Test. New One Starting In %d Minutes.", (TIME/60000));
SendClientMessageToAll(blue2, string);
xReactionTimer = SetTimer("xReactionTest", TIME, 1);
}
}
return 1;
}
function xReactionTest()
{
new
xLength = (random(5) + 3),
string[128]
;
xCash = (random(1000) + 9000);
xScore = (random(2) + 3);
format(xChars, sizeof(xChars), "");
Loop(x, xLength) format(xChars, sizeof(xChars), "%s%s%s%s%s%s%s%s", xChars, xCharacters[random(sizeof(xCharacters))][0], xCharacters[random(sizeof(xCharacters))][0], xCharacters[random(sizeof(xCharacters))][0], xCharacters[random(sizeof(xCharacters))][0], xCharacters[random(sizeof(xCharacters))][0], xCharacters[random(sizeof(xCharacters))][0], xCharacters[random(sizeof(xCharacters))][0]);
format(string, sizeof(string), "[REACTION TEST] : Who First Types %s Wins $%d With %d Score!", xChars, xCash, xScore);
SendClientMessageToAll(blue2, string);
KillTimer(xReactionTimer);
xTestBusy = true;
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 $%d With %d Score!", pName, playerid, xCash, xScore);
SendClientMessageToAll(blue2, string);
GivePlayerMoney(playerid, xCash);
SetPlayerScore(playerid, GetPlayerScore(playerid) + xScore);
xReactionTimer = SetTimer("xReactionTest", TIME, 1);
xTestBusy = false;
return false;
}
return true;
}
}
return 0;
}