23.08.2011, 19:49
Code:
public StartLotto()
{
new string[256];
new lotto = RandomEx(1, 61);
new JackpotFallen = 0;
format(string, sizeof(string), "Lottery News: Today, the winning number is: %d.", lotto);
SendClientMessageToAll(COLOR_WHITE, string);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerInfo[i][pLotto] == lotto)
{
format(string, sizeof(string), "* You won $%d with your lottery ticket.", Jackpot);
SendClientMessage(i, COLOR_YELLOW, string);
GivePlayerCash(i, Jackpot);
JackpotFallen = 1;
}
else
{
SendClientMessage(i, COLOR_LIGHTBLUE, "* This time I did not win.");
}
PlayerInfo[i][pLotto] = 0;
}
if(JackpotFallen)
{
new rand = random(125000); rand += 15789;
Jackpot = rand;
format(string, sizeof(string), "Lottery News: Jackpot starts from: $%d.", Jackpot);
SendClientMessageToAll(COLOR_WHITE, string);
}
else
{
new rand = random(15000); rand += 2158;
Jackpot += rand;
format(string, sizeof(string), "Lottery News: Jackpot reached: $%d.", Jackpot);
SendClientMessageToAll(COLOR_WHITE, string);
}
return 1;
}

