"You are inactive" bug

Moderator: NADEO

Locked
User avatar
Filipe1020
Posts: 918
Joined: 31 Dec 2010, 16:51
Location: Rio de Janeiro, Brazil

"You are inactive" bug

Post by Filipe1020 »

That is a really annoying bug, it's happening with me all the time out of nowhere, and when I click the Resume playing button, it brings me back to spectacting mode and it get stuck there and I need to wait for the round to finish, please fix this
User avatar
steeffeen
Translator
Translator
Posts: 2463
Joined: 14 Oct 2012, 16:22
Location: Germany

Re: "You are inactive" bug

Post by steeffeen »

the AFK script of nadeo is indeed kind of buggy, but i think it's not the script but the IdleDuration of the player
i took a look at the value and it pretty much jumps from high to low and sometimes it's even increasing while running and looking around and stuff...

besides as far as i know 180000 milliseconds equals 3 minutes instead of 1 minute 30 seconds ;)

Code: Select all

/**
 *	Library to manage Passive AFK players
 */
#Const Version "2013-02-06"

#Include "TextLib" as TextLib
#Include "MathLib" as MathLib

#Const Lib_AFK_IdleTimeLimit	180000 // after 1 minute and 30 sec. of inactivity, a player is considered AFK
#Const Lib_AFK_SpawnTimeLimit	40000 // A player cannot be considered AFK during 20 s. after spawning

Boolean IsAFK(CSmPlayer _Player) {
	if(_Player.SpawnStatus != CSmPlayer::ESpawnStatus::Spawned) return False;
	declare UI <=> UIManager.GetUI(_Player);
	// not for bots
	if(UI == Null) return False;
	if((UI.UISequence != CUIConfig::EUISequence::Playing) && (UI.UISequence != CUIConfig::EUISequence::None)) return False;
	if(UI.ForceSpectator) return False;
	if((Now - _Player.StartTime) < Lib_AFK_SpawnTimeLimit) return False; 

	return (_Player.IdleDuration > Lib_AFK_IdleTimeLimit);
}

Void ManageAFKPlayers() {
	foreach(Player in Players) {
		declare Boolean PlayerIsAFK = IsAFK(Player);
		if(PlayerIsAFK) {
			declare UI <=> UIManager.GetUI(Player);
			if(UI != Null) { // not for bots
				// log(Now^"> "^Player.User.Name^" is afk.");
				
				UIManager.UIAll.SendNotice(
					TextLib::Compose(_("$<%1$> is inactive (switched to spectator)"), Player.User.Name), 
					CUIConfig::ENoticeLevel::PlayerInfo, Null, CUIConfig::EAvatarVariant::Default, 
					CUIConfig::EUISound::Silence, 0);
				Users_RequestSwitchToSpectator(Player.User);
				
			}
		}
	}
}
    Game Mode and Title Pack Creator, Developer, ShootMania-Player & more

    ManiaControl, FancyManiaLinks
    User avatar
    TMarc
    Posts: 15255
    Joined: 05 Apr 2011, 19:10
    Location: Europe
    Contact:

    Re: "You are inactive" bug

    Post by TMarc »

    steeffeen wrote:besides as far as i know 180000 milliseconds equals 3 minutes instead of 1 minute 30 seconds ;)

    Code: Select all

    #Const Lib_AFK_IdleTimeLimit	180000 // after 1 minute and 30 sec. of inactivity, a player is considered AFK
    #Const Lib_AFK_SpawnTimeLimit	40000 // A player cannot be considered AFK during 20 s. after spawning
    
    It's the typical "let's change values to test and forget to update the comments" bug :roflol:
    Locked

    Return to “Shootmania Storm Reports”

    Who is online

    Users browsing this forum: No registered users and 1 guest