23.07.2012, 13:49
try this rapid implementation, i think this can resolve the problem:
Put this in top of your code after includes
This is when you buy a ticket.
This is when its picking the ticket.
Put this in top of your code after includes
Код:
new Control_Tickets[MAX_PLAYERS]; new last_ticket_position = 0;
Код:
Player[playerid][RaffleTicket] = random(100); Control_Tickets[last_ticket_position]=playerid; last_ticket_position++;
Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(canraffle == 0)
{
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;
canraffle = 1;
for(new i=0; i<last_ticket_position; i++)
{
Control_Tickets[i]=0;
}
last_ticket_position=0;
}
else
{
Raffle();
}
}
}
}

