12.11.2017, 01:28
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.
Chamando o timer na callback OnPlayerSpawn:
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 I = 0; I < MAX_PLAYERS; I++)
{
if(pHunger[I] == 0)
{
SetPlayerHealth(I, 0.0);
kpHunger[I] = 1;
pHunger[I] = -1;
pThirst[I] = -1;
pSleep[I] = -1;
SetPlayerProgressBarValue(I, cCMbnbarsVar[0][I], pHunger[I]);
ShowPlayerProgressBar(I, cCMbnbarsVar[0][I]);
}
pHunger[I] --;
SetPlayerProgressBarValue(I, cCMbnbarsVar[0][I], pHunger[I]);
ShowPlayerProgressBar(I, cCMbnbarsVar[0][I]);
if(pHunger[I] < 5)
{
SendClientMessage(I, 0xC8E1FFAA, "| FOME | Vocк estб com muita fome, coma algo ou irб morrer!");
}
}
return 1;
}
public progress_pThirst()
{
for(new I = 0; I < MAX_PLAYERS; I++)
{
if(pThirst[I] == 0)
{
SetPlayerHealth(I, 0.0);
kpThirst[I] = 1;
pHunger[I] = -1;
pThirst[I] = -1;
pSleep[I] = -1;
SetPlayerProgressBarValue(I, cCMbnbarsVar[1][I], pThirst[I]);
ShowPlayerProgressBar(I, cCMbnbarsVar[1][I]);
}
pThirst[I] --;
SetPlayerProgressBarValue(I, cCMbnbarsVar[1][I], pThirst[I]);
ShowPlayerProgressBar(I, cCMbnbarsVar[1][I]);
if(pThirst[I] < 5)
{
SendClientMessage(I, 0xC8E1FFAA, "| SEDE | Vocк estб com muita sede, beba algo ou irб morrer!");
}
}
return 1;
}
public progress_pSleep()
{
for(new I = 0; I < MAX_PLAYERS; I++)
{
if(pSleep[I] == 0)
{
SetPlayerHealth(I, 0.0);
kpSleep[I] = 1;
pHunger[I] = -1;
pThirst[I] = -1;
pSleep[I] = -1;
SetPlayerProgressBarValue(I, cCMbnbarsVar[1][I], pThirst[I]);
ShowPlayerProgressBar(I, cCMbnbarsVar[1][I]);
}
pSleep[I] --;
SetPlayerProgressBarValue(I, cCMbnbarsVar[2][I], pSleep[I]);
ShowPlayerProgressBar(I, cCMbnbarsVar[2][I]);
if(pSleep[I] < 5)
{
SendClientMessage(I, 0xC8E1FFAA, "| SONO | Vocк estб com muito sono, durma ou irб morrer!");
}
}
return 1;
}
PHP код:
timerpHunger[playerid] = SetTimer("progress_pHunger", 360000, true);
timerpThirst[playerid] = SetTimer("progress_pThirst", 360000, true);
timerpSleep[playerid] = SetTimer("progress_pSleep", 360000, true);