IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> an evener script
Rogan21
post Feb 28 2016, 05:02 PM
Post #1


Group Icon Sergeant

Group: Members

Joined: 9-August 14
From: Romania
Member No.: 439150



Hey guys,i'm looking for an good script for evening if there's any.Mostly because everytime there's a noob who only joins just to frag and he would less care about the teams.If you have something about this type of script let me know.





Regards,
Rogan


--------------------
Go to the top of the page
 
+Quote Post
Wolf Enstein
post Feb 28 2016, 08:15 PM
Post #2


Group Icon General of the Army

Group: Management

Joined: 5-August 05
From: Scotland
Member No.: 12398



Ah, you mean a server-side script that automatically balances the teams, moving players, if neccessary, Rogan bro? I'm sure there's more than a few members here who can help you with that question nicken.gif .


--------------------
Go to the top of the page
 
+Quote Post
ETc|Jay
post Feb 28 2016, 10:20 PM
Post #3


Group Icon Major General

Group: Members

Joined: 21-November 05
From: etclan.de:27960
Member No.: 18126



hmm,
1. disable medic
2. !kick player


there is nowhere a script for that. would you give him less health, only pistol or what you think?


--------------------



Go to the top of the page
 
+Quote Post
lolroy
post Feb 29 2016, 12:22 AM
Post #4


Group Icon Corporal

Group: Members

Joined: 2-January 15
Member No.: 454233



EDIT: I posted without reading ^^ I thought you were looking for a 'team number evener' more than a 'skill evener' :) But this also could help you anyways to control people not caring about teams when they're uneven... :)

I modified a version of this one available in wolffiles:

CODE
unevenDiff = 2
max_unevenTime = 30
max_unevenDiff = 4

axisPlayers = {}
alliedPlayers = {}
unevenTime = -1
function et_RunFrame( levelTime )

   gamestate = tonumber(et.trap_Cvar_Get("gamestate"))
if gamestate == 1 or gamestate == 3 then return end

   local numAlliedPlayers = table.getn( alliedPlayers )
   local numAxisPlayers = table.getn( axisPlayers )
     -- et.trap_SendConsoleCommand( et.EXEC_APPEND, "qsay Allies table... " .. numAlliedPlayers .. "^7 Axis table "..numAxisPlayers.."" )
   if numAlliedPlayers >= numAxisPlayers + max_unevenDiff then
      local clientNum = alliedPlayers[ numAlliedPlayers ]
      et.trap_SendConsoleCommand( et.EXEC_APPEND, "!put " .. clientNum .. " r; qsay ^5balancing teams... " .. et.gentity_get( clientNum, "pers.netname" ) .. "^5 moved to ^1AXIS" )
   elseif numAxisPlayers >= numAlliedPlayers + max_unevenDiff then
      local clientNum = axisPlayers[ numAxisPlayers ]
      et.trap_SendConsoleCommand( et.EXEC_APPEND, "!put " .. clientNum .. " b; qsay ^5balancing teams... " .. et.gentity_get( clientNum, "pers.netname" ) .. "^5 moved to ^4ALLIES" )
   elseif numAlliedPlayers >= numAxisPlayers + unevenDiff then
      if unevenTime > 0 then
         if tonumber( levelTime ) - unevenTime >= max_unevenTime * 1000 then
            local clientNum = alliedPlayers[ numAlliedPlayers ]
            et.trap_SendConsoleCommand( et.EXEC_APPEND, "!put " .. clientNum .. " r; qsay ^5balancing teams... " .. et.gentity_get( clientNum, "pers.netname" ) .. "^5 moved to ^1AXIS" )
         end
      else
         unevenTime = tonumber( levelTime )
     et.trap_SendConsoleCommand( et.EXEC_APPEND, "qsay ^3TEAMS will be ^5BALANCED ^3in ^130 seconds!! ^3Please even up!!" )
      end
   elseif numAxisPlayers >= numAlliedPlayers + unevenDiff then
      if unevenTime > 0 then
         if tonumber( levelTime ) - unevenTime >= max_unevenTime * 1000 then
            local clientNum = axisPlayers[ numAxisPlayers ]
            et.trap_SendConsoleCommand( et.EXEC_APPEND, "!put " .. clientNum .. " b; qsay ^5balancing teams... " .. et.gentity_get( clientNum, "pers.netname" ) .. "^5 moved to ^4ALLIES" )
         end
      else
         unevenTime = tonumber( levelTime )
    et.trap_SendConsoleCommand( et.EXEC_APPEND, "qsay ^3TEAMS will be ^5BALANCED ^3in ^130 seconds!! ^3Please even up!!" )        
      end
   else
      unevenTime = -1
   end
end

function et_ClientSpawn( clientNum, revived, teamChange, restoreHealth )
    local thisGuid = string.upper( et.Info_ValueForKey( et.trap_GetUserinfo( clientNum ), "cl_guid" ))
    --local gamestate = tonumber(et.trap_Cvar_Get("gamestate"))
   if teamChange ~= 0 and string.sub(thisGuid, 1, 7) ~= "OMNIBOT" then
      local team = tonumber( et.gentity_get( clientNum, "sess.sessionTeam" ) )
      -- these were the teamnumbers prior to the move
      local numAlliedPlayers = table.getn( alliedPlayers )
      local numAxisPlayers = table.getn( axisPlayers )
      if team == 1 then
         for i, num in ipairs( alliedPlayers ) do
            if num == clientNum then
               table.remove( alliedPlayers, i )
               break
            end
         end
         -- this should not happen but still check for it to avoid doubles
         for i, num in ipairs( axisPlayers ) do
            if num == clientNum then
               return
            end
         end
         -- make sure a player who (got) moved when teams were uneven doesn't get moved right back
         if numAlliedPlayers >= numAxisPlayers + unevenDiff then
            table.insert( axisPlayers, 1, clientNum )
         else
            table.insert( axisPlayers, clientNum )
         end
      elseif team == 2 then
         for i, num in ipairs( axisPlayers ) do
            if num == clientNum then
               table.remove( axisPlayers, i )
               break
            end
         end
         for i, num in ipairs( alliedPlayers ) do
            if num == clientNum then
               return
            end
         end
         if numAxisPlayers >= numAlliedPlayers + unevenDiff then
            table.insert( alliedPlayers, 1, clientNum )
         else
            table.insert( alliedPlayers, clientNum )
         end
      else
         for i, num in ipairs( alliedPlayers ) do
            if num == clientNum then
               table.remove( alliedPlayers, i )
               return
            end
         end
         for i, num in ipairs( axisPlayers ) do
            if num == clientNum then
               table.remove( axisPlayers, i )
               return
            end
         end
      end
   end
end

function et_ClientDisconnect( clientNum )
   for i, num in ipairs( alliedPlayers ) do
      if num == clientNum then
         table.remove( alliedPlayers, i )
         return
      end
   end
   for i, num in ipairs( axisPlayers ) do
      if num == clientNum then
         table.remove( axisPlayers, i )
         return
      end
   end
end


Mainly it ignores bots (because the server using it uses 'balancer' built in omnibot, to have always same bot number in both teams).

It also is 'disabled' while on intermission (map ends) and warmup, and also has disabled the "shuffle" (to never have shuffle in middle of a map).

How it works:

- Each team has a "list" with the players on it, by order (first player is first one who joined, last player in the list is last one joininig). When it's unbalanced (2 players diff or more), it takes last player on the 'bigger team' list (AKA the last one who joined) and moves him to FIRST place in the 'smaller team' list, So he won't get moved again in the whole game (map).

Main problem of this script:
- When map begins, The player lists are made 'random' (fast one connecting will be the first on the list, players with slow computers or taking more time to load a map, will be last ones). So at begin of a map it could be a bit unfair (like moving a random player), but that's all :)

Original code is here: http://lua.wolffiles.de/?fileid=167

It has some differences, like shuffling if difference is big (and doesn't distinguish between omnibots and humans).

If it's useful for your server, feel free to use it :)

This post has been edited by lolroy: Feb 29 2016, 12:23 AM
Go to the top of the page
 
+Quote Post
Rogan21
post Feb 29 2016, 01:24 AM
Post #5


Group Icon Sergeant

Group: Members

Joined: 9-August 14
From: Romania
Member No.: 439150



Thanks roy,i'm gonna ask our clan leader amadeus to load up the script when's done with repairing his computer.


--------------------
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 6th June 2024 - 06:29 AM