Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <ZCMD>
- #define TempoJogoDoBicho 60000
- #define randomEx(%0,%1) (random(%1 - %0 + 1) + %0)
- #define DialogJogoDoBichoMenu 600
- #define DialogJogoDoBichoTabela 601
- #define DialogJogoDoBichoTipoAposta 602
- #define DialogJogoDoBichoApostar 603
- #define DialogJogoDoBichoApostarValor 604
- enum eBichos {
- Bicho[64],
- Dezenas[4]
- }
- new TabelaBichos[][eBichos] = {
- {"Vazio", {0, 0, 0, 0}},
- {"AVESTRUZ", {1, 2, 3, 4}},
- {"ÁGUIA", {5, 6, 7, 8}},
- {"BURRO", {09, 10, 11, 12}},
- {"BORBOLETA", {13, 14, 15, 16}},
- {"CACHORRO", {17, 18, 19, 20}},
- {"CABRA", {21, 22, 23, 24}},
- {"CARNEIRO", {25, 26, 27, 28}},
- {"CAMELO", {29, 30, 31, 32}},
- {"COBRA", {33, 34, 35, 36}},
- {"COELHO", {37, 38, 39, 40}},
- {"CAVALO", {41, 42, 43, 44}},
- {"ELEFANTE", {45, 46, 47, 48}},
- {"GALO", {49, 50, 51, 52}},
- {"GATO", {53, 54, 55, 56}},
- {"JACARÉ", {57, 58, 59, 60}},
- {"LEÃO", {61, 62, 63, 64}},
- {"MACACO", {65, 66, 67, 68}},
- {"PORCO", {69, 70, 71, 72}},
- {"PAVÃO", {73, 74, 75, 76}},
- {"PERU", {77, 78, 79, 80}},
- {"TOURO", {81, 82, 83, 84}},
- {"TIGRE", {85, 86, 87, 88}},
- {"URSO", {89, 90, 91, 92}},
- {"VEADO", {93, 94, 95, 96}},
- {"VACA", {97, 98, 99, 100}}
- };
- enum eApostador {
- Animal,
- TipoAposta,
- Aposta,
- bool:Apostando
- }
- new Apostadores[MAX_PLAYERS][eApostador];
- new UltimoResultado;
- new bool:PodeApostarBicho = true;
- public OnFilterScriptInit()
- {
- print("----------------------------------");
- print("----------------------------------");
- print("----------Jogo do Bicho-----------");
- print("---------Por Vaca_Marinha---------");
- print("----------------------------------");
- print("----------------------------------");
- SetTimerEx("ResultadoBicho", TempoJogoDoBicho, true, "");
- SetTimerEx("FecharBicho", (TempoJogoDoBicho-(TempoJogoDoBicho / 4)), false, "");
- return 1;
- }
- CMD:apostar(playerid, const params[]) {
- MostrarMenuTipoAposta(playerid);
- return 1;
- }
- CMD:bichos(playerid, const params[]) {
- return MostrarMenuTabela(playerid);
- }
- CMD:jogodobicho(playerid, const params[]) {
- return MostrarMenuBicho(playerid);
- }
- CMD:testedinheiro(playerid) {
- GivePlayerMoney(playerid, 50000);
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
- switch(dialogid) {
- case DialogJogoDoBichoMenu: {
- if(!response) return 1;
- switch(listitem) {
- case 0: cmd_apostar(playerid, "");
- case 1: cmd_bichos(playerid, "");
- case 2: SendClientMessage(playerid, -1, "Em breve...");
- }
- }
- case DialogJogoDoBichoTabela: {
- if(!response) return MostrarMenuBicho(playerid);
- }
- case DialogJogoDoBichoTipoAposta: {
- if(!response) return MostrarMenuBicho(playerid);
- new lista[2048];
- format(lista, sizeof(lista), "Grupo\tAnimal\tDezenas\n");
- for(new i = 1; i < sizeof(TabelaBichos);i++) {
- format(lista, sizeof(lista), "%s{FCB876}%i\t{a9c4e4}%s\t%i-%i-%i-%i\n", lista, i, TabelaBichos[i][Bicho], TabelaBichos[i][Dezenas][0], TabelaBichos[i][Dezenas][1], TabelaBichos[i][Dezenas][2], TabelaBichos[i][Dezenas][3]);
- }
- return ShowPlayerDialog(playerid, DialogJogoDoBichoApostar, DIALOG_STYLE_TABLIST_HEADERS, "{ffff00}#{ffffff}Bicho | Selecione um animal", lista, "OK", "Voltar");
- }
- case DialogJogoDoBichoApostar: {
- if(!response) return MostrarMenuTipoAposta(playerid);
- new animal = (listitem+1), string[1024];
- SetPVarInt(playerid, "apostando_bicho", animal);
- format(string, sizeof(string), "Você está apostando em:\n\n\
- Animal: %s\n\
- Grupo: %d\n\
- Dezenas: %i-%i-%i-%i\n\nDigite o valor que deseja apostar:\
- ", TabelaBichos[animal][Bicho], animal, TabelaBichos[animal][Dezenas][0], TabelaBichos[animal][Dezenas][1], TabelaBichos[animal][Dezenas][2], TabelaBichos[animal][Dezenas][3]);
- ShowPlayerDialog(playerid, DialogJogoDoBichoApostarValor, DIALOG_STYLE_INPUT, "{ffff00}#{ffffff}Bicho | Valor da aposta", string, "OK", "Voltar");
- return 1;
- }
- case DialogJogoDoBichoApostarValor: {
- if(!response) {
- new lista[2048];
- format(lista, sizeof(lista), "Grupo\tAnimal\tDezenas\n");
- for(new i = 1; i < sizeof(TabelaBichos);i++) {
- format(lista, sizeof(lista), "%s{FCB876}%i\t{a9c4e4}%s\t%i-%i-%i-%i\n", lista, i, TabelaBichos[i][Bicho], TabelaBichos[i][Dezenas][0], TabelaBichos[i][Dezenas][1], TabelaBichos[i][Dezenas][2], TabelaBichos[i][Dezenas][3]);
- }
- return ShowPlayerDialog(playerid, DialogJogoDoBichoApostar, DIALOG_STYLE_TABLIST_HEADERS, "{ffff00}#{ffffff}Bicho | Selecione um animal", lista, "OK", "Voltar");
- } else {
- new valor = strval(inputtext), animal = GetPVarInt(playerid, "apostando_bicho"), string[128];
- if(valor <= 0 || valor < 100) {
- if((GetPlayerMoney(playerid)-valor) > 0) {
- SendClientMessage(playerid, -1, "{FCB876}[Jogo Do Bicho] {a9c4e4}Você precisa apostar no mínimo R$100.");
- } else {
- SendClientMessage(playerid, -1, "{FCB876}[Jogo Do Bicho] {a9c4e4}Você não tem dinheiro suficiente para essa aposta, coloque um valor menor.");
- }
- format(string, sizeof(string), "Você está apostando em:\n\n\
- Animal: %s\n\
- Grupo: %d\n\
- Dezenas: %i-%i-%i-%i\n\nDigite o valor que deseja apostar:\
- ", TabelaBichos[animal][Bicho], animal, TabelaBichos[animal][Dezenas][0], TabelaBichos[animal][Dezenas][1], TabelaBichos[animal][Dezenas][2], TabelaBichos[animal][Dezenas][3]);
- return ShowPlayerDialog(playerid, DialogJogoDoBichoApostarValor, DIALOG_STYLE_INPUT, "{ffff00}#{ffffff}Bicho | Valor da aposta", string, "OK", "Voltar");
- }
- GivePlayerMoney(playerid, -valor);
- Apostadores[playerid][Animal] = animal;
- Apostadores[playerid][TipoAposta] = 0;
- Apostadores[playerid][Aposta] = valor;
- Apostadores[playerid][Apostando] = true;
- format(string, sizeof(string), "{FCB876}[Jogo Do Bicho] {a9c4e4}Você apostou R$%i no animal %s(Grupo %i)", valor, TabelaBichos[animal][Bicho], animal);
- return SendClientMessage(playerid, -1, string);
- }
- }
- }
- return 1;
- }
- forward ResultadoBicho();
- public ResultadoBicho() {
- new resultado_mil = randomEx(10,99),
- resultado_dez = randomEx(10,99),
- animal = PegarBicho(resultado_dez),
- ganhadores,
- string[256],
- Msg[256];
- format(Msg, sizeof(Msg), "{FCB876}[Jogo Do Bicho] {a9c4e4}O número sorteado foi: {ffffff}%i%i{a9c4e4}!", resultado_mil, resultado_dez);
- SendClientMessageToAll(0xffffffff, Msg);
- format(Msg, sizeof(Msg), "{FCB876}[Jogo Do Bicho] {a9c4e4}Animal: {ffffff}%s{a9c4e4}(Grupo {ffffff}%i{a9c4e4}) - Dezena {ffffff}%i{a9c4e4}!", TabelaBichos[animal][Bicho], animal, resultado_dez);
- SendClientMessageToAll(0xffffffff, Msg);
- printf("Número: %i%i | Animal: %s (dezena %i)", resultado_mil, resultado_dez, TabelaBichos[animal][Bicho], resultado_dez);
- for(new i;i < sizeof(Apostadores);i++) {
- if(Apostadores[i][Animal] == animal) {
- ganhadores++;
- GivePlayerMoney(i, (Apostadores[i][Aposta] * 14));
- format(string, sizeof(string), "{FCB876}[Jogo Do Bicho] Parabens! Você apostou no animal %s e ganhou 14x sua aposta de R$%i!", TabelaBichos[animal][Bicho], Apostadores[i][Aposta]);
- SendClientMessage(i, -1, string);
- }
- Apostadores[i][Animal] = 0;
- Apostadores[i][TipoAposta] = 0;
- Apostadores[i][Aposta] = 0;
- Apostadores[i][Apostando] = false;
- if(i == sizeof(Apostadores)-1) {
- format(Msg, sizeof(Msg), "{FCB876}[Jogo Do Bicho] {a9c4e4}Tivemos um total de %i vencedores!", ganhadores);
- SendClientMessageToAll(0xffffffff, Msg);
- break;
- }
- }
- UltimoResultado = gettime();
- PodeApostarBicho = true;
- SetTimerEx("FecharBicho", (TempoJogoDoBicho-(TempoJogoDoBicho / 4)), false, "");
- return 1;
- }
- forward FecharBicho();
- public FecharBicho() {
- PodeApostarBicho = false;
- new Msg[512];
- format(Msg, sizeof(Msg), "{FCB876}[Jogo Do Bicho] {a9c4e4}O resultado irá sair daqui {ffffff}%i{a9c4e4} segundos! As apostas estão fechadas.", ((TempoJogoDoBicho / 4) / 1000));
- SendClientMessageToAll(0xffffffff, Msg);
- return 1;
- }
- MostrarMenuBicho(playerid) {
- new lista[1024];
- format(lista, sizeof(lista), "{a9c4e4}Apostar\r\n{a9c4e4}Lista de bichos\r\n{FCB876}Como jogar?");
- return ShowPlayerDialog(playerid, DialogJogoDoBichoMenu, DIALOG_STYLE_LIST, "{FCB876}#{ffffff}Bicho | Menu", lista, "OK", "");
- }
- MostrarMenuTipoAposta(playerid) {
- if(!PodeApostarBicho) return SendClientMessage(playerid, -1, "{FCB876}[Jogo Do Bicho] {a9c4e4}Falta pouco para sair o resultado do jogo do bicho, então as apostas estão fechadas.");
- if(Apostadores[playerid][Apostando]) return SendClientMessage(playerid, -1, "{FCB876}[Jogo Do Bicho] {a9c4e4}Você já fez uma aposta, aguarde o resultado.");
- new lista[1024];
- format(lista, sizeof(lista), "{a9c4e4}Aposta de Grupos\r\n");
- return ShowPlayerDialog(playerid, DialogJogoDoBichoTipoAposta, DIALOG_STYLE_LIST, "{FCB876}#{ffffff}Bicho | Apostar", lista, "OK", "Voltar");
- }
- MostrarMenuTabela(playerid) {
- new lista[2048];
- format(lista, sizeof(lista), "Grupo\tAnimal\tDezenas\n");
- for(new i = 1; i < sizeof(TabelaBichos);i++) {
- format(lista, sizeof(lista), "%s{FCB876}%i\t{a9c4e4}%s\t%i-%i-%i-%i\n", lista, i, TabelaBichos[i][Bicho], TabelaBichos[i][Dezenas][0], TabelaBichos[i][Dezenas][1], TabelaBichos[i][Dezenas][2], TabelaBichos[i][Dezenas][3]);
- }
- return ShowPlayerDialog(playerid, DialogJogoDoBichoTabela, DIALOG_STYLE_TABLIST_HEADERS, "{ffff00}#{ffffff}Bicho | Lista de bichos", lista, "OK", "Voltar");
- }
- PegarBicho(numero) {
- new animal;
- for(new i = 1; i < sizeof(TabelaBichos);i++) {
- for(new b; b < 4;b++) {
- if(TabelaBichos[i][Dezenas][b] == numero) {
- animal = i;
- break;
- }
- }
- }
- return animal;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement