Ayuda con el sistema de prestamos de OTACON xD
#1

Estuve adaptando el sistema de prestamos de OTACON xd, pero tengo un problema, no puedo restarle el dinero que pidio en el prestamo en el PD (Pago Diario) Miren, esto hize.

pawn Код:
timer severTimers2[1000](){
    foreach(Player, i){
        if(IsPlayerConnected(i) && gPlayerLogged{i} == 1){
            if(Info[i][pTimePayDay] >= 0)
            {
                new string[128];
                Info[i][pTimePayDay]++;
                if(Info[i][pTimePayDay] >= 3600){
                    new tmpintrate, interest, paytotal;
                        tmpintrate = 1;
                    interest = (Info[i][pAccount]/1000)*(tmpintrate);
                    paytotal = Info[i][pPayCheck]-TaxValue;
                    paytotal = Info[i][pPayCheck]-DineroPrestamo;
                    if(Info[i][pVIP] == 0 && interest > 1000) interest = 1000;
                    else if(Info[i][pVIP] == 1 && interest > 2000) interest = 2000;
                    else if(Info[i][pVIP] == 2 && interest > 3000) interest = 3000;
                    else if(Info[i][pVIP] == 3 && interest > 5000) interest = 5000;
                    else if(Info[i][pVIP] >= 4 && interest > 5000) interest = 5000;
                    Info[i][pAccount] += interest;
                    if(Info[i][p_Pr_Time] == 10){
                        SendClientMessageEx(i, COLOR_WHITE, "  Ya puedes volver hacer viajes de camionero.");
                        Info[i][p_Pr_Time] = 0;
                    }
                    if(Info[i][pRenting] != INVALID_HOUSE_ID){
                        if(HouseInfo[Info[i][pRenting]][hRentFee] > Info[i][pAccount]){
                            Info[i][pRenting] = INVALID_HOUSE_ID;
                            SendClientMessageEx(i, COLOR_WHITE, "Fuiste desalojado de la casa que rentabas.");
                        }
                        else{
                            HouseInfo[Info[i][pRenting]][hSafeMoney] += HouseInfo[Info[i][pRenting]][hRentFee];
                            Info[i][pAccount] -= HouseInfo[Info[i][pRenting]][hRentFee];
                        }
                    }
                    Info[i][pRob] = 0;
                    if(Info[i][pVIP] >= 4) Info[i][pVTokens]+= 2;
                    if(Info[i][pDobleExp] == 0){Info[i][pExp] += 1;}
                    else{
                        Info[i][pExp] += 2;
                        Info[i][pDobleExp]--;
               
                    }
SendClientMessageEx(i, COLOR_WHITE,         "|____________RESUMEN DE TU CUENTA____________| ");
format(string, sizeof(string),              " " );
SendClientMessageEx(i, COLOR_GRAD2, string);
format(string, sizeof(string),              " {FFFFFF}Pago diario: {00FF00}$%d {FFFFFF} | Gastos: {FF0000}-$%d {FFFFFF} | Total: {00FF00}$%d {FFFFFF} ", Info[i][pPayCheck], TaxValue, paytotal);
SendClientMessageEx(i, COLOR_GRAD2, string);
               Info[i][pCash] += paytotal;
format(string, sizeof(string),              " {FFFFFF}Saldo bancario: {00FF00}%d$ | {FFFFFF}Intereses (Ganancia): {00FF00}$%d |", Info[i][pAccount], interest);
format(string, sizeof(string),              " {FFFFFF}Prestamista: {FF0000}-%d {FFFFFF}| Pago por faccion: {00FF00}$", DineroPrestamo);
SendClientMessageEx(i, COLOR_GRAD2, string);
SendClientMessageEx(i, COLOR_WHITE,         "|________________FIN DE RESUMEN________________|");
                    GivePlayerCash(i, paytotal);
                    Info[i][pPayCheck] = 500;
                    Info[i][pTimePayDay] = 0;
                    Info[i][pConnectTime] += 1;
                    RewardPlayer(i);
                    OnPlayerSavedStats(i);
                    GameTextForPlayer(i, "~y~Pago~n~~w~Diario", 5000, 1);
                    if(Info[i][pConnectTime] == 2){
                        Info[i][pWRestricted] = 0;

                    }
                    if(Info[i][pAdiccion] > 0) Info[i][pAdiccion] -= 2;
                    if(Info[i][pWRestricted] > 0){
                        Info[i][pWRestricted]--;

                    }
                    if(Info[i][pMember] == 6)
                    {
                        GivePlayerMoney(i,17000);
                        SendClientMessageEx(i, COLOR_GRAD2, "Paga por servicios al Estado: $17.000");
                    }
                }
            }
Errores:

pawn Код:
(51861) : error 033: array must be indexed (variable "DineroPrestamo")
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
Ya se, tengo que leerme algunos tutoriales sobre array xD si alguien tiene alguno bueno me lo pasa si? :B
Reply
#2

Quote:
Originally Posted by Jejox
Посмотреть сообщение
Creo que no es necesario poner el sistema si el error esta hay

Y nadie me ayudo todavнa xD Este otacon creando polemica casi siempre xd


EDIT: Hay cambie el titulo.- Lo avнa puesto asн para que sepan que sistema es porque no tenia ganas de ponerlo todo acб si el error esta solo hay.
El error a simple vista no estб ahн, pasame como definiste la variable DineroPrestamo
Reply
#3

Quote:
Originally Posted by GROVE22
Посмотреть сообщение
El error a simple vista no estб ahн, pasame como definiste la variable DineroPrestamo
pawn Код:
DineroPrestamo[MAX_PLAYERS];
pawn Код:
COMMAND:pedirprestamo(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 3.0,987.5261,-1171.0029,25.1659))
    {
        new data[100];
        if(PrestamoActivo[playerid]==true) return SendClientMessage(playerid,-1,"INFO: Usted se encuentra con un prestamo pendiente!.");
        if(CantidadPrestamo[playerid]>=MAX_PRESTAMO) return SendClientMessage(playerid,-1,"INFO: Usted ya ha pedido demasiados prestamos!.");
        if(sscanf(params, "dd", params[0], params[1])) return SendClientMessage(playerid,-1,"INFO: Escribe: /pedirprestamo [dinero(100-5000)] [cuotas(0-6-12-24)]");
        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!.");
        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!.");
            PrestamoActivo[playerid]=true;
        KillTimer(MatarPrestamo[playerid]);
        MatarPrestamo[playerid]=SetTimerEx("Prestamista", TIEMPO_PRESTAMO, true, "d", playerid);
        DineroPrestamo[playerid]=params[0];
        CuotasPrestamo[playerid]=params[1];
        GivePlayerCash(playerid, (0+DineroPrestamo[playerid]));
        PrestamoActivo[playerid]++;
        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]);
        SendClientMessage(playerid,-1,data);
        return true;
    }
    else SendClientMessageEx(playerid, COLOR_GREY, "Para pedir un prestamo necesitas estar en el banco central de los santos. (/gps)");
    return 1;
}
Reply
#4

Quote:
Originally Posted by Jejox
Посмотреть сообщение
pawn Код:
DineroPrestamo[MAX_PLAYERS];
pawn Код:
COMMAND:pedirprestamo(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 3.0,987.5261,-1171.0029,25.1659))
    {
        new data[100];
        if(PrestamoActivo[playerid]==true) return SendClientMessage(playerid,-1,"INFO: Usted se encuentra con un prestamo pendiente!.");
        if(CantidadPrestamo[playerid]>=MAX_PRESTAMO) return SendClientMessage(playerid,-1,"INFO: Usted ya ha pedido demasiados prestamos!.");
        if(sscanf(params, "dd", params[0], params[1])) return SendClientMessage(playerid,-1,"INFO: Escribe: /pedirprestamo [dinero(100-5000)] [cuotas(0-6-12-24)]");
        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!.");
        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!.");
            PrestamoActivo[playerid]=true;
        KillTimer(MatarPrestamo[playerid]);
        MatarPrestamo[playerid]=SetTimerEx("Prestamista", TIEMPO_PRESTAMO, true, "d", playerid);
        DineroPrestamo[playerid]=params[0];
        CuotasPrestamo[playerid]=params[1];
        GivePlayerCash(playerid, (0+DineroPrestamo[playerid]));
        PrestamoActivo[playerid]++;
        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]);
        SendClientMessage(playerid,-1,data);
        return true;
    }
    else SendClientMessageEx(playerid, COLOR_GREY, "Para pedir un prestamo necesitas estar en el banco central de los santos. (/gps)");
    return 1;
}
Y como te dije la definiste mal, DineroPrestamo es global o individual?

Si la defines: new DineroPrestamo[MAX_PLAYERS];

luego la tienes que suar DineroPrestamo[IDDEJUGADOR]; que mayormente IDDEJUGADOR es playerid

________________________________

Si la defines new DineroPrestamo;

tienes que utilizar DineroPrestamo; y listo, tu la definiste individual y la utilizas global.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)