Advertisement
Guest User

[FS] Simple Sistema de Lotería BASE By OTACON

a guest
Jun 14th, 2013
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.61 KB | None | 0 0
  1.  
  2. /*
  3.              Prohibido TOTALMENTE el Robo de Créditos o la
  4.             Publicación de este FILTERSCRIPT sin Mi Permiso.
  5.  
  6.         SIMPLE FILTERSCRIPT --> Simple Sistema de Lotería BASE
  7.         CREDITOS: OTACON ;)
  8.         NOTA: Menos Creditos para los que me los critican.. JO'PUTAS! :D xD ;)
  9. */
  10.  
  11. // ========== [ -|- FUNCION -|- ] ==========
  12. #include <a_samp>
  13. #include <zcmd>
  14. #include <sscanf2>
  15.  
  16. #define ID_LOTERIA (1) //El id del menu de la  loteria.
  17. #define VALOR_TICKET (500) //El valor el ticket.
  18. #define TIEMPO_LOTERIA (30) //cada 30 Minutos sorteara.
  19. #define PREMIO_INICIAL (100) //el pozo inicial de la loteria, se multiplicada segun la cantidad de ticket's vendidos.
  20. #define POZO_LIMITE (200)  //el limite para ke volvera al pozo inicial.
  21. new NumeroLoteria[MAX_PLAYERS];
  22. new PozoLoteria=PREMIO_INICIAL;
  23. new bool:TicketLoteria[MAX_PLAYERS]=false;
  24. new MatarLoteria;
  25. new PozoLoteriaLimite=0;
  26.  
  27. public OnFilterScriptInit() {
  28.     MatarLoteria=SetTimer("Loteria", TIEMPO_LOTERIA*60000, true);
  29.     return true;
  30. }
  31. public OnFilterScriptExit() {
  32.     KillTimer(MatarLoteria);
  33.     return true;
  34. }
  35. COMMAND:ticket(playerid, params[]) {
  36.     ShowPlayerDialog(playerid,ID_LOTERIA+0, DIALOG_STYLE_INPUT, "Simple Sistema de Lotería BASE", "Introduzca un número entre 0 y 100:", "Comprar", "Salir");
  37.     return true;
  38. }
  39. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){
  40.     new str[128];
  41.     switch(dialogid) {
  42.         case ID_LOTERIA+0: {
  43.             if(response) {
  44.                 if(sscanf(inputtext, "d", inputtext[0])) return ShowPlayerDialog(playerid,ID_LOTERIA+0, DIALOG_STYLE_INPUT, "Simple Sistema de Lotería BASE", "Introduzca un número entre 0 y 100: \nValor numérico que se permite", "Comprar", "Salir");
  45.                 if(inputtext[0]<0 || inputtext[0]>100) return ShowPlayerDialog(playerid,ID_LOTERIA+0, DIALOG_STYLE_INPUT, "Simple Sistema de Lotería BASE", "Introduzca un número entre 0 y 100: \nno ir por debajo de 0 o por encima de 100", "Comprar", "Salir");
  46.                 if(TicketLoteria[playerid]==true) return ShowPlayerDialog(playerid,ID_LOTERIA+0, DIALOG_STYLE_INPUT, "Simple Sistema de Lotería BASE", "Introduzca un número entre 0 y 100: \nya ha comprado un billete", "Comprar", "Salir");
  47.                 if(GetPlayerMoney(playerid)<VALOR_TICKET) return ShowPlayerDialog(playerid,ID_LOTERIA+0, DIALOG_STYLE_INPUT, "Simple Sistema de Lotería BASE", "Introduzca un número entre 0 y 100: \nno tienen suficiente dinero para comprar un billete", "Comprar", "Salir");
  48.                 NumeroLoteria[playerid]=inputtext[0];
  49.                 TicketLoteria[playerid]=true;
  50.                 GivePlayerMoney(playerid,(0-VALOR_TICKET));
  51.                 PozoLoteriaLimite++;
  52.                 format(str, sizeof(str), "Ha comprado un billete de lotería con el número %d, a un valor de %d dólares.", NumeroLoteria[playerid], VALOR_TICKET);
  53.                 SendClientMessage(playerid, -1, str);
  54.                 new count=0;
  55.                 for(new i=0; i<GetMaxPlayers(); i++) {
  56.                     if(!IsPlayerConnected(i)) continue;
  57.                     if(IsPlayerConnected(i) && TicketLoteria[i]==true) { count++; break; }
  58.                 }
  59.                 if(count==POZO_LIMITE) PozoLoteriaLimite=0;
  60.             }
  61.         }
  62.     }
  63.     return false;
  64. }
  65. forward Loteria();
  66. public Loteria() {
  67.     new str[200];
  68.     for(new player=0; player<GetMaxPlayers(); player++) {
  69.         if(!IsPlayerConnected(player) || TicketLoteria[player]!=true) continue;
  70.         if(IsPlayerConnected(player) && TicketLoteria[player]!=false) {
  71.             new numero=random(100);
  72.             if(NumeroLoteria[player]==numero) {
  73.                 format(str, sizeof(str), "~y~Loteria Sorteada~n~~w~Numero sorteado fue el ~g~%d~w~~n~con a pozo de ~g~$%d~w~ Dolares.~n~~g~Haz ganado la loteria, Felicitaciones!.", numero, PozoLoteria*PozoLoteriaLimite);
  74.                 GameTextForPlayer(player, str, 15*1000, 3);
  75.                 GivePlayerMoney(player,(0+PozoLoteria*PozoLoteriaLimite));
  76.                 NumeroLoteria[player]=0;
  77.                 TicketLoteria[player]=false;
  78.             } else {
  79.                 format(str, sizeof(str), "~y~Loteria Sorteada~n~~w~Numero sorteado fue el ~g~%d~w~~n~con un pozo de ~g~$%d~w~ Dolares.~n~~r~Haz perdido la loteria, Suerte!.", numero, PozoLoteria*PozoLoteriaLimite);
  80.                 GameTextForPlayer(player, str, 15*1000, 3);
  81.                 NumeroLoteria[player]=0;
  82.                 TicketLoteria[player]=false;
  83.             }
  84.         }
  85.     }
  86. }
  87. // ========== [ -|- FUNCION -|- ] ==========
  88.  
  89. /*
  90.              Prohibido TOTALMENTE el Robo de Créditos o la
  91.             Publicación de este FILTERSCRIPT sin Mi Permiso.
  92.  
  93.         SIMPLE FILTERSCRIPT --> Sistema de Lotería BASE
  94.         CREDITOS: OTACON ;)
  95.         NOTA: Menos Creditos para los que me los critican.. JO'PUTAS! :D xD ;)
  96. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement