View Single Post
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