Purple Posted February 22, 2015 Share Posted February 22, 2015 Always see some sort of automove talk on here, so here is a simple automove that works well and i have been using on my server for months, modified quiet a bit to be usable by anyone. -- automove redone. function et_InitGame(levelTime,randomSeed,restart) et.RegisterModname("^1D^0Ri Team Balance") players = { } players[0] = 0 --all players[1] = 0 --axis players[2] = 0 --allies players[3] = 0 --spectators end function et_Obituary(client, killer, death) axiskilled = 0 allieskilled = 0 count2 = 0 player_name2 = GetPlayerName(client) local game_state = tonumber(et.trap_Cvar_Get("gamestate")) local player_team = et.gentity_get(client, "sess.SessionTeam") if game_state ~= 1 and game_state ~= 2 then players[0] = 0 --all players[1] = 0 --axis players[2] = 0 --allies players[3] = 0 --spectators for i = 0, tonumber(et.trap_Cvar_Get("sv_maxclients")) -1, 1 do local teamnumber = tonumber(et.gentity_get(i,"sess.sessionTeam")) if et.gentity_get(i,"pers.connected") == 2 then players[0] = players[0] + 1 players[teamnumber] = players[teamnumber] + 1 end end if (( (players[1] - players[2]) > 1 and player_team == 1 ) or ( (players[2] - players[1]) > 1 and player_team == 2 )) then if player_team == 1 then axiskilled = 1 else allieskilled = 1 end et.trap_SendServerCommand(-1, "chat \"^3Automoving " .. player_name2 .. " ^3as teams were uneven... \"") end end return nil end function et_RunFrame() if axiskilled == 1 then delayaxis() elseif allieskilled == 1 then delayallies() end end function delayaxis() count2 = count2 + 1 if count2 >= 5 then --every 5 deaths move the next player that dies et.trap_SendConsoleCommand( et.EXEC_APPEND, "putteam " .. player_name2 .. " b") count2 = 0 axiskilled = 0 end end function delayallies() count2 = count2 + 1 if count2 >= 5 then--every 5 deaths move the next player that dies et.trap_SendConsoleCommand( et.EXEC_APPEND, "putteam " .. player_name2 .. " r") count2 = 0 allieskilled = 0 end end function GetPlayerName(client) return et.Q_CleanStr(et.gentity_get(client, "pers.netname")) end function et_ShutdownGame(restart) end ETsneak, hellreturn and twt_thunder 3 Quote Link to comment Share on other sites More sharing options...
twt_thunder Posted February 22, 2015 Share Posted February 22, 2015 thx for sharing Purple 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.