This function is not working like it should...
#1

Hello.

pawn Код:
forward OneSecondUpdate(playerid);
public OneSecondUpdate(playerid)
{
    if(PlayerInfo[playerid][pSeconds] == 59)
    {
        PlayerInfo[playerid][pSeconds] = 0;
        if(PlayerInfo[playerid][pMinutes] == 59)
        {
            PlayerInfo[playerid][pMinutes] = 0;
            if(PlayerInfo[playerid][pHours] == 23)
            {
                PlayerInfo[playerid][pHours] = 0;
                PlayerInfo[playerid][pDays]++;
            }
            else PlayerInfo[playerid][pHours]++;
        }
        else PlayerInfo[playerid][pMinutes]++;
    }
    else PlayerInfo[playerid][pSeconds]++;
    return 1;
}
This function works, after some time however, the numbers start skipping and does not function like it should.
What I'm trying to do is use this function to display the amount of time people have been logged in the server, therefore the reason why I added the variables, in which can be then seen in the stats command.

It works, but like I said, after a while, they start going crazy..

pawn Код:
OnPlayerConnect(playerid);
{
    OneSecondUpdatetimer = SetTimerEx("OneSecondUpdate",1000,true,"iiii",playerid);
   return 1;
}
The timer is active once the player connects..

pawn Код:
OnPlayerDisconect(playerid);
{
KillTimer(OneSecondUpdatetimer);
return 1;
}
The timer is destroyed, to avoid any lapses..
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)