AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [CS:GO] not able to handle / stop CS_OnTerminateRound? (https://forums.alliedmods.net/showthread.php?t=290494)

Kinsi 11-14-2016 11:51

[CS:GO] not able to handle / stop CS_OnTerminateRound?
 
Hey,

I am currently trying to Handle / Stop the Round end Reason CSRoundEnd_TargetSaved (11). The Problem i face doing this is that even when i do handle it, it will be called again, and again, and again.

Each time its called the CT's points are counted up until the game ends because the CT's have accumulated enough points. I have tried the latest Dev and Stable build (Windows) and could just not find a fix for it. Having a non-empty CT team does not fix it either.

I do not have any other plugins on the server which could be the cause for this.

Obligatory code:

PHP Code:

public Action CS_OnTerminateRound(float &delayCSRoundEndReason &reason) {
    
PrintToChatAll("CS_OnTerminateRound.Debug: Reason? %d"reason);
    
    if(
reason == CSRoundEnd_TargetSaved) return Plugin_Stop;


     return 
Plugin_Continue;


Output:
Code:

CS_OnTerminateRound.Debug: Reason? 11
CS_OnTerminateRound.Debug: Reason? 11
CS_OnTerminateRound.Debug: Reason? 11
CS_OnTerminateRound.Debug: Reason? 11
CS_OnTerminateRound.Debug: Reason? 11
CS_OnTerminateRound.Debug: Reason? 11
CS_OnTerminateRound.Debug: Reason? 11
CS_OnTerminateRound.Debug: Reason? 11

After that the game just ends ( CT's won with a score of 8 )

OSWO 11-14-2016 12:37

Re: [CS:GO] not able to handle / stop CS_OnTerminateRound?
 
Try using Plugin_Handled

Kinsi 11-14-2016 12:41

Re: [CS:GO] not able to handle / stop CS_OnTerminateRound?
 
Already tried that, didnt work either.

hleV 11-14-2016 12:48

Re: [CS:GO] not able to handle / stop CS_OnTerminateRound?
 
Did you register the event with EventHookMode_Pre?

OSWO 11-14-2016 12:49

Re: [CS:GO] not able to handle / stop CS_OnTerminateRound?
 
Quote:

Originally Posted by hleV (Post 2470135)
Did you register the event with EventHookMode_Pre?

You don't have to. It's a global forward called. That's why it's CS_

Buddy you're gonna have to explain exactly what you're doing and why you're blocking that action for me to help you.

Kinsi 11-14-2016 12:58

Re: [CS:GO] not able to handle / stop CS_OnTerminateRound?
 
Well i at least found a "fix".

Looks like CSGO is retarded and re-calls this even once per tick when i handle it because the round time is at 0. So i have to handle it, and up the m_iRoundTime to stop it from calling.

A leftover issue from this is that the ct's get a point added to their score which i manually have to subtract afterwards.

I am trying to force the bomb plant when the time runs out. Time runs out => whoever has the bomb is forced to plant it now with some trickery, which works.

If there is a better solution to this ill happily take it.

Dr!fter 11-16-2016 18:46

Re: [CS:GO] not able to handle / stop CS_OnTerminateRound?
 
As far as I can remember from when I looked previously is that for each condition there is a function call that does stuff and then calls terminate round. Sadly the only way to fix your issue or avoid doing all this work is to detour the other function the one before terminate round.


All times are GMT -4. The time now is 11:44.

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