Serious help please
#1

So i am trying to create a lottery system and i am nearly done i just have one problem when it picks a number.

I want it to pick a number that a player already has.

For example.

I buy a ticket.
My friend buys a ticket.
My other friend buys a ticket.

I want it to choose out of our three numbers so there is always a number.

Please help.

This is when you buy a ticket.

pawn Код:
Player[playerid][RaffleTicket] = random(100);
This is when its picking the ticket.

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(canraffle == 0)
        {
            if(gettime() == Player[i][RaffleTime])
            {
                //Player[i][RaffleTime] = gettime() + 345600;
                new lotto = random(Player[i][RaffleTicket]);
                new Winnings = Player[i][JackPot];
                new string[128];
                if(lotto == Player[i][RaffleTicket])
                {
                    format(string, sizeof(string), "Congratulations %s has won the lottery of %d", GetNameNoUnderScore(i), Winnings);
                    SendClientMessageToAll(YELLOW, string);
                    format(string, sizeof(string), "Congratulations you have won the lottery of %d", Winnings);
                    SendClientMessage(i, YELLOW, string);
                    SendClientMessageToAll(YELLOW, "Remember to buy a another raffle ticket if you want to take part in the next lottery");
                    Player[i][RaffleTicket] = 0;
                    Player[i][Money] += Winnings;
                    canraffle = 1;
                }
                else
                {
                    Raffle();
                }
            }
        }
    }
That dont even get to sending the messages.

I think its something to do with

pawn Код:
new lotto = random(Player[i][RaffleTicket]);
How can i fix

Please help

Thanks
Reply


Messages In This Thread
Serious help please - by Euan Hughes - 23.07.2012, 13:17
Re: Serious help please - by Euan Hughes - 23.07.2012, 13:45
Re: Serious help please - by misticini - 23.07.2012, 13:49
Re: Serious help please - by Euan Hughes - 23.07.2012, 13:54
Re: Serious help please - by misticini - 23.07.2012, 15:28
Re: Serious help please - by Babul - 23.07.2012, 15:37

Forum Jump:


Users browsing this thread: 1 Guest(s)