I have a function, that is called every round end just by the event register, but for some reason, when the round ends the function is called twice, and what it does, it shows, for some reason, in this very odd way:
- If the CT wins - It shows the score AFTER WINNING twice. (probably function is being called twice and idk why)
- If T wins - Score is being printed twice with 2 score: the score BEFORE THE TEAM WON, and the score AFTER WINNING (so if the score was 5 - 6, and T won, it would print two lines when the first line says 5 - 6 and then print another line saying 6 - 6 (updated score))
Here is the the function:
PHP Code:
public Event_TeamScore()
{
if (g_IsStarted)
{
read_data(1, szTeamName, 1)
iTeam = (szTeamName[0] == 'T') ? 0 : 1
iScore = read_data(2)
iScoreOffset = iScore - g_iLastTeamScore[iTeam]
if(iScoreOffset > 0)
{
g_iScore[iTeam] += iScoreOffset
}
g_iLastTeamScore[iTeam] = iScore
if ((g_iScore[0] == 16) || (g_iScore[1] == 16))
{
EndMatch()
return PLUGIN_HANDLED
}
ClientCommand_SayScore()
}
return PLUGIN_HANDLED
}
public ClientCommand_SayScore()
{
client_print(0, print_chat, "Score: (Terrorist) %d - %d (Counter-Terrorist)", g_iScore[0], g_iScore[1])
return PLUGIN_HANDLED
}
This is the logevent register:
PHP Code:
register_logevent("round_end", 2, "1=Round_End")