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

Keep and swap team scores after sv_restart 1


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GoldNux
Senior Member
Join Date: Mar 2018
Old 03-10-2018 , 20:09   Keep and swap team scores after sv_restart 1
Reply With Quote #1

It is a pain in the ass to keep track of the TEAM score after switching teams and restarting the round.
Could someone be very nice and write a plugin that keeps the team scores after doing a restart, and swaps them when players swap teams after half match.
I remember there is a plugin that keeps the score, but it does not swap the scores and I think it was pretty buggy.

Thank you very very much!

edit: maybe these threads can be helpful:
https://forums.alliedmods.net/showthread.php?t=173127
https://forums.alliedmods.net/showthread.php?t=90898
__________________
Try my version of de_dust2, I think it's great and you should check it out!
https://gamebanana.com/mods/83731

Last edited by GoldNux; 03-10-2018 at 20:21.
GoldNux is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 03-11-2018 , 15:46   Re: Keep and swap team scores after sv_restart 1
Reply With Quote #2

wow man you are streaming cs 1.6...that is unique cuz of it i will try to make something now...and i hope better coders will edit it to be more functional

EDIT: Can you try this?
i dont have experience with cws/mixes, but i guess when TT + CT wins = 15, something is finished so swap the teams?

Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <orpheu>
#include <orpheu_memory>

#define PLUGIN "CW Swap score"
#define VERSION "1.0"
#define AUTHOR "AlliedMods"

#define SCORE_T 0
#define SCORE_CT 1

#define set_mp_pdata(%1,%2)  ( OrpheuMemorySetAtAddress( g_pGameRules, %1, 1, %2 ) )
#define get_mp_pdata(%1)     ( OrpheuMemoryGetAtAddress( g_pGameRules, %1 ) )

new g_pGameRules;
new g_TeamScore[2];
//new g_rounds;

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_event("TeamScore", "eventTeamScore", "a");
	
	//register_clcmd( "say /swap", "ClientCommand_SetTeamScore");
	
	//register_logevent( "round_start", 2, "1=Round_Start" );
}

public plugin_precache()
{
	OrpheuRegisterHook( OrpheuGetFunction( "InstallGameRules" ), "OnInstallGameRules", OrpheuHookPost );
}

public OnInstallGameRules()
{
	g_pGameRules = OrpheuGetReturn();
}
/*public round_start()
{
	g_rounds++
	
	if( g_rounds == 15)
	{
		ClientCommand_SetTeamScore()
		g_rounds = 0 //reset rounds and start over the match ?
	}
}*/
public eventTeamScore()
{
	new sTeam[2];
	read_data(1, sTeam, 1);
	
	if( sTeam[0] == 'T' )
	{
		g_TeamScore[SCORE_T] = read_data(2);
	}
	else
	{
		g_TeamScore[SCORE_CT] = read_data(2);
	}
	
	if( ( g_TeamScore[SCORE_CT] + g_TeamScore[SCORE_T] ) == 15 )
	{
		menjanje_strana_2();
	}
	return PLUGIN_CONTINUE;
}

public ClientCommand_SetTeamScore ()
{                
	set_mp_pdata( "m_iNumCTWins", g_TeamScore[SCORE_T] );
	
	set_mp_pdata( "m_iNumTerroristWins", g_TeamScore[SCORE_CT] );
	
	UpdateTeamScores( .notifyAllPlugins = true );
}

UpdateTeamScores ( const bool:notifyAllPlugins = false )
{
	static OrpheuFunction:handleFuncUpdateTeamScores;

	if ( !handleFuncUpdateTeamScores )
	{
		handleFuncUpdateTeamScores = OrpheuGetFunction( "UpdateTeamScores", "CHalfLifeMultiplay" )
	}

	( notifyAllPlugins ) ?

	OrpheuCallSuper( handleFuncUpdateTeamScores, g_pGameRules ) :
	OrpheuCall( handleFuncUpdateTeamScores, g_pGameRules );
}  
public menjanje_strana_2( )
{
	new players[32], num, i, pp
	get_players( players, num );
	
	for(i = 0; i < num; i++ )
	{
		pp = players[i] 
		switch( cs_get_user_team( pp ) )
		{
			case CS_TEAM_CT: cs_set_user_team( pp, CS_TEAM_T );
			case CS_TEAM_T: cs_set_user_team( pp, CS_TEAM_CT );
		}
		client_print( 0, print_chat, "[ CW ] Swapped teams" )
	}
	ClientCommand_SetTeamScore()

}

Last edited by JocAnis; 03-11-2018 at 21:01.
JocAnis is offline
GoldNux
Senior Member
Join Date: Mar 2018
Old 03-11-2018 , 20:32   Re: Keep and swap team scores after sv_restart 1
Reply With Quote #3

Quote:
Originally Posted by JocAnis View Post
wow man you are streaming cs 1.6...that is unique cuz of it i will try to make something now...and i hope better coders will edit it to be more functional

EDIT: Can you try this?
i dont have experience with cws/mixes, but i guess when TT + CT wins = 15, something is finished so swap the teams?

Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <orpheu>
#include <orpheu_memory>

...
Thank you! I don't know how to test this plugin because all my friends are sleeping right now.
But I will try it first thing tomorrow, very nice of you to help out!

Can you explain what the plugin does?
What I'm looking for is the score to swap, not the teams.

So for example, first half is: T=9 and CT=6

When you switch teams to play second half of match, the scores are reset to 0 when doing sv_restart 1.

So what I'm looking for is that the scores are not reset, and swapped.
So you dont have to count in your head all the time to see what the score is.

Maybe if there was a way to set the scores manually, you could just do that after sv_restart 1 when both teams are swapped.

Another example:

First half is: T=9 and CT=6
Then you sv_restart 1: T=0 and CT=0
This plugin adds score from first half: T=6 and CT=9 <- swapped

Thank you once again my friend, sorry if I was unclear in my first post.
Cool that you watch the stream, thank you for the support! = )
__________________
Try my version of de_dust2, I think it's great and you should check it out!
https://gamebanana.com/mods/83731

Last edited by GoldNux; 03-11-2018 at 20:34.
GoldNux is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 03-11-2018 , 21:00   Re: Keep and swap team scores after sv_restart 1
Reply With Quote #4

i hope i understood...but when you swap the team-score also players should be swapped? if thats it, plugin is planned to work like that...explaining of the code:

theres function called on every team-win ... its calculating score, so when CT Wins + T Wins equals 15 (like you said, 9T wins vs 6CT wins, plugin will automatically swap teams AND swap team scores...
you shouldnt have any plugin for changing teams if you want this to your server, cuz there will be possible comflicts...source is: https://forums.alliedmods.net/showthread.php?t=155667

*ill comments /swap say command, cuz i think you dont need manually swapping scores haha...so its all automated and based on team score=15...

also, if you continue to stream cs 1.6 thing, i can help you more about this...i have some private plugin for custom cws (like 2v2 which i need for my server) and we can make some collaboration here..
JocAnis is offline
GoldNux
Senior Member
Join Date: Mar 2018
Old 03-11-2018 , 21:58   Re: Keep and swap team scores after sv_restart 1
Reply With Quote #5

Quote:
Originally Posted by JocAnis View Post
i hope i understood...but when you swap the team-score also players should be swapped? if thats it, plugin is planned to work like that...explaining of the code:

theres function called on every team-win ... its calculating score, so when CT Wins + T Wins equals 15 (like you said, 9T wins vs 6CT wins, plugin will automatically swap teams AND swap team scores...
you shouldnt have any plugin for changing teams if you want this to your server, cuz there will be possible comflicts...source is: https://forums.alliedmods.net/showthread.php?t=155667

*ill comments /swap say command, cuz i think you dont need manually swapping scores haha...so its all automated and based on team score=15...

also, if you continue to stream cs 1.6 thing, i can help you more about this...i have some private plugin for custom cws (like 2v2 which i need for my server) and we can make some collaboration here..
This sounds fantastic and exactly what I was looking for!
Thank you my friend.

I will keep streaming 1.6, I plan on hosting a tournament. Maybe 2 v 2 or 3 v 3!
I want to comment on gameplay and do some nice spectating!

That's why I ask about spectatorspeed and stuff like that.
I want to make it look professional

Thanks again, I will test plugin tomorrow!
__________________
Try my version of de_dust2, I think it's great and you should check it out!
https://gamebanana.com/mods/83731
GoldNux is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 03-11-2018 , 22:07   Re: Keep and swap team scores after sv_restart 1
Reply With Quote #6

noprob that idea is amazing...big amount of people think cs 1.6 is dying...your stream is only helping to cs 1.6...i hope other members will support your idea...cuz who else in the whole worlds is streaming 1.6?
JocAnis is offline
GoldNux
Senior Member
Join Date: Mar 2018
Old 03-12-2018 , 18:52   Re: Keep and swap team scores after sv_restart 1
Reply With Quote #7

Quote:
Originally Posted by JocAnis View Post
noprob that idea is amazing...big amount of people think cs 1.6 is dying...your stream is only helping to cs 1.6...i hope other members will support your idea...cuz who else in the whole worlds is streaming 1.6?
Hello my friend, we tested the plugin today!

First I got this error:

Code:
L 03/12/2018 - 23:39:10: [ORPHEU] Function "InstallGameRules" not found
L 03/12/2018 - 23:39:10: [AMXX] Run time error 10 (plugin "swap.amxx") (native "OrpheuGetFunction") - debug not enabled!
L 03/12/2018 - 23:39:10: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
Then when we reached 15 rounds this happened:
First teams was swapped, scores was not swapped.
And then after one round teams was swapped back.

Chat message was printed also.
And after 15 more round nothing happened.

I think it would be much easier just to have a plugin where you can set the score manually.
Can you maybe make this? So I can type commands like:
sm_t 5 to set the t score to 5
sm_ct 10 to set the ct score to 10

It would be much easier I think, because this plugin will be problematic I think.
Thank you for taking the time to help me out! I really appreciate it!
__________________
Try my version of de_dust2, I think it's great and you should check it out!
https://gamebanana.com/mods/83731
GoldNux is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 03-12-2018 , 21:26   Re: Keep and swap team scores after sv_restart 1
Reply With Quote #8

ye i know with manually adding score its easier...but its harder to code...i think i cant make that
JocAnis is offline
GoldNux
Senior Member
Join Date: Mar 2018
Old 03-13-2018 , 08:59   Re: Keep and swap team scores after sv_restart 1
Reply With Quote #9

Quote:
Originally Posted by JocAnis View Post
ye i know with manually adding score its easier...but its harder to code...i think i cant make that
I see, thank you
__________________
Try my version of de_dust2, I think it's great and you should check it out!
https://gamebanana.com/mods/83731
GoldNux is offline
CookieCrumbler
Senior Member
Join Date: Feb 2013
Location: Australia
Old 03-17-2018 , 11:35   Re: Keep and swap team scores after sv_restart 1
Reply With Quote #10

I am working on making a PUG mod at the moment that will have all the functionality you ever need for PUG. Once I've finished it i'll let you know.
__________________
--------------------------------------------------
C is for cookie ... thats good enuff 4 me
CookieCrumbler 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 23:03.


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