Serious Help With Lottery PLEASE
#1

So i have a lottery and at the minute it picks a random number out of everyones first ticket.. but im changing it so you can buy more than one but im wondering how can i make it so it picks a number from everyones 5 tickets..

Please help

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(gettime() == Player[i][RaffleTime])
        {
            Player[i][RaffleTime] = gettime() + 345600;
            new lotto = Player[Control_Tickets[random(last_ticket_position)]][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;
                Player[i][JackPot] = 0;
                for(new w=0; w<last_ticket_position; w++)
                {
                    Control_Tickets[w]=0;
                }
                last_ticket_position=0;
            }
        }
    }
Please help

Thanks
Reply
#2

It should pick a random number from 5 tickets?

pawn Код:
new number[5];
for(new i=0;i<5;i++)
{
number[i]=random(100);
}
new str[128];
format(str,sizeof(str),"Ticket1: %d, Ticket2: %d,Ticket3 :%d,Ticket4: %d,Ticket5: %d",number[0],number[1],number[2],number[3],number[4]);
I prefer adding playerid also to prefer some bugs.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)