SA-MP Forums Archive
tag mismatch - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: tag mismatch (/showthread.php?tid=445067)



tag mismatch - DetoNater - 19.06.2013

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];
}



Re: tag mismatch - Vince - 19.06.2013

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