#include <a_samp> //You need the a_samp include in almost every script.
#include <moneyhax_FS>
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1 //DCMD
#define LOTTO_JACKPOT 87096 //How much it goes up every 30 seconds or whenever someone buys a ticket
#define LOTTO_START 458243 //How much the lotto starts off at every draw
#define LOTTO_DRAW 5 //How many minutes between each lotto draw
#define TICKET_COST 15729 //How much a ticket will cost
new Jackpot = LOTTO_START; //Jackpot amount
new Numbers[100]; //So 2 people don't get the same #
public OnFilterScriptInit()
{
SetTimer("UpdateJP", 30000, 1); //Updates the jackpot
SetTimer("Draw", LOTTO_DRAW*1000*60, 1); //Updates the jackpot
return 1;
}
forward UpdateJP(); //Always forward a timer
public UpdateJP()
{
if( Jackpot > 100000000) return Jackpot = 100000000;
else return Jackpot = Jackpot + LOTTO_JACKPOT; //Ads to the lotto jackpot
}
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(loto,4,cmdtext);
return 0;
}
dcmd_loto(playerid, params[])
{
if(!strlen(params)) //If the player doesn't put a nubmer
{
SendClientMessage(playerid, 0x62FF32FF, "Escoge un nъmero del 1 al 100 /loto [1-100]"); //loto info
new str[75]; //Creates the string
format(str, sizeof(str), "El premio es de $%d!!!!", Jackpot); //Formats the jackpot string
SendClientMessage(playerid, 0x62FF82FF, str); //Shows the current jackpot
}
new Num = strval(params); //Makes the param that the player entered into a intiger
if(strlen(params))
{
if(Numbers[Num] == 1) //If the number is used
{
new str[75]; //Makes a variable
format(str, sizeof(str), "Este numero ya fue escogido. %d ", Num); //Formats a str
SendClientMessage(playerid, 0xE21F1FFF, str); //Sends the message
return 1;
}
if(moneyhax_GetPlayerMoney(playerid) < TICKET_COST) return SendClientMessage(playerid, 0xE21F1FFF,"No tienes dinero");
if(Num < 0 || 100 < Num) return SendClientMessage(playerid, 0xE21F1FFF, "Cantidad no valida");
if(GetPVarInt(playerid, "LottoNumber") != 0) return SendClientMessage(playerid, 0xE21F1FFF, "Ya tienes un nъmero, solo uno por persona");
SetPVarInt(playerid, "LottoNumber", Num); //Sets the players number
moneyhax_GivePlayerMoney(playerid, -TICKET_COST); //Takes away the ticket cost.
new str[75];
format(str, sizeof(str), " Ticket comprado! Tienes el numero %d , suerte!", Num);
SendClientMessage(playerid, 0x62FF32FF, str); //loto info
format(str, sizeof(str), " Cada %d minutos hay un nuevo loto. El premio es de $%d", LOTTO_DRAW, Jackpot);
Jackpot = Jackpot + LOTTO_JACKPOT; //Ads to the lotto jackpot
SendClientMessage(playerid, 0x62FF32FF, str); //loto info
}
return 1;
}
forward Draw();
public Draw()
{
new Lnum = random(100) + 1; //Picks a random number
// new Lnum = 58; //Solo para pruebas
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];
format(str, sizeof(str), "Tenemos un ganador! %s(%d) ganу $%d el nъmero ganador fue %d!!!!", Pname, winner, Jackpot,Lnum);
SendClientMessageToAll(0x1250BBAA, str); //loto info
new string[100];
format(string, sizeof(string), "~p~FELICIDADES~n~~w~HAS GANADO LA ~g~LOTERIA~n~~y~RECIBES ~g~$%d", Jackpot);
GameTextForPlayer(winner,string,7500,4);
SendClientMessageToAll(0x62FF32FF, "Compra un ticket usando /loto [1-100]!!"); //loto info
moneyhax_GivePlayerMoney(winner, Jackpot); //Gives the winner the cash
Jackpot = LOTTO_START; //Resets the jackpot
}
if(winner == -1) //No winner
{
new str[100];
format(str, sizeof(str), "No hay ganadores, el nъmero ganador fue %d, el nuevo monto de premio es $%d!",Lnum, Jackpot);
SendClientMessageToAll(0x1250BBAA, str); //loto info
}
for(new s; s<100; s++)
{
Numbers[s] = 0; //Resets all numbers so they are usable.
}
return 1;
}
?
|
Dependiendo del Ammu es decir si el Ammu es un Bizz o nose Dime Que es el Ammu Nation....
BIZZ o ? |

|
podes chequear la diferencia de dinero del jugador antes y despues del ammu y dicha diferencia sumarla al loto.
|