Raised This Month: $ Target: $400
 0% 

RoundEnd for each player?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sleepwalker
Member
Join Date: Dec 2006
Old 01-07-2009 , 01:41   RoundEnd for each player?
Reply With Quote #1

I'm trying to switch scores on the team but when it do it switch it for each player and I just want to do it once. So it switches the team score 3 times if it is 3 players on the server. Why?

Code:
register_logevent("event_EndRound",2,"1=Round_End");
Code:
public event_EndRound() {
	new t, c
	for(new x=1;x<=PL_MAX;x++) {
		if(!is_user_connected(x)) continue;
		if(get_user_team(x) == 1) 
			t = 1;
		if(get_user_team(x) == 2) 
			c = 1;
	}
	if(c == 1 && t == 1) {
		timer = -1;

		format(randed,63,"");

		new WinT;
		for(new i=1; i <= PL_MAX; i++) {
			if(is_user_alive(i) && get_user_team(i) == 1)
				WinT = 1;
		}

		if(WinT){
			// Do Nothing
		}else{
			cs_switch_teams();
			cs_set_team_score(1, teamScores[CTS]);
			cs_set_team_score(2, teamScores[TS]);
		}
		set_task(0.5,"displayHud",TASK_DISPHUD,"",_,"a",6);
	}
}
Sleepwalker is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-07-2009 , 02:08   Re: RoundEnd for each player?
Reply With Quote #2

Code:
public event_EndRound() {     new t, c     for(new x=1;x<=PL_MAX;x++) {         if(!is_user_connected(x)) continue;         if(get_user_team(x) == 1)             t += 1;         if(get_user_team(x) == 2)             c += 1;     }


Also, use switch( get_user_team(x) ) would be better, or store the value in a variable.
Haven't time to look further in your code.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Sleepwalker
Member
Join Date: Dec 2006
Old 01-07-2009 , 02:54   Re: RoundEnd for each player?
Reply With Quote #3

The code you wrote will not work for me. If you look again you can se that I just want to check that it is a player on each team.
Sleepwalker is offline
jim_yang
Veteran Member
Join Date: Aug 2006
Old 01-07-2009 , 03:19   Re: RoundEnd for each player?
Reply With Quote #4

nobody know your logic from your code
if you just want to know which team win the round
register event like this
Code:
register_event("SendAudio","t_win","a","2=%!MRAD_terwin")
register_event("SendAudio","ct_win","a","2=%!MRAD_ctwin")
instead of your player calculator
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
Sleepwalker
Member
Join Date: Dec 2006
Old 01-07-2009 , 05:18   Re: RoundEnd for each player?
Reply With Quote #5

My code is like this:
Code:
1.	Check so there is a player on each team and not just 2 players
2.	If there is a player in each team check what team is the winner
3.	If it is T team that is the winning team... do nothing
	If it is CT team that is the winning team... run:

	cs_switch_teams();
	cs_set_team_score(1, teamScores[CTS]);
	cs_set_team_score(2, teamScores[TS]);
But my problem is that
Code:
	cs_set_team_score(1, teamScores[CTS]);
	cs_set_team_score(2, teamScores[TS]);
is running for each player and not once as I want.

* EDIT *
I have tested to switch from:
Code:
register_logevent("event_EndRound",2,"1=Round_End");
to:
Code:
register_event("SendAudio", "event_EndRound",  "a",  "2&%!MRAD_terwin",  "2&%!MRAD_ctwin");
But it stoped working when I did that.
Sorry for my bad english!

Last edited by Sleepwalker; 01-07-2009 at 09:02.
Sleepwalker is offline
Sleepwalker
Member
Join Date: Dec 2006
Old 01-10-2009 , 01:01   Re: RoundEnd for each player?
Reply With Quote #6

Someone?
Sleepwalker 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 09:05.


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