Advertisement
Guest User

[FS] Easy Lottery System BASE

a guest
Jun 14th, 2013
1,405
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.47 KB | None | 0 0
  1. /*
  2.                    FULLY spaces Theft Credit or
  3.         Publication of this filterscript without my permission.
  4.  
  5.         EASY FILTERSCRIPT --> Easy Lottery System BASE
  6.         CREDITOS: OTACON ;)
  7.         NOTA: Menos Creditos para los que me los critican.. JO'PUTAS! :D xD ;)
  8. */
  9.  
  10. // ========== [ -|- FUNCTION -|- ] ==========
  11. #include <a_samp>
  12. #include <zcmd>
  13. #include <sscanf2>
  14.  
  15. #define ID_LOTERIA (1) //The id of the menu of the lottery.
  16. #define VALOR_TICKET (500) //The value of the ticket.
  17. #define TIEMPO_LOTERIA (30) //cada 30 Minutos sorteara.
  18. #define PREMIO_INICIAL (100) //initial well lottery is multiplied according to the number of ticket's sold.
  19. #define POZO_LIMITE (200)  //the limit for the initial well will return.
  20. new NumeroLoteria[MAX_PLAYERS];
  21. new PozoLoteria=PREMIO_INICIAL;
  22. new bool:TicketLoteria[MAX_PLAYERS]=false;
  23. new MatarLoteria;
  24. new PozoLoteriaLimite=0;
  25.  
  26. public OnFilterScriptInit() {
  27.     MatarLoteria=SetTimer("Lottery", TIEMPO_LOTERIA*60000, true);
  28.     return true;
  29. }
  30. public OnFilterScriptExit() {
  31.     KillTimer(MatarLoteria);
  32.     return true;
  33. }
  34. COMMAND:ticket(playerid, params[]) {
  35.     ShowPlayerDialog(playerid,ID_LOTERIA+0, DIALOG_STYLE_INPUT, "Easy Lottery System BASE", "Enter a number between 0 and 100:", "Buy "," Exit ");
  36.     return true;
  37. }
  38. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){
  39.     new str[128];
  40.     switch(dialogid) {
  41.         case ID_LOTERIA+0: {
  42.             if(response) {
  43.                 if(sscanf(inputtext, "d", inputtext[0])) return ShowPlayerDialog(playerid,ID_LOTERIA+0, DIALOG_STYLE_INPUT, "Easy Lottery System BASE", "Enter a number between 0 and 100: \nNumeric value is permitted", "Buy "," Exit ");
  44.                 if(inputtext[0]<0 || inputtext[0]>100) return ShowPlayerDialog(playerid,ID_LOTERIA+0, DIALOG_STYLE_INPUT, "Easy Lottery System BASE", "Enter a number between 0 and 100: \nnot go below 0 or above 100", "Buy "," Exit ");
  45.                 if(TicketLoteria[playerid]==true) return ShowPlayerDialog(playerid,ID_LOTERIA+0, DIALOG_STYLE_INPUT, "Easy Lottery System BASE", "Enter a number between 0 and 100: \nalready bought a ticket", "Buy "," Exit ");
  46.                 if(GetPlayerMoney(playerid)<VALOR_TICKET) return ShowPlayerDialog(playerid,ID_LOTERIA+0, DIALOG_STYLE_INPUT, "Easy Lottery System BASE", "Enter a number between 0 and 100: \nnot have enough money to buy a ticket", "Buy "," Exit ");
  47.                 NumeroLoteria[playerid]=inputtext[0];
  48.                 TicketLoteria[playerid]=true;
  49.                 GivePlayerMoney(playerid,(0-VALOR_TICKET));
  50.                 PozoLoteriaLimite++;
  51.                 format(str, sizeof(str), "You have bought a lottery ticket with the number %d, to a value of %d dollars.", NumeroLoteria[playerid], VALOR_TICKET);
  52.                 SendClientMessage(playerid, -1, str);
  53.                 new count=0;
  54.                 for(new i=0; i<GetMaxPlayers(); i++) {
  55.                     if(!IsPlayerConnected(i)) continue;
  56.                     if(IsPlayerConnected(i) && TicketLoteria[i]==true) { count++; break; }
  57.                 }
  58.                 if(count==POZO_LIMITE) PozoLoteriaLimite=0;
  59.             }
  60.         }
  61.     }
  62.     return false;
  63. }
  64. forward Lottery();
  65. public Lottery() {
  66.     new str[200];
  67.     for(new player=0; player<GetMaxPlayers(); player++) {
  68.         if(!IsPlayerConnected(player) || TicketLoteria[player]!=true) continue;
  69.         if(IsPlayerConnected(player) && TicketLoteria[player]!=false) {
  70.             new numero=random(100);
  71.             if(NumeroLoteria[player]==numero) {
  72.                 format(str, sizeof(str), "~y~lottery raffled~n~~w~Number drawn was the ~g~%d~w~~n~with a prize of ~g~$%d~w~ dollars.~n~~g~Make won the lottery, Congratulations!.", numero, PozoLoteria*PozoLoteriaLimite);
  73.                 GameTextForPlayer(player, str, 15*1000, 3);
  74.                 GivePlayerMoney(player,(0+PozoLoteria*PozoLoteriaLimite));
  75.                 NumeroLoteria[player]=0;
  76.                 TicketLoteria[player]=false;
  77.             } else {
  78.                 format(str, sizeof(str), "~y~lottery raffled~n~~w~Number drawn was the ~g~%d~w~~n~with a prize of ~g~$%d~w~ dollars.~n~~r~You have lost the lottery, Luck!.", numero, PozoLoteria*PozoLoteriaLimite);
  79.                 GameTextForPlayer(player, str, 15*1000, 3);
  80.                 NumeroLoteria[player]=0;
  81.                 TicketLoteria[player]=false;
  82.             }
  83.         }
  84.     }
  85. }
  86. // ========== [ -|- FUNCTION -|- ] ==========
  87.  
  88. /*
  89.                    FULLY spaces Theft Credit or
  90.         Publication of this filterscript without my permission.
  91.  
  92.         EASY FILTERSCRIPT --> Easy Lottery System BASE
  93.         CREDITOS: OTACON ;)
  94.         NOTA: Menos Creditos para los que me los critican.. JO'PUTAS! :D xD ;)
  95. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement