03.05.2013, 09:25
pawn Код:
new EventText[(10 + 1)]; //10 is the size of the text + 1 for the EOS mark (you can write 11, too)
pawn Код:
for(new c = 1; c < sizeof EventText; c++) //fills the array with random letters or numbers
EventText[c - 1] = ((random(2)) ? ((random(2)) ? ('a' + random(26)) : ('A' + random(26))) : ('0' + random(10)));
SendClientMessageToAll(0x0000FFAA, "***** Who types the word as fastest gets 10_000$:");
SendClientMessageToAll(0x0000FFAA, EventText);
pawn Код:
if(EventText[0] != EOS) //checks if the first cell isnt the end of the string
if(strcmp(text, EventText, false) == 0) //checks if the typed text match
{
SendClientMessage(playerid, 0xFFFFFFAA, "*** You were the fastest!");
GivePlayerMoney(playerid, 10_000);
EventText[0] = EOS; //sets the first cell to END OF STRING (mark it as empty)
}