Quote:
I was not aware that it was improper to use the ResetHUD event to catch the start of the round, as I have seen other popular and approved plugins use it.
|
Many people confuses new round/round start/player spawn events.
Lets's see what happens.
Code:
register_event("ResetHUD","new_round","b")
In fact "ResetHUD" is a message which server sends to every connected client on server join, player spawn and round restart (using sv_restart(round) CVAR).
This means that "new_round" function in most cases will be called often.
If server contain for example 32 connected players you'll get a lot of tasks which controls "bBuyTime" variable while only one task is needed for that.
If player would connect at the middle of the round you'll get "bBuyTime = true" while in some cases it should be false.
Since buy time countdown starts on round start (freezetime end) you should use
Code:
register_logevent("logevent_round_start", 2, "1=Round_Start")
instead of "ResetHUD" event.
Quote:
I'm not sure how it would react on a truncated round.
|
Very simple. It would mess "bBuyTime" variable and therefore plugin's buy time. I do not think it's hard to imagine what could happen.
Let's say plugin uses logevent which listed above and task method.
Imagine two lines. The first line represents "life" of the 1st task and the second one represents 2nd task's "life". Where line exists "bBuyTime" variable is true.
Code:
1-----------------0
1------------------0
^ first task falses bBuyTime
Quote:
I am not skilled enough in Small to capture the current and round start times.
|
This have nothing to do with "non-basics" of the scripting language (by the way Small renamed to Pawn since version 3). Use round start logevent and "get_gametime" native.
The only trick which needed is allowing to buy while freezetime exists. Freezetime is a time between new round and round start events. You can find new round event in my previous post.