Que opinan de mi codigo, se podria optimizar?
#1

Hola estoy haciendo un sistema de pagos diarios y como soy nuevo en pawn me gustaria conocer la opinion de los que mas saben del lenguaje sobre mi codigo.

pawn Код:
new TiempoJugando[MAX_PLAYERS];

SetTimer("PagoDiario", 60000, true);    // 1 minuto

public PagoDiario(playerid)
{
    new hora, minuto, segundo, string[128];
    gettime(hora, minuto, segundo);
   
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i) & JugadorLogueado[i] == 1)
        {
            TiempoJugando[i]++;
        }
    }
   
    if (minuto == 0 || minuto == 1)
    {
        SetWorldTime(hora);
        for (new i = 0; i < MAX_PLAYERS; i++)
        {
            if (IsPlayerConnected(i) & JugadorLogueado[i] == 1)
            {
                format(string, sizeof(string), "SERVIDOR: Hora de pago.");
                SendClientMessage(i, COLOR_BLANCO, string);
                if (TiempoJugando[playerid] >= 20)
                {
                    TiempoJugando[playerid] = 0;
                    JugadorInfo[playerid][Experiencia]++;
                    GuardarDato_INT(i, "usuarios", "Experiencia", JugadorInfo[playerid][Experiencia]);
                    format(string, sizeof(string), "SERVIDOR: Felicidades, has recibido tu pago diario.");
                    SendClientMessage(i, COLOR_BLANCO, string);
                }
                else
                {
                    TiempoJugando[playerid] = 0;
                    format(string, sizeof(string), "SERVIDOR: No has jugado lo suficiente para recibir tu pago.");
                    SendClientMessage(i, COLOR_BLANCO, string);
                }
            }
        }
    }
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)