01.07.2012, 05:21
Hello,
How can i display the winning lotto ticket if there is no one won the lotto
it display something like 'No one won the lotto with ticket "12000", The jackpot will go up to $120000'
how can i fix it?
How can i display the winning lotto ticket if there is no one won the lotto
pawn Код:
public LottoDraw()
{
new Lnum = random(100) + 1;
new winner = -1;
new str[128];
foreach(Player, i)
{
if(!IsPlayerConnected(i)) continue;
if(GetPVarInt(i, "LottoNumber") == Lnum) winner = i;
SetPVarInt(i, "LottoNumber", 0);
}
if(winner != -1)
{
format(str, sizeof(str), "LOTTO: %s(%d) has won the lotto with ticket ''%i'', He won $%i + %d score", GetpName(winner), winner, GetPVarInt(winner, "MyLottoNo"), Jackpot, LottoPrize);
SendClientMessageToAll(COLOR_YELLOW, str);
printf(str);
SendClientMessageToAll(COLOR_YELLOW, "Attention: "white"Make sure you get a ticket for next draw /lotto [1-100]");
printf("Attention: Make sure you get a ticket for next draw /lotto [1-100]!");
GivePlayerMoney(winner, Jackpot);
SetPlayerScore(winner, GetPlayerScore(winner) + LottoPrize);
Jackpot = LOTTO_START;
SetPVarInt(winner, "MyLottoNo", 0);
}
if(winner == -1)
{
format(str, sizeof(str), "LOTTO: No won the lotto with ticket ''%i'', The jackpot will go up to $%i!", Jackpot, Lnum); //<< here
SendClientMessageToAll(COLOR_RED, str);
printf(str);
SendClientMessageToAll(COLOR_YELLOW, "Attention: "white"Make sure you get a ticket for next draw /lotto [1-100]!");
printf("Attention: Make sure you get a ticket for next draw /lotto [1-100]!");
}
for(new s; s < 100; s++)
{
Numbers[s] = 0;
}
return 1;
}
how can i fix it?