Raised This Month: $85 Target: $400
 21% 

RoundStart() bug or not?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 10-12-2017 , 15:29   RoundStart() bug or not?
Reply With Quote #1

Little explanation for what happens.

If a player dies on last round the RoundStart() event treats him as dead.

Here's my code:

PHP Code:
public RoundStart() {
    new 
iPlayers[32], iNum;
    
get_playersiPlayersiNum"a"); //This do not include dead players
    
for( new i<= iNumi++ ) {
        new 
iPid iPlayers[i]
        
Rounds[iPid]++;
        
SaveKills(iPid); //This saves rounds to SQL database, if a player was dead on last round it doesn't. It works for everyone who was alive last round.
    
}
    return 
PLUGIN_CONTINUE;

So when I do with set_task it works fine:

PHP Code:
public RoundStart() {
    
set_task(1.0"SaveRounds");
    return 
PLUGIN_CONTINUE;
}

public 
SaveRounds() {
    new 
iPlayers[32], iNum;
    
get_playersiPlayersiNum"a");
    for( new 
i<= iNumi++ ) {
        new 
iPid iPlayers[i]
        
Rounds[iPid]++;
        
SaveKills(iPid);
    }
    return 
PLUGIN_CONTINUE;

Bug or I am doing something wrong here?
__________________
Airkish is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-12-2017 , 15:52   Re: RoundStart() bug or not?
Reply With Quote #2

Show what RoundStart really is(register_event).
__________________
HamletEagle is offline
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 10-12-2017 , 15:54   Re: RoundStart() bug or not?
Reply With Quote #3

Quote:
Originally Posted by HamletEagle View Post
Show what RoundStart really is(register_event).
PHP Code:
register_event("HLTV""RoundStart""a""1=0""2=0"); 
__________________

Last edited by Airkish; 10-12-2017 at 15:55.
Airkish is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-12-2017 , 16:23   Re: RoundStart() bug or not?
Reply With Quote #4

Players are not alive at that point. There's no bug. Adding a task somehow works because you are delaying the code, and you are lucky enough that you got respawned before the task was executed.
__________________
HamletEagle is offline
[email protected]
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 10-12-2017 , 16:56   Re: RoundStart() bug or not?
Reply With Quote #5

Quote:
Originally Posted by HamletEagle View Post
and you are lucky enough that you got respawned before the task was executed.
Why lucky? They are respawned in the same frame, in the same function (CHalfLifeMultiplay::RestartRound), so any delay will work.

You can catch CleanUpMap (there players are already respawned) https://github.com/s1lentq/ReGameDLL...ules.cpp#L2049 by hooking this line https://github.com/s1lentq/ReGameDLL...rules.cpp#L734. But with regamedll this won't work.
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-12-2017 , 17:34   Re: RoundStart() bug or not?
Reply With Quote #6

I know how it works. What I was trying to say is that not all players are spawned at the same time(late join).
__________________
HamletEagle is offline
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 10-12-2017 , 17:49   Re: RoundStart() bug or not?
Reply With Quote #7

Quote:
Originally Posted by HamletEagle View Post
Players are not alive at that point. There's no bug. Adding a task somehow works because you are delaying the code, and you are lucky enough that you got respawned before the task was executed.
I changed register_event to this and it works.

PHP Code:
register_logevent("RoundStart"2"1=Round_Start"
What does each of these mean?
PHP Code:
"a""1=0""2=0" 
__________________
Airkish is offline
[email protected]
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 10-12-2017 , 18:56   Re: RoundStart() bug or not?
Reply With Quote #8

@Airkish this is not round start, but freezetime end.
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 10-12-2017 , 19:13   Re: RoundStart() bug or not?
Reply With Quote #9

Quote:
Originally Posted by [email protected] View Post
@Airkish this is not round start, but freezetime end.
Well round start = freezetime end, isn't it.
New round = freezetime start

According to this: https://forums.alliedmods.net/showthread.php?t=42159
__________________
Airkish is offline
[email protected]
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 10-12-2017 , 21:41   Re: RoundStart() bug or not?
Reply With Quote #10

In my mind there is no NewRound, but there are FreezeTimeStart (which can be named RoundStart or RoundStarting) and FreezeTimeEnd (which can be named RoundStarted). IMO NewRound is bad because new isn't a verb.

Note, in CS:GO there are round_start and round_freeze_end.
__________________

Last edited by [email protected]; 10-12-2017 at 21:47.
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
Reply


Thread Tools
Display Modes

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 12:46.


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