Online Time
#1

Is this correct?
pawn Код:
forward PlayerHour(playerid);
public PlayerHour(playerid) {
    PlayerInfo[playerid][pSecond]++;
    if(PlayerInfo[playerid][pSecond] == 60) {
        PlayerInfo[playerid][pMinute]++;
        PlayerInfo[playerid][pSecond] = 0;
    }
    else if(PlayerInfo[playerid][pMinute] == 60) {
        PlayerInfo[playerid][pMinute] = 0;
        PlayerInfo[playerid][pHour]++;
    }
    printf("TIME ONLINE(%s): %d:%d:%d", Name(playerid), PlayerInfo[playerid][pHour], PlayerInfo[playerid][pMinute], PlayerInfo[playerid][pSecond]);
    return 1;
}
My Timer:
pawn Код:
HourStat[playerid] = SetTimerEx("PlayerHour", 1000, true, "i", playerid);
Reply
#2

Looks correct, how ever I'd suggest using
<= 60
not
== 60
simply for the fact that it may skip the variable, for what-ever reason.
Other then that it looks fine.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)