27.12.2014, 04:53
Here is a script of reaction tests...but it doesn't show in how many seconds does player complete reaction...
Anyone please help me on making it...
Thanks you
Anyone please help me on making it...
Thanks you
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 \
0xE78A0EFF
#endif
#if !defined GREEN
#define GREEN \
0xDCEDCFFF
#endif
#if !defined TIME
#define TIME \
180000
#endif
new
xCharacters[][] =
{
"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", "!",
"$", "^", "&", "*", "(", ")", "-", "_", "+", "{", "}", "[", "]",
":", ";", "'", ",", ".", "<", ">", "?", "="
},
xChars[16] = "",
xReactionTimer,
xCash,
xScore,
bool: xTestBusy;
public OnFilterScriptInit()
{
xReactionTimer = SetTimer("xReactionTest", TIME, 5);
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 and earned $%d + %d Score points.", pName, xCash, xScore);
SendClientMessageToAll(PURPLE, string);
format(string, sizeof(string), "You have earned $%d + %d score points.", xCash, xScore);
SendClientMessage(playerid, PURPLE, string);
GivePlayerMoney(playerid, xCash);
SetPlayerScore(playerid, GetPlayerScore(playerid) + xScore);
xReactionTimer = SetTimer("xReactionTest", TIME, 5);
xTestBusy = false;
return 0;
}
}
}
return 1;
}
function xReactionProgress()
{
switch(xTestBusy)
{
case true:
{
new
string[128];
format(string, sizeof(string), "No-one has won the reaction-test. New one starting in 5 minutes.", (TIME/60000));
SendClientMessageToAll(PURPLE, string);
xReactionTimer = SetTimer("xReactionTest", TIME, 5);
xTestBusy = false;
}
}
return 1;
}
function xReactionTest()
{
new
xLength = (random(15) + 5),
string[128]
;
xCash = (random(10000) + 20000);
xScore = (random(15)+1);
format(xChars, sizeof(xChars), "");
Loop(x, xLength) format(xChars, sizeof(xChars), "%s%s", xChars, xCharacters[random(sizeof(xCharacters))][0]);
format(string, sizeof(string), "The First One To Type {FFFFFF}%s {E78A0E}wins $%d + %d score points.", xChars, xCash, xScore);
SendClientMessageToAll(PURPLE, string);
KillTimer(xReactionTimer);
xTestBusy = true;
SetTimer("xReactionProgress", 60000, 0);
return 1;
}