[ Solved ] My timer system +rep [ Solved thANKS ]
#1

Код:
 Type : BUG
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;
}
Reply
#2

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.
Reply
#3

oh yhea i forgot to spot the error
thanks bro
hers +1 rep for you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)