#Troubleshooting AFKManager Plugin
1 messages · Page 1 of 1 (latest)
Seems like the condition for that to happen was wrong written. Fixed
https://github.com/Mikk155/Sven-Co-op/releases/tag/AFKManager
Changelog
29/04/2024
Added new json variables
{
"reload": false,
"max afk time": 500,
"respawn on exit": true,
"Add afk to names": true,
...
Here's what was wrong #214a72d
Both conditions after OR was supposed to be count as one boolean
Thanks. I'll try it out
okay so now it puts players into spectate but there is a new issue that was not happening before and i don't know why. If someone is idle with this plugin it puts them into spectate and then they get respawned based on the value set in forcesurvival and server.cfg. it will start a countdown and it will only give so many retries before the map starts. forcesurvival 2 is supposed to prevent restarts. but now with your plugin its causing map restarts and enabling the retry system.
Of course as players are dead after all
You'd have to modify the other plugin to detect afk players, you can read the custom keyvalue on the players
$s_afkmanager_afk == 1 means player is AFK
but its not supposed to do that. and it wasnt before. force survival 2 is no restart mode. it is supposed to just respawn players based on server.cfg respawn timer value
Thats what i mean, if you are afk you are prevented from reapawning
If there is no alive players the reatart is inminent
how do you prevent a restart?
You need at least one alive player to prevent a level from reatarting, hardcoded
so its impossible to idle in a survival server without it restarting over and over?
that makes it difficult to see or join the server if its constantly restarting
@lost orbit sorry to bother you, can you look at it for a moment and tell me if doing a fancy hack could work? I.e how the CSurvival checjs before restarting in 10 seconds
If you really want, you could spawn a bot and make it not solid, add freeze flag and FL_NODRAW, That'll definitelly work but it'll take one slot
Also the most important thing is that as it is alive, the map will never restart, if someone is stuck in observer he wont be able to play
This is what I am trying to do: Let a player join my server, if they are idle for 3 minutes they go into spectate mode. If they are in spectate mode they do not respawn unless they push e. If no players are alive, nothing happens. They stay in spectate mode and new players can spawn in as if the idle player is not a player.
As is, it will constantly restart, with the one by MrOats, it forced player to die and respawn every 3 minutes
Then the afk player should be respawned if there are no players alive, i could do that
Add this somewhere in line 193```as
int Alives = 0;
for( int i = 0; i <= g_Engine.maxClients; i++ )
{
if( g_PlayerFuncs.FindPlayerByIndex( i ) !is null )
Alives++;
}
if( Alives == 0 )
Leave( pPlayer );
This is a stupid hack but i dont think i'd be adding it so its up to you, it iterates over all players each time a player thinks, see if there are not any fps difference in your end
There isn't much that can be done, survival mode is set to restart the map if all players are dead or in observer mode, since observer mode is meant as a playable spectator state rather than an actual spectator mode.
Yes i meant how the check is done, technically setting dead flag to dead_no would return IsAlive() as false?
The main issue I think is that I am trying ultimately to spectate survival mode as admin. And I idle in my server in order to attract players to play with. Unless you have a large rotating cast of players in a survival server, it basically breaks completely because 1 player does not want to play survival mode alone generally and if they idle to wait for more they are either kicked, respawned over and over or the entire server restarts, which makes it harder for new players to join. And if you have afk manager set to 3 minutes that means the server will restart about every 9 minutes.
Probably wouldn't work either because IsAlive() checks if a) pev->deadflag is DEAD_NO, b) pev->health > 0, and c) IsConnected() returns true.
maybe the solution in my case would be to omit admins from being labelled as a player and make the game think that the server is just empty?
Its stuff like this which made me give up on trying to have a survival server. Getting everything perfect so that rtv, antirush, afkmanager, spectate mode, etc all work together seems impossible. Someone can go afk in a survival server with afkmanager and basically force the server to reboot over and over, as if it is being DDOS'd. Which as far as I know takes the server off the list and increases the downtime so players cant join. Not an issue if you have an active playerbase but with the playerbase in sven being this small its kind of a death sentence.
then what i suggested about the invisible bot would be the best choice, i'm not familiar with the bot's API, think if you manage to modify RCBOT it would be just add flags FL_FROZEN and FL_NODRAW then just solid to SOLID_NOT, and finally make AFKManager to not do stuff on the bot
maybe add takedamage DAMAGE_NO as well, as for how to do that in AFKManager just return if the client ID is "BOT"
It's effectively a case of "It wasn't meant to do this in the first place" there, observer mode wasn't intended to be used as a spectator mode which is why this sort of thing happens.
Yeah its assuming that there is always at least one active player
instead of this, open your other plugin and look for when the players are respawned, then before respawning them just update it's custom keyvalue
didn't think on updating the other plugin
g_EntityFuncs.DispatchKeyValue( pPlayer.edict(), "$s_afkmanager_afk", "0" );```
server.cfg is set to respawn players every 3 seconds. afkmanager is set to put players into spectate every 3 minutes.
and AFKManager will move you to spectator as soon as you spawn if $s_afkmanager_afk is 1, that's my point
update it to 0 on your other plugins before respawning the players
you mean put it to 0 on server.cfg?
force survival is set to respawn players in waves or if no one is alive.
it is stored on each player's custom key values, you have to update them before calling any respawn method
where can i see that
on the web
this is my modified version.
can't see on android
text file
add this
g_EntityFuncs.DispatchKeyValue( p.edict(), "$s_afkmanager_time", "0" );
g_EntityFuncs.DispatchKeyValue( p.edict(), "$s_afkmanager_afk", "0" );```
[here](
https://github.com/wootguy/ForceSurvival/blob/master/ForceSurvival.as#L409C2-L409C4)
where do i add it?
and what should this do?
.
@lost orbitis this something that could be added in the next update to sven? an actual spectate mode?
@latent furnaceokay so, when you first join it doesnt work. But when the map restarts once, you start in spectate mode. But then the map just restarts.
So now its restarting every 5 seconds
into a match
it should have been enought, what's why you're using that plugin though? isn't it literally just doing what it's name suggests?
didn't checked the whole code, just searched for "respawn" in there.
im using forcesurvival to solve this issue with it restarting. It lets me put on ForceSurvival 2 which is no restart mode.
so it respawn players after all die?
its restarting but not because of that plugin. Its restarting because there are no players alive. Forcesurvival lets you create a wave system where players respawn together but thats not respawning the players because i have it set to 10 minutes and the server restarts within 10 seconds and the server.cfg default is set to 3 seconds for players to respawn
maybe there is a way to fool it into thinking that players are always alive when they arent so it doesnt restart the server
This wasnt an issue with the one by MrOats but it had other issues. That one was able to force players to be killed when afk and respawned when no players were alive. But the issue with that is that players died over and over again, leaving weapon drops and blood.
That hapoen because as i said, AFKManager dont kill you, it moves you to spectator as soon as you spawn, if you are afk
This should fix that problem, if there are no any alive player it will move out-of-afk-state the player so there will be an alive player
some reason its not doing it
the first time you spawn in you are alive, when map restarts you are in spectate mode, then it restarts in 5 seconds
i don't think neither me or w00tguy would be updating our plugins for compatibility, the game's Survival mode is as-is as H2 said, "Spectator Mode" is not a thing, it is just a dead player and they're dead after all
Which means youd probably have to trick it somehow
there would be amazing if it where a configurable thing, let's say we got a Hook for when survival is going to restart the map, so we could work from there and prevent the map from restarting but we don't have that hability
this is the only trick you can do, take it or use only one plugin
I dont think I have any conflicting plugins
.
actually maybe i do
i have "plugin"
{
"name" "SpectateOnDeath"
"script" "SpectateOnDeath"
}
you definitelly have
and
"plugin"
{
"name" "SpectateMode"
"script" "SpectateMode"
}
that might be why?
not what i meant, re-read that sentence.
if you are afk with mine AFKManager you won't be able to spawn as it moves you to spectator as soon as it happens, then what could happen? SurvivalManager respawns you -> AFKManager moves you to spectator -> No alive players, restarting in 10 seconds
okay so this might be progress. I turned off the other plugins. It now puts you into spectate, and then takes you out of spectate. But once it does this three times it restarts the server. Why doesnt it just endlessly loop? Maybe if I make players respawn instantly with server.cfg?
by my assumption, if it can respawn players before the game thinks that everyone is dead, it might work.
i am assuming this just isn't possible
i think the best thing you can do is to try to lengthen the amount of time that a player can idle and the amount of time it takes to respawn players
so for instance, 5 minutes and it puts player into spectate, then add 3 seconds for respawn. then server is up for 15 minutes before it restarts
the easiest solution would be to increase the amount of retries but thast not possible
@latent furnaceso it seems your afk manager is just breaking force survival mode then isnt it? force survival mode is supposed to just respawn players and it was working. it seems like there is no perfect solution to this issue. either players will respawn and die over and over or they get put into spectate mode and the server will restart. so the only way that would work is if spectate mode was off and it simply killed players. now i am confused.
so how is forcesurvival mode 2 bypassing this issue? the alternative way to make this work is to get rid of afk manager entirely and use antistall, which kills players instead of putting them into spectate, but that has the issue of ruining maps that don't have linear states of progress such as platforming maps and as far as i can tell has no way to toggle it on or off or choose what maps will work
could you add that as a toggle feature? Instead of putting players into spectate mode or kicking them, just kill them?
did you even read what i said? Please, don't ping me again asking the same over and over. i've already tell you how to solve your issue.