29.03.2015, 16:48
How to do this for tk points as in this picture?
PHP код:
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
;
PHP код:
OnPlayerText()
{
switch(xTestBusy)
{
case true:
{
if(!strcmp(xChars, text, false))
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "{FF0000}[TK]{FFFFFF}Najbrzi je bio {FF0000}%s (%i){FFFFFF}i osvaja nagradu od $%d i sada ima {FF0000}%d {FFFFFF}TK POENA. »", pName,GetTimerInSeconds(GetTickCount()));
SendClientMessageToAll(GREEN, string);
GivePlayerMoney(playerid, xCash);
PlayerInfo[playerid][pExp] += 1;
xReactionTimer = SetTimer("xReactionTest", TIMEE, 1);
xTestBusy = false;
}
}
}
PHP код:
FUNCTION: xReactionProgress()
{
switch(xTestBusy)
{
case true:
{
new
string[128]
;
format(string, sizeof(string), "{C0C0C0}« Niko nije pobedio na {FFFFFF}'Reakcije-Test.' {C0C0C0}nov test pocinja za {FFFFFF}%d {C0C0C0}minuta. »", (TIMEE/60000));
SendClientMessageToAll(PURPLE, string);
xReactionTimer = SetTimer("xReactionTest", TIMEE, 1);
xTestBusy = false;
}
}
return 1;
}
FUNCTION: xReactionTest()
{
new
xLength = (random(8) + 2),
string[128]
;
xCash = (random(1000) + 1000);
xScore = (random(1)+1);
format(xChars, sizeof(xChars), "");
Loop(x, xLength) format(xChars, sizeof(xChars), "%s%s", xChars, xCharacters[random(sizeof(xCharacters))][0]);
format(string, sizeof(string), "{FF0000}[TK]{FFFFFF}Ko prvi upise u cetu {FF0000}%s{FFFFFF} dobija %d$. TRENUTNI REKORD: %i sek.", xChars, xCash, xScore);
SendClientMessageToAll(PURPLE, string);
KillTimer(xReactionTimer);
xTestBusy = true;
SetTimer("xReactionProgress", 50000, 0);
return 1;
}