How to display the winning lotto?
#1

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?
Reply
#2

2 hours later...
Reply
#3

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)