Raised This Month: $ Target: $400
 0% 

Printing score every round end.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 08-05-2011 , 15:22   Printing score every round end.
Reply With Quote #1

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(1szTeamName1)
   
        
iTeam = (szTeamName[0] == 'T') ? 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(0print_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"
Diegorkable is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:22.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode