Code:
public event_intermission( ) set_task( 0.1, "BestHeadPlayer", 0 )
public BestHeadPlayer( id )
Code:
public event_intermission( ) set_task( 0.1, "BestHeadPlayer" ) // task id isn't needed
// there is no id for this function if the task id is 0
public BestHeadPlayer( )
-----------------
Code:
new iPlayers[32], iNum, i, id
get_players( iPlayers, iNum )
new iBestPlayerHeadshot
for(i = 0; i < iNum; i++)
{
id = iPlayers[ i ]
if(!iBestPlayerHeadshot)
{
iBestPlayerHeadshot = iPlayers[ 0 ]
}
if(g_mostheadshots[ id ] > g_mostheadshots[ iBestPlayerHeadshot ])
{
iBestPlayerHeadshot = id
}
}
Code:
new iPlayers[32], iNum
get_players( iPlayers, iNum )
// check for no players
if(!iNum)
{
return;
}
// set to first player instead of checking inside loop
new iBestPlayerHeadshot = iPlayers[ 0 ]
// i and id aren't used except for only inside the loop
// start loop at 1 since we set it to iPlayers[ 0 ] already
for(new i = 1, id; i < iNum; i++)
{
id = iPlayers[ i ]
if(g_mostheadshots[ id ] > g_mostheadshots[ iBestPlayerHeadshot ])
{
iBestPlayerHeadshot = id
}
}
--------------------
Code:
formatex(infoHead, sizeof infoHead - 1, "Map %s | Best Player: %s | Headshot's: %d", mapname, szName, g_mostheadshots[iBestPlayerHeadshot])
log_to_file("best_headshot.log", infoHead)
Code:
// log_to_file() uses formatting strings, so no need to format a string, then pass it.
log_to_file("best_headshot.log", "Map %s | Best Player: %s | Headshot's: %d", mapname, szName, g_mostheadshots[iBestPlayerHeadshot])
__________________