AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   General (https://forums.alliedmods.net/forumdisplay.php?f=7)
-   -   RoundStart() bug or not? (https://forums.alliedmods.net/showthread.php?t=301986)

Airkish 10-12-2017 15:29

RoundStart() bug or not?
 
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?

HamletEagle 10-12-2017 15:52

Re: RoundStart() bug or not?
 
Show what RoundStart really is(register_event).

Airkish 10-12-2017 15:54

Re: RoundStart() bug or not?
 
Quote:

Originally Posted by HamletEagle (Post 2554076)
Show what RoundStart really is(register_event).

PHP Code:

register_event("HLTV""RoundStart""a""1=0""2=0"); 


HamletEagle 10-12-2017 16:23

Re: RoundStart() bug or not?
 
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.

PRoSToTeM@ 10-12-2017 16:56

Re: RoundStart() bug or not?
 
Quote:

Originally Posted by HamletEagle (Post 2554092)
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.

HamletEagle 10-12-2017 17:34

Re: RoundStart() bug or not?
 
I know how it works. What I was trying to say is that not all players are spawned at the same time(late join).

Airkish 10-12-2017 17:49

Re: RoundStart() bug or not?
 
Quote:

Originally Posted by HamletEagle (Post 2554092)
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" 


PRoSToTeM@ 10-12-2017 18:56

Re: RoundStart() bug or not?
 
@Airkish this is not round start, but freezetime end.

Airkish 10-12-2017 19:13

Re: RoundStart() bug or not?
 
Quote:

Originally Posted by PRoSToTeM@ (Post 2554113)
@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

PRoSToTeM@ 10-12-2017 21:41

Re: RoundStart() bug or not?
 
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.


All times are GMT -4. The time now is 02:29.

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