Lottery Draw!
#1

Heey guys
I use a lotto script and i want to make the draw at 20:00 every day.

Here is code:
Код:
OnGamemodeInit()
{
SetTimer("Draw", LOTTO_DRAW*1000*60, true); //Updates the jackpot
}
forward Draw();
public Draw()
{
    new Lnum = random(100) + 1; //Picks a random number
    new winner = -1; //Winners ID variable
    for(new i; i<MAX_PLAYERS; i++) //checks through all players
    {
        if(!IsPlayerConnected(i)) continue; //Players not connected
        if(GetPVarInt(i, "LottoNumber") == Lnum) winner = i; //If the players number is the winning number
        SetPVarInt(i, "LottoNumber", 0); //Resets the number
    }
    if(winner != -1) //If there was a winner
    {
        new Pname[24];
        GetPlayerName(winner, Pname, 24);
        new str[100];
        SendClientMessageToAll(0x62FF32FF, "****LOTTO INFORMATION****"); //Lotto info
        format(str, sizeof(str), "WE HAVE A WINNER! %s(%d) won $%d!The Lotto number was %d!", Pname, winner, Jackpot,Lnum);
        SendClientMessageToAll(0x62FF32FF, str); //Lotto info
        SendClientMessageToAll(0x62FF32FF, "Make sure you get a ticket for next draw /lotto [1-100]!!"); //Lotto info
        GivePlayerMoney(winner, Jackpot); //Gives the winner the cash
        Jackpot = LOTTO_START; //Resets the jackpot
    }
    if(winner == -1) //No winner
    {
                new str[100];
        SendClientMessageToAll(0x62FF32FF, "****LOTTO INFORMATION****"); //Lotto info
        format(str, sizeof(str), "There was no lotto winner for this draw!The Lotto number was %d!. The jackpot will go up to $%d!",Lnum, Jackpot);
        SendClientMessageToAll(0x62FF32FF, str); //Lotto info
        SendClientMessageToAll(0x62FF32FF, "Make sure you get a ticket for next draw /lotto [1-100]!!");
    }
    for(new s; s<100; s++)
    {
        Numbers[s] = 0; //Resets all numbers so they are usable.
    }
    return 1;
}
Reply
#2

GetPlayerTime dont work:S
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)