06.03.2016, 15:19
Criei esse sistema de tempo jogado e ele funciona atй certa parte:
Essa lуgica й boa, n necessita quebrar a cabeзa atrбs de includes/plugins, porйm quando chega na ultima parte
Tudo deveria ser setado para 0 e o dia para 1, porйm quando chega na hora de mudar para dia:
dia == 0, hora == 24, min == 0 e seg == 0
O dia continua 0 e a hora vira 24, o restante fica com 0.
Alguй saberia dizer o q й?
@RESOLVIDO
Eu fiz as condicionas ao contrбrio e deu certo:
PHP код:
forward UpdateTime(playerid);
public UpdateTime(playerid)
{
if ( USER[ playerid ][ pLOGADO ] == true )
{
USER[ playerid ][ pSEGUNDOS ] += 1;
if ( USER[ playerid ][ pSEGUNDOS ] >= 60 )
{
USER[ playerid ][ pSEGUNDOS ] = 0;
USER[ playerid ][ pMINUTOS ] += 1;
}
else if ( USER[ playerid ][ pMINUTOS ] >= 59 && USER[ playerid ][ pSEGUNDOS ] >= 59 )
{
USER[ playerid ][ pMINUTOS ] = 0;
USER[ playerid ][ pSEGUNDOS ] = 0;
USER[ playerid ][ pHORAS ] += 1;
}
else if ( USER[ playerid ][ pHORAS ] >= 23 && USER[ playerid ][ pMINUTOS ] >= 59 && USER[ playerid ][ pSEGUNDOS ] >= 59 )
{
USER[ playerid ][ pMINUTOS ] = 0;
USER[ playerid ][ pSEGUNDOS ] = 0;
USER[ playerid ][ pHORAS ] = 0;
USER[ playerid ][ pDIAS ] += 1;
}
}
return 1;
}
Quote:
(horas >= 23 && min >= 59 && seg >= 59) |
dia == 0, hora == 24, min == 0 e seg == 0
O dia continua 0 e a hora vira 24, o restante fica com 0.
Alguй saberia dizer o q й?
@RESOLVIDO
Eu fiz as condicionas ao contrбrio e deu certo:
PHP код:
forward UpdateTime(playerid);
public UpdateTime(playerid)
{
if ( USER[ playerid ][ pLOGADO ] == true )
{
USER[ playerid ][ pSEGUNDOS ] += 1;
if ( USER[ playerid ][ pHORAS ] >= 23 && USER[ playerid ][ pMINUTOS ] >= 59 && USER[ playerid ][ pSEGUNDOS ] >= 60 )
{
USER[ playerid ][ pHORAS ] = 0;
USER[ playerid ][ pMINUTOS ] = 0;
USER[ playerid ][ pSEGUNDOS ] = 0;
USER[ playerid ][ pDIAS ] += 1;
}
else if ( USER[ playerid ][ pMINUTOS ] >= 59 && USER[ playerid ][ pSEGUNDOS ] >= 60 )
{
USER[ playerid ][ pMINUTOS ] = 0;
USER[ playerid ][ pSEGUNDOS ] = 0;
USER[ playerid ][ pHORAS ] += 1;
}
else if ( USER[ playerid ][ pSEGUNDOS ] >= 60 )
{
USER[ playerid ][ pSEGUNDOS ] = 0;
USER[ playerid ][ pMINUTOS ] += 1;
}
SaveAccount ( playerid );
}
return 1;
}