Advertisement
OtaconEvil

[FS] Mini Sistema 'PRESTAMOS' (BASE) By OTACON

Dec 10th, 2013
668
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 12.13 KB | None | 0 0
  1. /*
  2.     * ## LEASE ATENTAMENTE PARA NO CONVERTIRSE EN LAMMER!!.: :D ##
  3.     *
  4.     * Estè Simple FILTERSCRIPT esta hecho especialmente para www.forum.sa-mp.com
  5.     * NO Publicar estè FILTERSCRIPT en Otros foros de SA-MP y hacerse pasar por el creador del CODE.
  6.     *
  7.     * Codigo Creado Por OTACON
  8.     *
  9.     * CREDITOS:
  10.     *     OTACON: Realizacion y Idea de creacion del code.
  11.     *     TÙ: Modificacion libremente respetando lo mencionado ;).
  12.     *
  13.     *    NOTA: Menos Creditos para los que me los critican.. JO'PUTAS! :D xD ;)
  14.     *
  15.     *                Prohibido TOTALMENTE el Robo de Créditos o la
  16.     *                  Publicación de este FILTERSCRIPT sin Mi Permiso.
  17. */
  18. /*
  19.     * ## READ CAREFULLY TO AVOID BECOMING LAMMER!.: :D ##
  20.     *
  21.     * This simple FILTERSCRIPT is made especially for www.forum.sa-mp.com
  22.     * DO NOT Post the FILTERSCRIPT in Other SAMP forums and impersonating the creator of the CODE.
  23.     *
  24.     * Code Created By OTACON
  25.     *
  26.     * CREDITS:
  27.     *     OTACON: Idea Making and code creation.
  28.     *     YOUR: Modification freely respecting the above ;).
  29.     *
  30.     *    NOTE: Less Credits for those who criticize me.. JO'PUTAS! :D xD ;)
  31.     *
  32.     *                        FULLY spaces Theft Credit or
  33.     *                 Publication of this FILTERSCRIPT without my permission.
  34. */
  35. #include <a_samp>
  36. #include <zcmd> //http://forum.sa-mp.com/showthread.php?t=91354
  37. #include <sscanf2> //http://forum.sa-mp.com/showthread.php?t=120356
  38.  
  39. #define MAX_PRESTAMO (100) //Cantidad  de prestamos permitidos
  40. #define MINIMO_PRESTAMO (100) //10 dolares minimo para pedir
  41. #define MAXIMO_PRESTAMO (5000) //5000 dolares maximo para pedir
  42. #define VALOR_INTERESES_INICIAL (150) //150 dolares de intereses inicial
  43. #define TIEMPO_PRESTAMO (20*60000) //tiempo que sumara los intereses, 20 minutos
  44.  
  45. new CantidadPrestamo[MAX_PLAYERS],
  46. bool:PrestamoActivo[MAX_PLAYERS],
  47. MatarPrestamo[MAX_PLAYERS],
  48. InteresesPrestamo[MAX_PLAYERS],
  49. CuotasPrestamo[MAX_PLAYERS],
  50. DineroPrestamo[MAX_PLAYERS];
  51.  
  52. COMMAND:darprestamo(playerid, params[]){
  53.     new data[100], name1[MAX_PLAYER_NAME+1], name2[MAX_PLAYER_NAME+1];
  54.     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"INFO: Usted no esta autorizado a usar este comando!.");
  55.     if(sscanf(params, "rdd", params[0], params[1], params[2])) return SendClientMessage(playerid,-1,"INFO: Escribe: /darprestamo [id player] [dinero(100-5000)] [cuotas(0-6-12-24)]");
  56.     if(params[0]==INVALID_PLAYER_ID) return SendClientMessage(playerid,-1,"INFO: El jugador Ingresado no se id valido!.");
  57.     if(!IsPlayerConnected(params[0])) return SendClientMessage(playerid,-1,"INFO: El jugador Ingresado no se encuentra conectado!.");
  58.     if(params[0]==playerid) return SendClientMessage(playerid,-1,"INFO: El jugador Ingresado es su id, no puedes darte prestamos solo!.");
  59.     if(PrestamoActivo[params[0]]==true) return SendClientMessage(playerid,-1,"INFO: El jugador Ingresado ya se encuentra con un prestamo pendiente!.");
  60.     if(CantidadPrestamo[params[0]]>=MAX_PRESTAMO) return SendClientMessage(playerid,-1,"INFO: El jugador Ingresado ya ha pedido demasiados prestamos!.");
  61.     if(params[1]<MINIMO_PRESTAMO || params[1]>MAXIMO_PRESTAMO) return SendClientMessage(playerid,-1,"INFO: No ir por debajo de 100, o por arriba de 5000!.");
  62.     if(params[2]==0 || params[2]==6 || params[2]==12 || params[2]==24) return SendClientMessage(playerid,-1,"INFO: Las Cuotas disponibles son de 0-6-12-24!.");
  63.     PrestamoActivo[params[0]]=true;
  64.     KillTimer(MatarPrestamo[params[0]]);
  65.     MatarPrestamo[params[0]]=SetTimerEx("Prestamista", TIEMPO_PRESTAMO, true, "d", params[0]);
  66.     DineroPrestamo[params[0]]=params[1];
  67.     CuotasPrestamo[params[0]]=params[2];
  68.     GivePlayerMoney(params[0], (0+DineroPrestamo[params[0]]));
  69.     PrestamoActivo[params[0]]++;
  70.     GetPlayerName(params[0], name1, sizeof(name1));
  71.     format(data,sizeof(data),"Haz dado un prestamo a %s de: %d, con unos intereses de: %d por cuotas, cuotas a pagar: %d. ",name1, DineroPrestamo[params[0]], VALOR_INTERESES_INICIAL, CuotasPrestamo[params[0]]);
  72.     SendClientMessage(playerid,-1,data);
  73.     GetPlayerName(playerid, name2, sizeof(name2));
  74.     format(data,sizeof(data),"%s Ha dado un prestamo de: %d, con unos intereses de: %d por cuotas, cuotas a pagar: %d. ",name2, DineroPrestamo[params[0]], VALOR_INTERESES_INICIAL, CuotasPrestamo[params[0]]);
  75.     SendClientMessage(params[0],-1,data);
  76.     return true;
  77. }
  78. COMMAND:cobrarprestamo(playerid, params[]){
  79.     new data[100], name1[MAX_PLAYER_NAME+1], name2[MAX_PLAYER_NAME+1];
  80.     if(sscanf(params, "rd", params[0], params[1])) return SendClientMessage(playerid,-1,"INFO: Escribe: /cobrarprestamo [id player] [cuotas(0-6-12-24)]");
  81.     if(params[0]==INVALID_PLAYER_ID) return SendClientMessage(playerid,-1,"INFO: El jugador Ingresado no se id valido!.");
  82.     if(!IsPlayerConnected(params[0])) return SendClientMessage(playerid,-1,"INFO: El jugador Ingresado no se encuentra conectado!.");
  83.     if(params[0]==playerid) return SendClientMessage(playerid,-1,"INFO: El jugador Ingresado es su id, no puedes cobrarse prestamos solo!.");
  84.     if(PrestamoActivo[params[0]]==false) return SendClientMessage(playerid,-1,"INFO: El jugador Ingresado no se encuentra con un prestamo pendiente!.");
  85.     if(CantidadPrestamo[params[0]]<=0) return SendClientMessage(playerid,-1,"INFO: El jugador Ingresado no ha pedido ningun prestamos!.");
  86.     if(params[1]==0 || params[1]==6 || params[1]==12 || params[1]==24) return SendClientMessage(playerid,-1,"INFO: Las Cuotas disponibles son de 0-6-12-24!.");
  87.     if(GetPlayerMoney(params[0])>=DineroPrestamo[params[0]]/params[1]) return SendClientMessage(playerid,-1,"INFO: El jugador Ingresado no tiene esa cantidad de dinero encima!.");
  88.     CuotasPrestamo[params[0]]-=params[1];
  89.     if(CuotasPrestamo[params[0]]<=0){ PrestamoActivo[params[0]]=false; KillTimer(MatarPrestamo[params[0]]); }
  90.     GivePlayerMoney(params[0], (0-DineroPrestamo[params[0]]/CuotasPrestamo[params[0]]+VALOR_INTERESES_INICIAL*InteresesPrestamo[params[0]]));
  91.     GetPlayerName(params[0], name1, sizeof(name1));
  92.     format(data,sizeof(data),"Haz cobrado un prestamo a %s de: %d, con unos intereses de: %d, nuemro de cuota a pagar: %d. ", name1, DineroPrestamo[params[0]]/CuotasPrestamo[params[0]], InteresesPrestamo[params[0]], CuotasPrestamo[params[0]]);
  93.     SendClientMessage(playerid,-1,data);
  94.     GetPlayerName(playerid, name2, sizeof(name2));
  95.     format(data,sizeof(data),"Haz pagado un prestamo a %s de: %d, con unos intereses de: %d, nuemro de cuota a pagar: %d. ", name2, DineroPrestamo[params[0]]/CuotasPrestamo[params[0]], InteresesPrestamo[params[0]], CuotasPrestamo[params[0]]);
  96.     SendClientMessage(params[0],-1,data);
  97.     InteresesPrestamo[params[0]]=0;
  98.     return true;
  99. }
  100. COMMAND:resetprestamos(playerid, params[]){
  101.     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"INFO: Usted no esta autorizado a usar este comando!.");
  102.     if(sscanf(params, "r", params[0], params[1])) return SendClientMessage(playerid,-1,"INFO: Escribe: /resetprestamos [id player]");
  103.     if(params[0]==INVALID_PLAYER_ID) return SendClientMessage(playerid,-1,"INFO: El jugador Ingresado no se id valido!.");
  104.     if(!IsPlayerConnected(params[0])) return SendClientMessage(playerid,-1,"INFO: El jugador Ingresado no se encuentra conectado!.");
  105.     if(PrestamoActivo[params[0]]==false) return SendClientMessage(playerid,-1,"INFO: El jugador Ingresado no se encuentra con un prestamo pendiente!.");
  106.     if(PrestamoActivo[params[0]]==true) return SendClientMessage(playerid,-1,"INFO: El jugador Ingresado se encuentra con un prestamo pendiente!.");
  107.     if(CantidadPrestamo[params[0]]<=0) return SendClientMessage(playerid,-1,"INFO: El jugador Ingresado no ha pedido ningun prestamos!.");
  108.     CantidadPrestamo[params[0]]=0;
  109.     return true;
  110. }
  111. COMMAND:pedirprestamo(playerid, params[]){
  112.     new data[100];
  113.     if(PrestamoActivo[playerid]==true) return SendClientMessage(playerid,-1,"INFO: Usted se encuentra con un prestamo pendiente!.");
  114.     if(CantidadPrestamo[playerid]>=MAX_PRESTAMO) return SendClientMessage(playerid,-1,"INFO: Usted ya ha pedido demasiados prestamos!.");
  115.     if(sscanf(params, "dd", params[0], params[1])) return SendClientMessage(playerid,-1,"INFO: Escribe: /pedirprestamo [dinero(100-5000)] [cuotas(0-6-12-24)]");
  116.     if(params[0]<MINIMO_PRESTAMO || params[0]>MAXIMO_PRESTAMO) return SendClientMessage(playerid,-1,"INFO: No ir por debajo de 100, o por arriba de 5000!.");
  117.     if(params[1]==0 || params[1]==6 || params[1]==12 || params[1]==24) return SendClientMessage(playerid,-1,"INFO: Las Cuotas disponibles son de 0-6-12-24!.");
  118.     PrestamoActivo[playerid]=true;
  119.     KillTimer(MatarPrestamo[playerid]);
  120.     MatarPrestamo[playerid]=SetTimerEx("Prestamista", TIEMPO_PRESTAMO, true, "d", playerid);
  121.     DineroPrestamo[playerid]=params[0];
  122.     CuotasPrestamo[playerid]=params[1];
  123.     GivePlayerMoney(playerid, (0+DineroPrestamo[playerid]));
  124.     PrestamoActivo[playerid]++;
  125.     format(data,sizeof(data),"Has sacado un prestamo de: %d, con unos intereses de: %d por cuotas, cuotas a pagar: %d. ", DineroPrestamo[playerid], VALOR_INTERESES_INICIAL, CuotasPrestamo[playerid]);
  126.     SendClientMessage(playerid,-1,data);
  127.     return true;
  128. }
  129. COMMAND:pagarprestamo(playerid, params[]){
  130.     new data[100];
  131.     if(PrestamoActivo[playerid]==false) return SendClientMessage(playerid,-1,"INFO: Usted no se encuentra con un prestamo pendiente!.");
  132.     if(CantidadPrestamo[playerid]>=MAX_PRESTAMO) return SendClientMessage(playerid,-1,"INFO: Usted ya ha pedido demasiados prestamos!.");
  133.     if(sscanf(params, "d", params[0])) return SendClientMessage(playerid,-1,"INFO: Escribe: /pagarprestamo [cuotas(0-6-12-24)]");
  134.     if(params[0]==0 || params[0]==6 || params[0]==12 || params[0]==24) return SendClientMessage(playerid,-1,"INFO: Las Cuotas disponibles son de 0-6-12-24!.");
  135.     if(GetPlayerMoney(playerid)>=DineroPrestamo[playerid]/params[0]) return SendClientMessage(playerid,-1,"INFO: Usted no tiene esa cantidad de dinero encima!.");
  136.     CuotasPrestamo[playerid]-=params[0];
  137.     if(CuotasPrestamo[playerid]<=0){ PrestamoActivo[playerid]=false; KillTimer(MatarPrestamo[playerid]); }
  138.     GivePlayerMoney(playerid, (0-DineroPrestamo[playerid]/CuotasPrestamo[playerid]+VALOR_INTERESES_INICIAL*InteresesPrestamo[playerid]));
  139.     format(data,sizeof(data),"Has pagado el prestamo de: %d, con unos intereses de: %d, nuemro de cuota a pagar: %d. ", DineroPrestamo[playerid]/CuotasPrestamo[playerid], InteresesPrestamo[playerid], CuotasPrestamo[playerid]);
  140.     SendClientMessage(playerid,-1,data);
  141.     InteresesPrestamo[playerid]=0;
  142.     return true;
  143. }
  144. forward Prestamista(playerid);
  145. public Prestamista(playerid){
  146.     new data[100];
  147.     if(PrestamoActivo[playerid]==true){
  148.         InteresesPrestamo[playerid]++;
  149.         format(data,sizeof(data),"se ha aumentado los intereses del prestamos a %d por el retraso.", VALOR_INTERESES_INICIAL*InteresesPrestamo[playerid]);
  150.         SendClientMessage(playerid,-1,data);
  151.     }
  152. }
  153. /*
  154.     * ## LEASE ATENTAMENTE PARA NO CONVERTIRSE EN LAMMER!!.: :D ##
  155.     *
  156.     * Estè Simple FILTERSCRIPT esta hecho especialmente para www.forum.sa-mp.com
  157.     * NO Publicar estè FILTERSCRIPT en Otros foros de SA-MP y hacerse pasar por el creador del CODE.
  158.     *
  159.     * Codigo Creado Por OTACON
  160.     *
  161.     * CREDITOS:
  162.     *     OTACON: Realizacion y Idea de creacion del code.
  163.     *     TÙ: Modificacion libremente respetando lo mencionado ;).
  164.     *
  165.     *    NOTA: Menos Creditos para los que me los critican.. JO'PUTAS! :D xD ;)
  166.     *
  167.     *                Prohibido TOTALMENTE el Robo de Créditos o la
  168.     *                  Publicación de este FILTERSCRIPT sin Mi Permiso.
  169. */
  170. /*
  171.     * ## READ CAREFULLY TO AVOID BECOMING LAMMER!.: :D ##
  172.     *
  173.     * This simple FILTERSCRIPT is made especially for www.forum.sa-mp.com
  174.     * DO NOT Post the FILTERSCRIPT in Other SAMP forums and impersonating the creator of the CODE.
  175.     *
  176.     * Code Created By OTACON
  177.     *
  178.     * CREDITS:
  179.     *     OTACON: Idea Making and code creation.
  180.     *     YOUR: Modification freely respecting the above ;).
  181.     *
  182.     *    NOTE: Less Credits for those who criticize me.. JO'PUTAS! :D xD ;)
  183.     *
  184.     *                        FULLY spaces Theft Credit or
  185.     *                 Publication of this FILTERSCRIPT without my permission.
  186. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement