09.06.2015, 18:42
Lottery number between 1 - 30
What i want to do it that it selects any number that is free for the player
here
PlayerInfo[i][pLottoNumber] this stores players lotto number
I can't really make the logic for it tired of thinking how it will work.
What i want to do it that it selects any number that is free for the player
here
PlayerInfo[i][pLottoNumber] this stores players lotto number
I can't really make the logic for it tired of thinking how it will work.
pawn Код:
for(new b=1; b < 30; b++)
{
number = b;
for(new i=0,j=GetPlayerPoolSize(); i <= j; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pLottoNumber] == number)
{
numbertaken=true;
continue;
}
else
{
numbertaken=false;
break;
}
}
}
if(!numbertaken) break;
}
if(numbertaken)
{
SendClientMessage(playerid,COLOR_ERROR,"Sorry All Lottery Numbers Haven Been Booked Already.");
}
else
{
PlayerInfo[playerid][pLottoNumber] = number;
format(string,sizeof(string),"You Have Successfully Taken Number "YELLOW"%d"WHITE", For Daily "GREEN"Lottery"WHITE" Draw At "YELLOW"18:00",number);
SendClientMessage(playerid,COLOR_WHITE,string);
GivePlayerCash(playerid,-500);
}