09.12.2013, 17:18
Necesito ayuda para hacer un comando asi tipo /prestamo que se lo des a un user y cada cierto tiempo le quite cierta cantidad de dinero dependiendo de la cantidad del prestamo si se puede hacer gracias
#include <a_samp>
#include <zcmd> //https://sampforum.blast.hk/showthread.php?tid=91354
#define VALOR_INTERESES_INICIAL (150)
#define DINERO_PRESTAMO (1000)
#define TIEMPO_PRESTAMO (3*60000) //3 minutos
#define MAX_PRESTAMO (100)
new CantidadPrestamo[MAX_PLAYERS],
bool:PrestamoActivo[MAX_PLAYERS],
MatarPrestamo[MAX_PLAYERS],
InteresesPrestamo[MAX_PLAYERS];
COMMAND:pedirprestamo(playerid, params[]){
new data[100];
if(PrestamoActivo[playerid]==true) return SendClientMessage(playerid,-1,"ya haz sacado un prestamo!.");
if(CantidadPrestamo[playerid]>=MAX_PRESTAMO) return SendClientMessage(playerid,-1,"ya haz sacado demasiados prestamos!: ");
PrestamoActivo[playerid]=true;
KillTimer(MatarPrestamo[playerid]);
MatarPrestamo[playerid]=SetTimerEx("Prestamista", TIEMPO_PRESTAMO, true, "d", playerid);
GivePlayerMoney(playerid, (0+DINERO_PRESTAMO));
PrestamoActivo[playerid]++;
format(data,sizeof(data),"Has sacado un prestamo de: %d con unos intereses de: %d. ", DINERO_PRESTAMO, VALOR_INTERESES_INICIAL);
SendClientMessage(playerid,-1,data);
return true;
}
COMMAND:pagarprestamo(playerid, params[]){
new data[100];
if(PrestamoActivo[playerid]==true) return SendClientMessage(playerid,-1,"ya haz sacado un prestamo!.");
if(CantidadPrestamo[playerid]>=MAX_PRESTAMO) return SendClientMessage(playerid,-1,"ya haz sacado demasiados prestamos!: ");
PrestamoActivo[playerid]=false;
KillTimer(MatarPrestamo[playerid]);
GivePlayerMoney(playerid, (0-DINERO_PRESTAMO+VALOR_INTERESES_INICIAL*InteresesPrestamo[playerid]));
format(data,sizeof(data),"Has pagado el prestamo de: %d con unos intereses de: %d. ", DINERO_PRESTAMO, InteresesPrestamo[playerid]);
SendClientMessage(playerid,-1,data);
InteresesPrestamo[playerid]=0;
return true;
}
forward Prestamista(playerid);
public Prestamista(playerid){
new data[100];
if(PrestamoActivo[playerid]==true){
InteresesPrestamo[playerid]++;
format(data,sizeof(data),"se ha aumentado los intereses del prestamos a %d por el retraso.", VALOR_INTERESES_INICIAL*InteresesPrestamo[playerid]);
SendClientMessage(playerid,-1,data);
}
}