Posted by Deathmanthys on Sun 2 Nov 04:49
report abuse | download | new post
- #include <a_samp>
- #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
- #define COLOR_ACEPTO 0x40808096
- #define COLOR_GRAD1 0xB4B5B7FF
- #define COLOR_GRAD2 0xBFC0C2FF
- #define COLOR_GRAD3 0xCBCCCEFF
- #define COLOR_GRAD4 0xD8D8D8FF
- #define COLOR_GRAD5 0xE3E3E3FF
- #define COLOR_GRAD6 0xF0F0F0FF
- #define COLOR_GREY 0xAFAFAFAA
- #define COLOR_GREEN 0x33AA33AA
- #define COLOR_RED 0xAA3333AA
- #define COLOR_YELLOW 0xFFFF00AA
- #define COLOR_WHITE 0xFFFFFFAA
- #define COLOR_BLUE 0x0000BBAA
- #define COLOR_LIGHTBLUE 0x33CCFFAA
- #define COLOR_ORANGE 0xFF9900AA
- #define COLOR_LIME 0x99FF00AA
- #define COLOR_BLACK 0x000000AA
- #define COLOR_SYSTEM 0xFFFFFFAA
- #define COLOR_AZUL 0x0066FF
- #define COLOR_AMARILLOBAJO 0xF5E7AD96
- #define tiempo 300000 // Tiempo de sorteo: 5 Minutos (Default)
- #define costo 50 // Costo del Boleto
- forward Loteria(playerid);
- new string[256];
- new pueden = 0;
- new premio;
- new rand;
- new compro[MAX_PLAYERS]=-1; // -1 = no compro.
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------------");
- print(" Loteria de DanielSNM ~ Con numeros comprables");
- print("-------------------v1.4---------------------\n");
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- dcmd(nueva,5,cmdtext);
- dcmd(boleto,6,cmdtext);
- if (strcmp("/loterias", cmdtext, true, 10) == 0)
- {
- SendClientMessage(playerid,COLOR_GREEN,"-------Loterias-------");
- SendClientMessage(playerid,COLOR_YELLOW,"/nueva [premio] - Crear nueva Loteria (ADM).");
- SendClientMessage(playerid,COLOR_YELLOW,"/boleto [numero 0 - 10] - Comprar boleto. (Costo = $50)");
- return 1;
- }
- return 0;
- }
- dcmd_nueva(playerid , params[])
- {
- premio = strval(params);
- if(strlen(params)) {
- if(IsPlayerAdmin(playerid)) {
- pueden=1;
- for(new i; i < MAX_PLAYERS; i++) {
- compro[i]=-1;
- }
- format(string,256,"Has creado una loteria, en 5min se sorteara, el premio es de %d",premio);
- SendClientMessage(playerid,COLOR_ORANGE,string);
- format(string,256,"~y~En 10 min, se sortea una loteria por ~r~$%d ~n~~g~compra un boleto con /boleto [numero 0 - 45]",premio);
- GameTextForAll(string,5000,5);
- new rando = random(10);
- rand=rando;
- SetTimer("Loteria",tiempo,0);
- }
- }
- return 1;
- }
- dcmd_boleto(playerid, params[])
- {
- new numero;
- numero = strval(params);
- if(strlen(params)) {
- if(pueden==1) {
- compro[playerid]=numero;
- pueden=0;
- format(string,256,"Has comprado el numero: %d, $-50!",compro[playerid]);
- SendClientMessage(playerid,COLOR_GREEN,string);
- }
- }
- return 1;
- }
- public Loteria(playerid)
- {
- for(new i; i < MAX_PLAYERS; i++)
- {
- if(compro[i]==-1)
- {
- return 1;
- }
- else
- {
- if(compro[i]==rand)
- {
- GivePlayerMoney(playerid,premio);
- SendClientMessage(playerid,COLOR_YELLOW,"HAS GANADO LA LOTERIAAA!!!!");
- }
- else
- {
- SendClientMessage(playerid,COLOR_RED,"No ganaste nada, Intenta Otro Dia!");
- format(string,256,"El Numero era %d",rand);
- SendClientMessageToAll(COLOR_AMARILLOBAJO,string);
- }
- }
- }
- return 1;
- }
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.