Zipcore / zombiereloaded

Automatically exported from code.google.com/p/zombiereloaded
0 stars 0 forks source link

Timeleft out of sync #276

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Start a map and wait a few seconds.
2. Restart the game using "mp_restartgame 1"

What is the expected output? What do you see instead?
SourceMod resets its internal maptime (timeleft), but the game does not 
(scoreboard). This results in the two times being thrown out of sync.

Removing all of ZR's "mp_restartgame" hooking code solves the problem. Perhaps 
this code was added to work around SourceMod's own old timeleft bug 
(https://bugs.alliedmods.net/show_bug.cgi?id=4557), but now it works against it.

Original issue reported on code.google.com by aangi...@gmail.com on 16 Nov 2012 at 12:11

GoogleCodeExporter commented 9 years ago
Actually, making the above changes has the side-effect of transferring all 
players to one team on the next round. It'll have to be looked into, but you 
get the idea!

Original comment by aangi...@gmail.com on 16 Nov 2012 at 2:50

GoogleCodeExporter commented 9 years ago
What happens if you comment just this line in CvarsHookRestartGame?

//SetConVarInt(cvar, 0);

Team balancing is done at the end of a round, so if mp_restartgame doesn't 
trigger a round end event players won't be balanced next round. That might be 
why ZR block it and just restart the round itself. I don't know what 
mp_restartgame does in detail or which events that are triggered.

If unbalanced teams is the only issue after removing that code, we could 
probably try another approach so that teams will be balanced after any 
interruption. Perhaps just balance teams when that command is executed. You 
could try make a call to RoundEndBalanceTeams from CvarsHookRestartGame instead 
of terminating the round, and commenting that line mentioned above so it's not 
blocked. Something like this, if it works:

public CvarsHookRestartGame(Handle:cvar, const String:oldvalue[], const 
String:newvalue[])
{
    new Float:delay = StringToFloat(newvalue);
    if (delay <= 0)
    {
        return;
    }

    RoundEndBalanceTeams();
}

There's no doubt that ZR is poor at handling unexpected interruptions in the 
middle of a round.

Original comment by richard.helgeby@gmail.com on 20 Nov 2012 at 7:02

GoogleCodeExporter commented 9 years ago
> What happens if you comment just this line in CvarsHookRestartGame? 
//SetConVarInt(cvar, 0);

I tried this shortly after my last comment and it does indeed work. I think the 
round is still ending twice, so your solution with RoundEndBalanceTeams might 
fix that as well.

> I don't know what mp_restartgame does in detail or which events that are 
triggered.
It skips the round_end event and goes straight to round_start. A real pain for 
plugins.

Original comment by aangi...@gmail.com on 20 Nov 2012 at 8:27