Raised This Month: $51 Target: $400
 12% 

Balancear Teams


  
 
 
Thread Tools Display Modes
Author Message
rak
Veteran Member
Join Date: Oct 2011
Location: banned country
Old 05-28-2012 , 05:16   Balancear Teams
#1

hola gente queria saber si alguien sabe como hacerlo mas optimo xD

se me ocurrio esto.. pero no me gusta D: xD

PHP Code:
BalanceTeams(id) {
    static 
rbmin_nummax_numtotal
    r 
GetRTeam()
    
GetBTeam()
    
min_num min(rb)
    
max_num max(rb)
    
total max_num min_num
    
    
if(total <= 2)
        return 
0
    
    
if(max_num == r) {
        
cs_set_player_team(idCS_TEAM_CT)
        
MarkBite(g_BitTeamB,id);
        
ClearBite(g_BitTeamR,id);
    }
    else {
        
cs_set_player_team(idCS_TEAM_T)
        
MarkBite(g_BitTeamR,id);
        
ClearBite(g_BitTeamB,id);
    }
    
    return 
1

gracias por leer
__________________

www.amxmodx-es.com

Steam: Luchokoldo

Last edited by rak; 05-28-2012 at 05:24.
rak is offline
Send a message via MSN to rak Send a message via Skype™ to rak
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 05-28-2012 , 18:49   Re: Balancear Teams
#2

Balancear por ?
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 05-28-2012 , 19:19   Re: Balancear Teams
#3

Code:
BalanceTeams(id) {        if(max(GetRTeam(), GetBTeam()) - max(GetRTeam(), GetBTeam()) <= 2)         return 0         new consult     consult = ( max_num == r )     cs_set_player_team( id, consult ? CS_TEAM_CT : CS_TEAM_T )     MarkBite( consult ? g_BitTeamB : g_BitTeamR , id )     ClearBite( consult ? g_BitTeamR : g_BitTeamB, id );         return 1 }

Es lo mismo pero con menos variables y sin el if si te pones a mirar.
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 05-28-2012 , 19:25   Re: Balancear Teams
#4

static creo que va mejor ahí, ya que se llama varias veces en un mapa...
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
Swaycher
Senior Member
Join Date: Feb 2009
Location: Arg/MyHome/PawnStudio
Old 05-29-2012 , 15:45   Re: Balancear Teams
#5

PHP Code:
stock balance_teams()
{
    static 
iPlayersnumiPlayersnum get_playing()
    
    if (
iPlayersnum 1) return
    
    static 
iTerrorsiMaxTerrorsidCsTeams:team[33]
    
iMaxTerrors iPlayersnum/2
    iTerrors 
0
    
    
for (id 1id <= g_Maxplayersid++)
    {
        if (!
is_user_connected(id))
            continue;
        
        
team[id] = cs_get_user_team(id)
        
        if (
team[id] == CS_TEAM_SPECTATOR || team[id] == CS_TEAM_UNASSIGNED)
            continue
            
        
cs_set_user_team(idCS_TEAM_CT)
        
team[id] = CS_TEAM_CT
    
}

    while (
iTerrors iMaxTerrors)
    {
        if (++
id g_Maxplayersid 1
        
        
if (!is_user_connected(id))
            continue
            
        if (
team[id] != CS_TEAM_CT)
            continue
        
        if (
random_num(01))
        {
            
cs_set_user_team(idCS_TEAM_T)
            
team[id] = CS_TEAM_T
            iTerrors
++
        }
    }

__________________
Quote:
Originally Posted by fearAR View Post
Claro esta que no tengo idea de como verificar los diferentes cortes de ángulo.
http://forums.alliedmods.net/showthread.php?t=196349
Swaycher is offline
Send a message via MSN to Swaycher Send a message via Skype™ to Swaycher
Javivi
AlliedModders Donor
Join Date: Dec 2008
Old 05-29-2012 , 17:36   Re: Balancear Teams
#6

como quieres balancear ?

cambiando a jugadores aleatorios hasta que los equipos esten igualados?

cambiando a los ultimos jugadores en entrar al equipo que esta desbalanceado ?
__________________
Javivi is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 05-29-2012 , 17:51   Re: Balancear Teams
#7

Quote:
Originally Posted by Swaycher View Post
PHP Code:
stock balance_teams()
{
    static 
iPlayersnumiPlayersnum get_playing()
    
    if (
iPlayersnum 1) return
    
    static 
iTerrorsiMaxTerrorsidCsTeams:team[33]
    
iMaxTerrors iPlayersnum/2
    iTerrors 
0
    
    
for (id 1id <= g_Maxplayersid++)
    {
        if (!
is_user_connected(id))
            continue;
        
        
team[id] = cs_get_user_team(id)
        
        if (
team[id] == CS_TEAM_SPECTATOR || team[id] == CS_TEAM_UNASSIGNED)
            continue
            
        
cs_set_user_team(idCS_TEAM_CT)
        
team[id] = CS_TEAM_CT
    
}

    while (
iTerrors iMaxTerrors)
    {
        if (++
id g_Maxplayersid 1
        
        
if (!is_user_connected(id))
            continue
            
        if (
team[id] != CS_TEAM_CT)
            continue
        
        if (
random_num(01))
        {
            
cs_set_user_team(idCS_TEAM_T)
            
team[id] = CS_TEAM_T
            iTerrors
++
        }
    }

TE PARECE QUE ES MEJOR 6 VARIABLES, 7 CONDICIONALES, UN FOR, UN WHILE Y 6 NATIVES que el code de lucas: 5 natives, una variable y 1 condicioal?
__________________

Last edited by Neeeeeeeeeel.-; 05-29-2012 at 17:51.
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
rak
Veteran Member
Join Date: Oct 2011
Location: banned country
Old 05-29-2012 , 23:05   Re: Balancear Teams
#8

Quote:
Originally Posted by lucas_7_94 View Post
Code:
BalanceTeams(id) {        if(max(GetRTeam(), GetBTeam()) - max(GetRTeam(), GetBTeam()) <= 2)         return 0         new consult     consult = ( max_num == r )     cs_set_player_team( id, consult ? CS_TEAM_CT : CS_TEAM_T )     MarkBite( consult ? g_BitTeamB : g_BitTeamR , id )     ClearBite( consult ? g_BitTeamR : g_BitTeamB, id );         return 1 }

Es lo mismo pero con menos variables y sin el if si te pones a mirar.
ensi solo sacaste el if.. por q las variables son las mismas por q usas max_num y r las cuales en este caso no las definiste xD

Quote:
Originally Posted by Javivi View Post
como quieres balancear ?

cambiando a jugadores aleatorios hasta que los equipos esten igualados?

cambiando a los ultimos jugadores en entrar al equipo que esta desbalanceado ?
chequeo cada vez q es revivido un player dado que las rondas no terminan nunca
__________________

www.amxmodx-es.com

Steam: Luchokoldo
rak is offline
Send a message via MSN to rak Send a message via Skype™ to rak
Swaycher
Senior Member
Join Date: Feb 2009
Location: Arg/MyHome/PawnStudio
Old 05-30-2012 , 19:53   Re: Balancear Teams
#9

Quote:
Originally Posted by Neeeeeeeeeel.- View Post
TE PARECE QUE ES MEJOR 6 VARIABLES, 7 CONDICIONALES, UN FOR, UN WHILE Y 6 NATIVES que el code de lucas: 5 natives, una variable y 1 condicioal?
FLACO BAJA EL TONO, QUE TENES ALGUN PROBLEMA?. Solo postié una manera, nose porque te haces problema. dios
__________________
Quote:
Originally Posted by fearAR View Post
Claro esta que no tengo idea de como verificar los diferentes cortes de ángulo.
http://forums.alliedmods.net/showthread.php?t=196349

Last edited by Swaycher; 05-30-2012 at 19:56.
Swaycher is offline
Send a message via MSN to Swaycher Send a message via Skype™ to Swaycher
rak
Veteran Member
Join Date: Oct 2011
Location: banned country
Old 05-30-2012 , 19:56   Re: Balancear Teams
#10

Quote:
Originally Posted by Swaycher View Post
FLACO BAJA EL TONO, QUE TENES ALGUN PROBLEMA?. Solo postié una manera, que problema tenes? por dios
si tuvieras 3 dedos de frente no hubieras posteado; tenes que entender varias cosas antes de comentar y postear un código principalmente cuando se busca lo mas optimo
__________________

www.amxmodx-es.com

Steam: Luchokoldo
rak is offline
Send a message via MSN to rak Send a message via Skype™ to rak
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:00.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode