Auto Select a free number from 1 - 30
#6

This is my attempt at your code..
I think this should work.

You should also check if the player has 500 cash or people would abuse your lotto game

pawn Код:
for(new b=1; b < 30; b++)
{
number = b;
for(new i=0,j=GetPlayerPoolSize() ; i <= j ; i++)
 {
  if(IsPlayerConnected(i) == 1)
  {
   if(PlayerInfo[i][pLottoNumber] == number)
   {
    numbertaken = 0; //true = 0
    break;
   }
    else
   {
    numbertaken = 1; //false = 1
    break;
   }
 }
} //for loop end

if(numbertaken == 0)
{
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);
}
Oh and ignore the guy who posted after me, he just copies stuff
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)