10.06.2015, 00:39
pawn Код:
new temp_numbers[30] = {1,2,3, ...},numbersout;
for(new i=0, j=GetPlayerPoolSize(); i <= j; i++)
if(IsPlayerConnected(i) && 0 < PlayerInfo[i][pLottoNumber] < sizeof(numbers)+1)
{
temp_numbers[ PlayerInfo[i][pLottoNumber] - 1] = 0;
numbersout++;
}
if(numbersout >= sizeof(numbers)) SendClientMessage(playerid,COLOR_ERROR,"Sorry All Lottery Numbers Haven Been Booked Already.");
else{
new num[30];
numbersout = 0;
for(new i=0; i < sizeof(temp_numbers); i++)
if(temp_numbers[i])
num[numbersout++] = temp_numbers[i];
if(numbersout == 1) number = num[0];
else number = num[random(numbersout)];
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);
}