tag mismatch
#1

i get tag mismatch warning for this, btw it says hours is already defined and i put mins and secs in enum any problem will come?

pawn Код:
stock TotalGameTime(playerid, &h=0, &m=0, &s=0)
{

    PlayerInfo[playerid][TotalTime] = (gettime() - PlayerInfo[playerid][ConnectTime]) + (PlayerInfo[playerid][hours]*60*60) + (PlayerInfo[playerid][mins]*60) + (PlayerInfo[playerid][secs] );

    h = floatround(PlayerInfo[playerid][TotalTime] / 3600, floatround_floor);
    m = floatround(PlayerInfo[playerid][TotalTime] / 60,   floatround_floor) % 60;
    s = floatround(PlayerInfo[playerid][TotalTime] % 60,   floatround_floor);

    return PlayerInfo[playerid][TotalTime];
}
Reply
#2

Floatround expects floats, which these values are not. But if you calculate the values in the right order then you won't need any rounding at all. Here's something I quickly wrote in notepad. Should work:

Код:
totaltime = 5000

seconds = totaltime % 3600;				// 5000 % 3600 = 1400
hours = (totaltime - seconds) / 3600	// (5000 - 1400) / 3600 = 1
temp = seconds;							// 1400
seconds = seconds % 60;					// 1400 % 60 = 20
minutes = (temp - seconds) / 60			// (1400 - 20) / 60 = 23
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)