Help /startlotto - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help /startlotto (
/showthread.php?tid=320828)
Help /startlotto -
Dark Crow - 24.02.2012
i have this lotary command
Код:
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;
}
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?
Re: Help /startlotto -
dice7 - 24.02.2012
pawn Код:
forward Lotto(number);
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; }
SetTimerEx("Lotto", 2 * 60 * 1000, 0, "d", rand);
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Ne ste admin !");
return 1;
}
}
return 1;
}