How to display the winning lotto? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to display the winning lotto? (
/showthread.php?tid=355744)
How to display the winning lotto? -
JaKe Elite - 01.07.2012
Hello,
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;
}
it display something like 'No one won the lotto with ticket "12000", The jackpot will go up to $120000'
how can i fix it?
Re: How to display the winning lotto? -
JaKe Elite - 01.07.2012
2 hours later...
Re: How to display the winning lotto? -
trapstar2020 - 22.09.2012
lol u have if winner -1 1 twice u need to change 1 2 "1" and send winner information
"https://sampforum.blast.hk/showthread.php?tid=160025" i can convert to CMD if u want but that should help
EDIT: O_O its right u think u just have wrong text