Raised This Month: $ Target: $400
 0% 

[SOLVED][HELP] Setting team scores


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
connoisseur
Senior Member
Join Date: Jan 2012
Old 01-13-2014 , 09:07   [SOLVED][HELP] Setting team scores
Reply With Quote #1

Hi, I used the following method to set team scores on the scoreboard.
It works fine, but as the new round starts, the team scores set back according to the original values which they previously had. They do not continue according to the new values provided.
Code:
public plugin_init() {       .......       gTeamScore = get_user_msgid("TeamScore") } public changescores() {       message_begin(MSG_ALL,gTeamScore)       write_string("TERRORIST")       write_short(g_tscore)       message_end()       message_begin(MSG_ALL,gTeamScore)       write_string("CT")       write_short(g_ctscore)       message_end() }
How can I keep the new scores saved?

Last edited by connoisseur; 01-29-2014 at 13:25.
connoisseur is offline
DavidJr
Senior Member
Join Date: Apr 2012
Old 01-13-2014 , 09:32   Re: [HELP] Setting team scores
Reply With Quote #2

Store the score in array, and when the round starts, set it again
__________________
What are you looking for here?
DavidJr is offline
connoisseur
Senior Member
Join Date: Jan 2012
Old 01-13-2014 , 09:41   Re: [HELP] Setting team scores
Reply With Quote #3

Quote:
Originally Posted by DavidJr View Post
Store the score in array, and when the round starts, set it again
Do you mean setting the scores every round again and again?
That can be done, but I was wondering if it could somehow just carry on using the new scores. Setting every round doesn't seem like the optimum way.

Isn't there any way I can edit the variables where the actual scores are stored in the game?

Last edited by connoisseur; 01-13-2014 at 09:44.
connoisseur is offline
DavidJr
Senior Member
Join Date: Apr 2012
Old 01-13-2014 , 09:52   Re: [HELP] Setting team scores
Reply With Quote #4

I guess you can't. Maybe it is possible with Orpheu
__________________
What are you looking for here?
DavidJr is offline
connoisseur
Senior Member
Join Date: Jan 2012
Old 01-13-2014 , 10:07   Re: [HELP] Setting team scores
Reply With Quote #5

Quote:
Originally Posted by DavidJr View Post
I guess you can't. Maybe it is possible with Orpheu
I don't know how to code using orpheu, I'm not that experienced in pawn scripting.
It would be great if someone could provide the code.
connoisseur is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 01-13-2014 , 18:41   Re: [HELP] Setting team scores
Reply With Quote #6

You don't need orpheu.
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-14-2014 , 00:07   Re: [HELP] Setting team scores
Reply With Quote #7

Try to add in plugin_init :

PHP Code:
set_msg_block(gTeamScoreBLOCK_SET

Also, you have to understand that "TeamScore" message is just used to set the visual part of score on client hud, if you want to change the real value, you need to set some internal data that can only be accessed with orpheu module.

Code i gave you will block messages that the game is sending, so only messages from the plugin gonna be received by players, it should be fine.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
connoisseur
Senior Member
Join Date: Jan 2012
Old 01-14-2014 , 00:59   Re: [HELP] Setting team scores
Reply With Quote #8

Thanks. But there's a small problem in applying that way. If I use sv_restart at some point, the team scores will not set back to 0-0, they will still be set according to g_tscore/g_ctscore.
connoisseur is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-14-2014 , 13:03   Re: [HELP] Setting team scores
Reply With Quote #9

PHP Code:
new bool:g_bRestarting;

public 
plugin_init()
{
    
register_event("TextMsg""Event_TextMsg_Restart""a""2&#Game_C""2&#Game_w");
    
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0");
}

public 
Event_TextMsg_Restart()
{
    
g_bRestarting true;
}

public 
Event_HLTV_New_Round()
{
    if( 
g_bRestarting )
    {
        
g_bRestarting false;
        
// Set score to 0-0 here
    
}

Also, you may have to send TeamScore message to connecting or just connected players.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 01-14-2014 at 13:04.
ConnorMcLeod is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 01-15-2014 , 18:23   Re: [HELP] Setting team scores
Reply With Quote #10

If you have Orpheu installed, then this is the easy way of life:
Spoiler
Attached Files
File Type: zip sigs+memofs.zip (2.2 KB, 290 views)
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.

Last edited by hornet; 01-26-2014 at 05:18.
hornet 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 10:05.


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