[Ajuda] Timer Lombrado
#1

Galera, me ajudem por favor, tou com um problema aqui, jб tentei resolver de todas as formas que sei, porйm nгo obtive кxito...
O problema й o seguinte, eu coloco o timer para tirar 1 da variбvel que seria no total 100 a cada 6 minutos, no total teria que acabar em 10h, porйm tб acabando em 1h, 2h, tipo, й um sistema de fome, sede e sono, tou usando em GM limpo, padrгo do SA-MP, e antes que me perguntem, nгo tem nada que possa tб mexendo no code, se alguйm puder me ajudar, obrigado.

PHP код:
public progress_pHunger()
{
    for(new 
0MAX_PLAYERSI++)
    {
    if(
pHunger[I] == 0)
    {
    
SetPlayerHealth(I0.0);
    
kpHunger[I] = 1;
    
pHunger[I] = -1;
    
pThirst[I] = -1;
    
pSleep[I] = -1;
    
SetPlayerProgressBarValue(IcCMbnbarsVar[0][I], pHunger[I]);
    
ShowPlayerProgressBar(IcCMbnbarsVar[0][I]);
    }
    
pHunger[I] --;
     
SetPlayerProgressBarValue(IcCMbnbarsVar[0][I], pHunger[I]);
    
ShowPlayerProgressBar(IcCMbnbarsVar[0][I]);
    if(
pHunger[I] < 5)
    {
    
SendClientMessage(I0xC8E1FFAA"| FOME | Vocк estб com muita fome, coma algo ou irб morrer!");
    }
    }
    return 
1;
}
public 
progress_pThirst()
{
    for(new 
0MAX_PLAYERSI++)
    {
    if(
pThirst[I] == 0)
    {
    
SetPlayerHealth(I0.0);
    
kpThirst[I] = 1;
    
pHunger[I] = -1;
    
pThirst[I] = -1;
    
pSleep[I] = -1;
    
SetPlayerProgressBarValue(IcCMbnbarsVar[1][I], pThirst[I]);
    
ShowPlayerProgressBar(IcCMbnbarsVar[1][I]);
    }
    
pThirst[I] --;
     
SetPlayerProgressBarValue(IcCMbnbarsVar[1][I], pThirst[I]);
    
ShowPlayerProgressBar(IcCMbnbarsVar[1][I]);
    if(
pThirst[I] < 5)
    {
    
SendClientMessage(I0xC8E1FFAA"| SEDE | Vocк estб com muita sede, beba algo ou irб morrer!");
    }
    }
    return 
1;
}
public 
progress_pSleep()
{
    for(new 
0MAX_PLAYERSI++)
    {
    if(
pSleep[I] == 0)
    {
    
SetPlayerHealth(I0.0);
    
kpSleep[I] = 1;
    
pHunger[I] = -1;
    
pThirst[I] = -1;
    
pSleep[I] = -1;
    
SetPlayerProgressBarValue(IcCMbnbarsVar[1][I], pThirst[I]);
    
ShowPlayerProgressBar(IcCMbnbarsVar[1][I]);
    }
    
pSleep[I] --;
     
SetPlayerProgressBarValue(IcCMbnbarsVar[2][I], pSleep[I]);
    
ShowPlayerProgressBar(IcCMbnbarsVar[2][I]);
    if(
pSleep[I] < 5)
    {
    
SendClientMessage(I0xC8E1FFAA"| SONO | Vocк estб com muito sono, durma ou irб morrer!");
    }
    }
    return 
1;

Chamando o timer na callback OnPlayerSpawn:
PHP код:
timerpHunger[playerid] = SetTimer("progress_pHunger"360000true);
    
timerpThirst[playerid] = SetTimer("progress_pThirst"360000true);
    
timerpSleep[playerid] = SetTimer("progress_pSleep"360000true); 
Reply


Messages In This Thread
Timer Lombrado - by GuilhermeW - 12.11.2017, 01:28
Re: Timer Lombrado - by BykiLler - 12.11.2017, 01:51
Re: Timer Lombrado - by Andre02 - 12.11.2017, 04:02

Forum Jump:


Users browsing this thread: 1 Guest(s)