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

How can I detect team score ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Moody92
Veteran Member
Join Date: May 2011
Location: Oman
Old 05-21-2013 , 14:13   How can I detect team score ?
Reply With Quote #1

I've been looking around on how to detect team score, I found bunch of cshack module plugins.

and I thought cshack is a dead module so I decided to ask if there's another way to do it ?
Moody92 is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 05-21-2013 , 14:26   Re: How can I detect team score ?
Reply With Quote #2

http://wiki.amxmodx.org/Half-Life_1_...ents#TeamScore
jimaway is offline
SicknessArG
Junior Member
Join Date: Oct 2012
Location: Paraná, Entre Ríos (ARG)
Old 05-22-2013 , 07:40   Re: How can I detect team score ?
Reply With Quote #3

What exactly you wanna do? Cause you can get the score, but you can't change it from scoreboard with some codes...

I've made a stock to change the score without modules, but it isn't a value, it just show what I want to show... You can take a look from my code to see what I'm talking about -link-.

This is the stock -link-.

Hope to be useful.

Sorry for my bad english.
SicknessArG is offline
Send a message via MSN to SicknessArG Send a message via Skype™ to SicknessArG
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-22-2013 , 11:30   Re: How can I detect team score ?
Reply With Quote #4

This is how teams scores are updated in the game :

Code:
void CHalfLifeMultiplay::UpdateTeamScores()
{
	MESSAGE_BEGIN(MSG_ALL, gmsgTeamScore);
	WRITE_STRING("CT");
	WRITE_SHORT(m_iCTsScore);
	MESSAGE_END();

	MESSAGE_BEGIN(MSG_ALL, gmsgTeamScore);
	WRITE_STRING("TERRORIST");
	WRITE_SHORT(m_iTerroristsScore);
	MESSAGE_END();
}
So if you want to hook it, you need to always wait for the second message.

PHP Code:
new g_iCTsScoreg_iTerroristsScore;

public 
plugin_init()
{
    
register_event("TeamScore""Event_TeamScore""a");
}

public 
Event_TeamScore()
{
    new 
szTeam[2];
    
read_argv(1szTeamcharsmax(szTeam));
    switch( 
szTeam[0] )
    {
        case 
'C':
        {
            
// CT Score, T's has not been sent yet, wait for next message.
            
g_iCTsScore read_data(2);
        }
        case 
'T':
        {
            
g_iTerroristsScore read_data(2);
            
// both messages has been sent, you can use values now.
        
}
    }


And if you want to send your own values (won't be real score, only what appears in scoreboard), then you can use this :
PHP Code:
new gmsgTeamScore;

public 
plugin_init()
{
    
gmsgTeamScore get_user_msgid("TeamScore");
}

UpdateTeamScores(iCTsScoreiTerroristsScore)
{
    
emessage_begin(MSG_ALLgmsgTeamScore);
    
ewrite_string("CT");
    
ewrite_short(iCTsScore);
    
emessage_end();

    
emessage_begin(MSG_ALLgmsgTeamScore);
    
ewrite_string("TERRORIST");
    
ewrite_short(iTerroristsScore);
    
emessage_end();


Also, if you want to change real score values, you need plugins using a module such as orpheu or rage.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 05-22-2013 at 11:33.
ConnorMcLeod is offline
Moody92
Veteran Member
Join Date: May 2011
Location: Oman
Old 05-30-2013 , 02:22   Re: How can I detect team score ?
Reply With Quote #5

Quote:
Originally Posted by ConnorMcLeod View Post
Thank you alot, really helped me in my misery

Last edited by Moody92; 05-30-2013 at 02:23.
Moody92 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 01:06.


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