[ Solved ] My timer system +rep [ Solved thANKS ] - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [ Solved ] My timer system +rep [ Solved thANKS ] (
/showthread.php?tid=317711)
[ Solved ] My timer system +rep [ Solved thANKS ] -
RicaNiel - 12.02.2012
Guys there is a bug that i can't fix with my script
you see when it reaches 1 or 2 mins
the hours will become 1 i need it to be 60 mins then 1 hour
then the mins will reset to 0 and also seconds i need help
here is my code
pawn Код:
public LevelSystem(playerid)
{
pData[playerid][pSeconds] += 1;
if(pData[playerid][pSeconds] == 60)
{
pData[playerid][pSeconds] = 0;
pData[playerid][pMins] += 1;
return 1;
}
if(pData[playerid][pMins] == 0)
{
pData[playerid][pMins] = 0;
pData[playerid][pHours] += 1;
return 1;
}
switch(pData[playerid][pMins])
{
case 1:
{
return SendClientMessage(playerid,color_ibot,"iBot:"#cwhite" Timer system is working good 1 mins ");
}
case 2:
{
SendClientMessage(playerid,color_ibot,"iBot:"#cwhite" Timer system is working good 2 mins ");
return 1;
}
}
return 1;
}
Re: [ Bug ] My timer system +rep -
demonarn - 12.02.2012
Maby change this ?
pawn Код:
if(pData[playerid][pMins] == 0)
To this ?
pawn Код:
if(pData[playerid][pMins] == 60)
and eventualy this
pawn Код:
public LevelSystem(playerid)
{
pData[playerid][pSeconds] += 1;
if(pData[playerid][pSeconds] == 60)
{
pData[playerid][pSeconds] = 0;
pData[playerid][pMins] += 1;
return 1;
}
if(pData[playerid][pMins] == 60)
{
pData[playerid][pMins] = 0;
pData[playerid][pSeconds] = 0;
pData[playerid][pHours] += 1;
return 1;
}
switch(pData[playerid][pMins])
{
case 1:
{
return SendClientMessage(playerid,color_ibot,"iBot:"#cwhite" Timer system is working good 1 mins ");
}
case 2:
{
SendClientMessage(playerid,color_ibot,"iBot:"#cwhite" Timer system is working good 2 mins ");
return 1;
}
}
return 1;
}
I am not sure if it works.
Re: [ Bug ] My timer system +rep -
RicaNiel - 12.02.2012
oh yhea i forgot to spot the error
thanks bro
hers +1 rep for you