(See
this topic for why this plugin exists)
What it doesSends players that stay at the exact same coordinates for 45 seconds into the spectator team.
Meant to prevent idling/inactive players from sitting in the same place and taking up a slot in the team, or stalling a round of arena.
InstallDownload the attached .gml file, and put it into your Plugins folder
Server side plugin (will work for hosts, but joining players will not have any effect on the server)
Built for 2.9.2
globalvar AFKChecker;
AFKChecker = id;
TIME_FRAMES = 45 * 30;
object_event_add(Character, ev_create, 0, '
AFKChecker_afktimer = 0;
');
object_event_add(Character, ev_step, ev_step_end, '
if (global.isHost) {
if (variable_local_exists("x_previous"))
if (x == x_previous) && (y == y_previous) {
AFKChecker_afktimer += 1 * global.delta_factor;
if (AFKChecker_afktimer > AFKChecker.TIME_FRAMES) {
if(player.object != -1)
{
if (!instance_exists(lastDamageDealer) || lastDamageDealer == player)
{
sendEventPlayerDeath(player, player, noone, DAMAGE_SOURCE_BID_FAREWELL);
doEventPlayerDeath(player, player, noone, DAMAGE_SOURCE_BID_FAREWELL);
}
else
{
var assistant;
assistant = secondToLastDamageDealer;
if (lastDamageDealer.object)
if (lastDamageDealer.object.healer)
assistant = lastDamageDealer.object.healer;
sendEventPlayerDeath(player, lastDamageDealer, assistant, DAMAGE_SOURCE_FINISHED_OFF);
doEventPlayerDeath(player, lastDamageDealer, assistant, DAMAGE_SOURCE_FINISHED_OFF);
}
}
player.team = TEAM_SPECTATOR;
ServerPlayerChangeteam(ds_list_find_index(global.players, player), player.team, global.sendBuffer);
clearPlayerDominations(player);
with(GameServer) {
ServerBalanceTeams();
}
}
} else {
AFKChecker_afktimer = 0;
}
}
');