24.02.2012, 19:04
i have this lotary command
I want to make a timer when whent the Lotary has begun to wait 2 min for players to type /lotto and afther 2 min the public starts and the lotto to end as the public?
Код:
if(strcmp(cmd, "/startlotto", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 1337)
{
format(string, sizeof(string), "Lotary news: The lotary has begun.");
OOCOff(COLOR_WHITE, string);
new rand = random(80);
if(rand < 77) { rand += 3; }
Lotto(rand);
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Ne ste admin !");
return 1;
}
}
return 1;
}
Код:
public Lotto(number)
{
new JackpotFallen = 0;
new string[256];
new winner[MAX_PLAYER_NAME];
format(string, sizeof(string), "LOTARIJA VESTI: Today the winning number : %d.", number);
OOCOff(COLOR_WHITE, string);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pLottoNr] > 0)
{
if(PlayerInfo[i][pLottoNr] == number)
{
JackpotFallen = 1;
GetPlayerName(i, winner, sizeof(winner));
format(string, sizeof(string), "LOTARIJA News: %s Won the DzekPot od $%d so negovoto lotarija livce.", winner, Jackpot);
OOCOff(COLOR_WHITE, string);
format(string, sizeof(string), "* You have Won $%d with your Lottery Ticket.", Jackpot);
SendClientMessage(i, COLOR_YELLOW, string);
ConsumingMoney[i] = 1;
GivePlayerMoney(i, Jackpot);
}
else
{
SendClientMessage(i, COLOR_LIGHTBLUE, "* You havent won today.");
}
}
PlayerInfo[i][pLottoNr] = 0;
}
}
if(JackpotFallen)
{
new rand = random(125000); rand += 15789;
Jackpot = rand;
SaveStuff();
format(string, sizeof(string), "LOTARIJA VESTI: Noviot DzekPot e zapocnat so $%d.", Jackpot);
OOCOff(COLOR_WHITE, string);
}
else
{
new rand = random(15000); rand += 2158;
Jackpot += rand;
SaveStuff();
format(string, sizeof(string), "LOTARIJA VESTI: DzekPot e podignat na $%d.", Jackpot);
OOCOff(COLOR_WHITE, string);
}
return 1;
}

