20.10.2016, 09:50
Код:
dcmd_lotto(playerid, params[])
{
if(!strlen(params)) //If the player doesn't put a nubmer
{
SendClientMessage(playerid, 0x62FF32FF, "***Lotto information***"); //Lotto info
SendClientMessage(playerid, 0x62FF32FF, "Pick a number between 1 and 100 with /lotto [1-100]"); //Lotto info
new str[75]; //Creates the string
format(str, sizeof(str), "Current Jackpot is $%d!!!!", Jackpot); //Formats the jackpot string
SendClientMessage(playerid, 0x62FF32FF, str); //Shows the current jackpot
}
new Num = strval(params); //Makes the param that the player entered into a intiger
if(Numbers[Num] == 1) //If the number is used
{
new str[75]; //Makes a variable
format(str, sizeof(str), "Lotto number %d is already taken!", Num); //Formats a str
SendClientMessage(playerid, 0xE21F1FFF, str); //Sends the message
return 1;
}
if(GetPVarInt(playerid, "LottoNumber") != 0) return SendClientMessage(playerid, 0xE21F1FFF, "You have already got a lotto number");
SetPVarInt(playerid, "LottoNumber", Num); //Sets the players number
Numbers[Num] = 1; //Number is used
GivePlayerMoney(playerid, -TICKET_COST); //Takes away the ticket cost.
new str[75];
format(str, sizeof(str), " Lotto ticket brought! You now have number %d for the next draw", Num);
SendClientMessage(playerid, 0x62FF32FF, str); //Lotto info
format(str, sizeof(str), " Draws are held every %d minutes and the winners are announced. Current jackpot is $%d", LOTTO_DRAW, Jackpot);
Jackpot = Jackpot + LOTTO_JACKPOT; //Ads to the lotto jackpot
SendClientMessage(playerid, 0x62FF32FF, str); //Lotto info
return 1;
}

