23.07.2012, 13:17
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.
This is when its picking the ticket.
That dont even get to sending the messages.
I think its something to do with
How can i fix
Please help
Thanks
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);
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();
}
}
}
}
I think its something to do with
pawn Код:
new lotto = random(Player[i][RaffleTicket]);
Please help
Thanks