Timer Issue
Hey,
This is my first time creating my own plugins so please bare with me on this, I'm learning as I go from the usual tinkering and adaptation. I am trying to create a simple timer which allows one person to complete the map, then slays them and after 30 seconds slays the rest of the server. It works perfectly for the first round, however any rounds after that the countdown starts at the beginning of every round after that and they continue to stack on top of each other. Code:
public Action Event_RoundStart(Handle event, const char[] name, bool dontBroadcast) |
Re: Timer Issue
You aren't killing the original timer, you are just changing a pointer to it to now be a pointer to your newly created timer. You want to check if the handle is a valid timer first (for the very first instance loop where it will be invalid) and then before you reassign EndZoneTimer variable you want to use the KillTimer function.
PHP Code:
|
Re: Timer Issue
TIMER_FLAG_NO_MAPCHANGE flag is that will not allow timer pass next map.And the flag TIMER_REPEAT for timer if you not kill it until the next map will kill
So to avoid timer repeat more,you can try this code PHP Code:
Excuse my poor English,thanks again. |
Re: Timer Issue
Quote:
|
Re: Timer Issue
It's because RoundStart event happens after the freeze time. So during that freeze state the timer continues to count and kill players. You want to hook the event roundend and kill the timer there. Unless you still want players to be killed before the round restarts as there's a delay after round end event.
If the game type is csgo there's a few more events added you can use to kill the timer where you want: round_prestart round_poststart round_start round_end round_officially_ended <- this is the one you probably want. Find the list here |
Re: Timer Issue
I think your both EndZoneTimer and CountdownTimer should be killed on finish
|
Re: Timer Issue
Code:
public void OnPluginStart() |
Re: Timer Issue
Quote:
PHP Code:
|
Re: Timer Issue
Quote:
|
Re: Timer Issue
It shouldn't matter if you end it as a draw, should just be an event argument you can grab on the end round event. You should debug all the code to make sure the functions are being called. Just by adding PrintToChatAll messages at the events of say round_end. just to confirm everything else is running as it should. A lot of times it's minor issues overlooked and not even the code you think it is.
|
All times are GMT -4. The time now is 02:14. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.