Lotto system Question
#1

Code:
public StartLotto()
{
    new string[256];
    new lotto = RandomEx(1, 61);
    new JackpotFallen = 0;
    format(string, sizeof(string), "Lottery News: Today, the winning number is: %d.", lotto);
	SendClientMessageToAll(COLOR_WHITE, string);
    for(new i = 0; i < MAX_PLAYERS; i++)
	{
	    if(PlayerInfo[i][pLotto] == lotto)
	    {
	        format(string, sizeof(string), "* You won $%d with your lottery ticket.", Jackpot);
			SendClientMessage(i, COLOR_YELLOW, string);
	        GivePlayerCash(i, Jackpot);
	        JackpotFallen = 1;
	    }
	    else
	    {
	        SendClientMessage(i, COLOR_LIGHTBLUE, "* This time I did not win.");
	    }
	    PlayerInfo[i][pLotto] = 0;
	}
	if(JackpotFallen)
	{
	    new rand = random(125000); rand += 15789;
	    Jackpot = rand;
	    format(string, sizeof(string), "Lottery News: Jackpot starts from: $%d.", Jackpot);
		SendClientMessageToAll(COLOR_WHITE, string);
	}
	else
	{
	    new rand = random(15000); rand += 2158;
	    Jackpot += rand;
	    format(string, sizeof(string), "Lottery News: Jackpot reached: $%d.", Jackpot);
		SendClientMessageToAll(COLOR_WHITE, string);
	}
	return 1;
}
how to make lottery jackpot to give from $ 300 to $ 1,000, not much money
Reply
#2

hope this helps:
Code:
public StartLotto()
{
	new MaxPlayers=GetMaxPlayers();
	new MinLottoJackpot=300;
	new MaxLottoJackpot=1000;
	new string[256];
	new lotto = RandomEx(1, 61);
	new JackpotFallen;
	format(string, sizeof(string), "Lottery News: Today, the winning number is: %d.", lotto);
	SendClientMessageToAll(COLOR_WHITE, string);
	for(new i = 0; i < MaxPlayers; i++)
	{
		if(PlayerInfo[i][pLotto] == lotto)
		{
			format(string, sizeof(string), "* You won $%d with your lottery ticket.", Jackpot);
			SendClientMessage(i, COLOR_YELLOW, string);
			GivePlayerCash(i, Jackpot);
			JackpotFallen = 1;
		}
		else
		{
			SendClientMessage(i, COLOR_LIGHTBLUE, "* This time I did not win.");//suggestion: "YOU didnt win." // the players will have issues when referring as "I" or "me"
		}
		PlayerInfo[i][pLotto] = 0;
	}
	if(JackpotFallen)
	{
		Jackpot = 1+random(MaxLottoJackpot-MinLottoJackpot)+MinLottoJackpot;
		format(string, sizeof(string), "Lottery News: Jackpot starts from: $%d.", Jackpot);
		SendClientMessageToAll(COLOR_WHITE, string);
	}
	else
	{
		Jackpot += 1+random(MinLottoJackpot);
		format(string, sizeof(string), "Lottery News: Jackpot reached: $%d.", Jackpot);
		SendClientMessageToAll(COLOR_WHITE, string);
	}
	return 1;
}
i suggest you to move both lines:
new MinLottoJackpot=300;
new MaxLottoJackpot=1000;
... to the other initialisation stuff, then you can set the lotto minimum (which also serves as an increment when nobody won, via a command (modify the lottery a bit while playing is fun hehe)
Reply
#3

Well change the Random.
pawn Code:
public StartLotto()
{
    new string[256];
    new lotto = RandomEx(1, 61);
    new JackpotFallen = 0;
    format(string, sizeof(string), "Lottery News: Today, the winning number is: %d.", lotto);
    SendClientMessageToAll(COLOR_WHITE, string);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(PlayerInfo[i][pLotto] == lotto)
        {
            format(string, sizeof(string), "* You won $%d with your lottery ticket.", Jackpot);
            SendClientMessage(i, COLOR_YELLOW, string);
            GivePlayerCash(i, Jackpot);
            JackpotFallen = 1;
        }
        else
        {
            SendClientMessage(i, COLOR_LIGHTBLUE, "* This time I did not win.");
        }
        PlayerInfo[i][pLotto] = 0;
    }
    if(JackpotFallen)
    {
            new rand = random(250); rand += 250; // Max money you could start with is 500, min is 250.
        Jackpot = rand;
        format(string, sizeof(string), "Lottery News: Jackpot starts from: $%d.", Jackpot);
        SendClientMessageToAll(COLOR_WHITE, string);
    }
    else
    {
            new rand = random(100); rand += 50; // When someone buys a lotto the money will be  +50 to 150.
        Jackpot += rand;
        format(string, sizeof(string), "Lottery News: Jackpot reached: $%d.", Jackpot);
        SendClientMessageToAll(COLOR_WHITE, string);
    }
    return 1;
}
EDIT: The guy above got it 1st
Reply
#4

Yes, but now also makes Jackpot: about $ 20,000
Reply
#5

Eh, lower the amounts a little. How much peoples buy lotto ticket ?
Reply
#6

Because I will not do it with money
and I want to be between 300 and 1000
Reply
#7

Idea how to become
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)