24.07.2012, 17:52
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
Please help
Thanks
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;
}
}
}
Thanks