Raised This Month: $51 Target: $400
 12% 

Solved [HELP] Team score printing


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LithuanianJack
Senior Member
Join Date: Nov 2013
Location: Vilnius, Lithuania
Old 10-11-2017 , 09:28   [HELP] Team score printing
Reply With Quote #1

Hello. This code works incorrectly. Who can help me?

Works only team score printing:
show_hudmessage(id, "%L", LANG_PLAYER, "HUD_SCORE", TScore, CTScore);

But doesn't work "The %s have won the game! Final score is..." and other


PHP Code:
new CTScore 0
new 
TScore 0


public 
GameWillRestart( )  
{  
    
TScore 0;  
    
CTScore 0;  
}   

public 
Hook_CT_Win( ) CTScore++; 

public 
Hook_Terr_Win( ) TScore++; 

public 
teamScoreid 

    
{     
set_hudmessage(1601601600.140.1606.06.0)
show_hudmessage(id"%L"LANG_PLAYER"HUD_SCORE"TScoreCTScore);
}

////// after this text, nothing works


public roundcheck()
{    
    new 
rp CTScore TScore
    
new winner[] = "null"
    
    
if( rp 4)
    {
        return 
PLUGIN_HANDLED
    
}
    
    if(
CTScore TScore)
    {
        
winner "CT's"
    
}
    else
    {
        
winner "T's"
    
}
    
    if(
CTScore == 5)
    {
        
client_print(0print_center"The %s have won the game! Final score is %d (CT) - %d (T)."winnerCTScoreTScore)
        
TScore 0
        CTScore 
0
        rp 
0
        
        
return PLUGIN_HANDLED
    
}
    else if(
TScore == 5)
    {
        
client_print(0print_center"The %s have won the game! Final score is %d (CT) - %d (T)."winnerCTScoreTScore)
        
TScore 0
        CTScore 
0
        rp 
0
        
        
return PLUGIN_HANDLED
    
}
    
    switch(
rp)
    {
        case 
4:
        {
            
client_print(0print_center"This is the last round of first half and the score is %d (CT) - %d (T)"CTScoreTScore)
        }
    
        case 
5:
        {
            
client_print(0print_center"The %s won the first half! The score was %d (CT) - %d (T)."winnerCTScoreTScore)
            new 
pNumPlayers[32], index
            get_players
(PlayerspNum)
            
            for(new 
ipNumi++)
            {
                
index Players[i]
                
                if(
cs_get_user_team(index) == CS_TEAM_T )
                {
                    
cs_set_user_team(indexCS_TEAM_CT)
                }
                else
                {
                    
cs_set_user_team(indexCS_TEAM_T)
                }
            }
        }
        
        case 
29:
        {
            
client_print(0print_center"This is the final round! Whoever wins this wins the game!")
        }
    }
    return 
PLUGIN_CONTINUE
}

///// end 

Last edited by LithuanianJack; 10-13-2017 at 12:40.
LithuanianJack is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 10-11-2017 , 09:47   Re: [HELP] Team score printing
Reply With Quote #2

teamScore isn't connected with brackets.
__________________
Relaxing is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 10-11-2017 , 09:56   Re: [HELP] Team score printing
Reply With Quote #3

Quote:
Originally Posted by Relaxing View Post
teamScore isn't connected with brackets.
it can be even 100 lines away. it doesn`t affect it.
__________________
retired chump
DjSoftero is offline
LithuanianJack
Senior Member
Join Date: Nov 2013
Location: Vilnius, Lithuania
Old 10-11-2017 , 10:43   Re: [HELP] Team score printing
Reply With Quote #4

So what I would do?
LithuanianJack is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 10-11-2017 , 11:49   Re: [HELP] Team score printing
Reply With Quote #5

Show your HUD_SCORE translation. It's may missing parameters.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 10-11-2017 at 11:51.
EFFx is offline
LithuanianJack
Senior Member
Join Date: Nov 2013
Location: Vilnius, Lithuania
Old 10-11-2017 , 14:29   Re: [HELP] Team score printing
Reply With Quote #6

Quote:
Originally Posted by EFFx View Post
Show your HUD_SCORE translation. It's may missing parameters.
HUD_SCORE = T %d : %d CT

I think the problem is not related with your question

Last edited by LithuanianJack; 10-12-2017 at 12:58.
LithuanianJack is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-11-2017 , 14:38   Re: [HELP] Team score printing
Reply With Quote #7

Quote:
Originally Posted by LithuanianJack View Post
HUD_SCORE = T %s : %s CT

But problem is not related with your question
If you are so sure then fix the problem.
Actually the problem is in that line. It uses %s but your 2 variables are integers, so use %i.
__________________
HamletEagle is online now
LithuanianJack
Senior Member
Join Date: Nov 2013
Location: Vilnius, Lithuania
Old 10-12-2017 , 12:57   Re: [HELP] Team score printing
Reply With Quote #8

Quote:
Originally Posted by HamletEagle View Post
If you are so sure then fix the problem.
Actually the problem is in that line. It uses %s but your 2 variables are integers, so use %i.
Sorry, I was wrong. The line is:

HUD_SCORE = T %d : %d CT

I changed %d to %i but the problem persists
LithuanianJack is offline
KiLLeR.
Senior Member
Join Date: Jul 2014
Location: Bulgaria
Old 10-12-2017 , 13:34   Re: [HELP] Team score printing
Reply With Quote #9

Then function roundcheck() is never called if you don't see the client print messages.

Last edited by KiLLeR.; 10-12-2017 at 13:35.
KiLLeR. is offline
LithuanianJack
Senior Member
Join Date: Nov 2013
Location: Vilnius, Lithuania
Old 10-12-2017 , 14:04   Re: [HELP] Team score printing
Reply With Quote #10

Quote:
Originally Posted by KiLLeR. View Post
Then function roundcheck() is never called if you don't see the client print messages.
If I understand you correctly, the code should look like this:

From

PHP Code:
public Hook_CT_Win( ) CTScore++; 

public 
Hook_Terr_Win( ) TScore++; 
To

PHP Code:
public Hook_CT_Win()
{

CTScore++; 
roundcheck ();

}

public 
Hook_Terr_Win()
{

TScore++; 
roundcheck ();


Can you correct me?

Last edited by LithuanianJack; 10-12-2017 at 14:05.
LithuanianJack is offline
Reply



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 05:59.


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