Raised This Month: $ Target: $400
 0% 

Why is this getting called multiple times?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-18-2011 , 09:13   Re: Why is this getting called multiple times?
Reply With Quote #1

Sorry for double post but i wanted this one to be noticed.

We came to conclusion with arkshine that the problem is that when SendAudio is sent, cs variable are not yet updated so the game doesn't know that the round has been ended.
So when you kill all team, a new round end is triggered, etc...

So what you should do is to set a 0.1 task for example, or to store the wining team into a global variable and kill loosers at Round_End logevent, for example.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 12-18-2011 , 12:46   Re: Why is this getting called multiple times?
Reply With Quote #2

Task did resolve the problem, thank you.

Would then this still be a bug or just a note to know? But AFAIK, arkshine's round sound plugin uses the same way, I've never had problems with it so far.
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-18-2011 , 13:02   Re: Why is this getting called multiple times?
Reply With Quote #3

Round Sound doesn't kill any player.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-18-2011 , 13:11   Re: Why is this getting called multiple times?
Reply With Quote #4

That's not a bug. It's more a lack of knowledge of the game (AMXX scripting).

The game basically does that (at least just on what it's related to the problem) :

- When a player is killed, CheckWinConditions is called 2 times (This function checks/handles round end)
- When a round is triggered, things are done in this order : SendAudio -> TeamScore -> Log -> m_iRoundWinStatus (m_iRoundWinStatus is the offset which holds what team has won)

What happens when a round end is triggered :

- m_iRoundWinStatus is setted to a value
- To avoid to run multiple round end, a check exists at the top of the function, checking if m_iRoundWinStatus hold a value. If so, we ignore. The offset is reset when a new round starts.

What happens when you kill players when you hook SendAudio ? :

- m_iRoundWinStatus is not set yet, and killing players will call 2 times CheckWinConditions (per player).
- CheckWinConditions is called while hooking SendAudio, but since m_iRoundWinStatus is not set yet, another round end will be triggered.

Conclusion : You should avoid killing players when the round end has just started. Hooking SendAudio/Log is not really reliable to know which team has won because some others plugins could kill players at this time, though adding a system to avoid to execute multiple times would be enough.
__________________

Last edited by Arkshine; 12-18-2011 at 13:12.
Arkshine is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 12-18-2011 , 13:26   Re: Why is this getting called multiple times?
Reply With Quote #5

Alright now I get it. Thanks for explaining it clearly.
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu 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 11:55.


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