30.08.2011, 15:08
There's no need to write such a complex loader for something like this alone. There's a much much more complex unformatting function for that... sscanf 2.0.
This would be very simple:
Edit
To save some memory, you could make pOnlineMinutes and pOnlineSeconds char arrays. This reduces the size by half and would be usable since minutes and seconds never go near 255.
This would be very simple:
pawn Код:
sscanf(value, "p<:>ddd", PlayerInfo[playerid][pOnlineHours], PlayerInfo[playerid][pOnlineMinutes], PlayerInfo[playerid][pOnlineSeconds]);
To save some memory, you could make pOnlineMinutes and pOnlineSeconds char arrays. This reduces the size by half and would be usable since minutes and seconds never go near 255.
pawn Код:
new pOnlineHours[MAX_PLAYERS], pOnlineMinutes[MAX_PLAYERS char], pOnlineSeconds[MAX_PLAYERS char];
// In your 1-second loop...
pOnlineSeconds{playerid} ++;
if(pOnlineSeconds{playerid} == 60)
{
pOnlineSeconds{playerid} = 0, pOnlineMinutes{playerid} ++;
if(pOnlineMinutes{playerid} == 60)
{
pOnlineMinutes{playerid} = 0, pOnlineHours[playerid] ++;
}
}