Skocz do zawartości

Nowy szablon forum

mygo.pl

Stworzyliśmy dla Was nowy wygląd forum. Z pewnością znajdziesz rzeczy, które wg Ciebie mogą zostać zmienione - wspomnij o tym w specjalnym wątku.

Czytaj więcej

Jak założyć własną sieć

serwerów CS

Zastanawiasz się nad prowadzeniem własnej sieci serwerów? Przeczytaj podstawowe informacje, na które należy zwrócić uwagę, przy takim projekcie.

Czytaj więcej

Tworzymy spis sieci

dodaj swoją

Dodaj sieć do której należysz, pozwoli to na promocję i budowę ogólnopolskiej bazy sieci CS.

Czytaj więcej

RSSTeam Balancer by High Frags


MYGO.pl
 Udostępnij

Rekomendowane odpowiedzi

  • RSSy
Could someone help me adjust this team balancer, so it transfers the player with the highest frags instead of the lowest frags?

PHP Code:

#include < amxmodx >
#include < cstrike >

// This is a random number to define INVALID_PLAYER
#define INVALID_PLAYER -1

// Check whether server is running CSDM
new boolg_bCsdmEnabledg_iCsdmConVarPointer;

// Console variable to set check frequency in seconds
new g_iConVarCheckFrequency;

// Console variable to set maximum difference between terrorists and counter-terrorists
new g_iConVarTerroristsDifference;

// Console variable to set maximum difference between counter-terrorists and terrorists
new g_iConVarCTerroristsDifference;

// Console variable to set immune admin flag
new g_iConVarAdminFlag;

// Variable to store admin flag
new g_iFlag;

public 
plugin_init( )
{
    
register_plugin"Team Balancer by Low Frags""4.0""Hattrick" );

    
g_iConVarCheckFrequency register_cvar"team_balancer_frequency""10" );
    
g_iConVarTerroristsDifference register_cvar"team_balancer_te_difference""1" );
    
g_iConVarCTerroristsDifference register_cvar"team_balancer_ct_difference""1" );
    
g_iConVarAdminFlag register_cvar"team_balancer_admin_flag""" );

    
set_taskget_pcvar_floatg_iConVarCheckFrequency ), "Task_CheckTeams", .flags "b" );

    new 
cFlag];
    
get_pcvar_stringg_iConVarAdminFlagcFlag);
    
g_iFlag read_flagscFlag );

    
g_iCsdmConVarPointer get_cvar_pointer"csdm_active" );
    
g_bCsdmEnabled g_iCsdmConVarPointer && get_pcvar_numg_iCsdmConVarPointer );
}

public 
Task_CheckTeams( )
{
    static 
iPlayers_TE32 ], iPlayers_CT32 ], iNum_TEiNum_CTiPlayer;
    
get_playersiPlayers_TEiNum_TE"e""TERRORIST" );
    
get_playersiPlayers_CTiNum_CT"e""CT" );

    
// Check whether teams should be balanced
    
if( iNum_TE == iNum_CT || !iNum_TE || !iNum_CT )
        return;

    
// Is the difference between terrorists and counter-terrorists higher than the specified value?
    
if( iNum_TE iNum_CT get_pcvar_numg_iConVarTerroristsDifference ) )
    {
        
// Get a terrorist
        
iPlayer GetLowestFragsTargetCsTeamsCS_TEAM_T );

        
// Is this specified target a valid one?
        
if( iPlayer == INVALID_PLAYER )
            return;

        
// Transfer him to the opposite team
        
cs_set_user_teamiPlayerCsTeamsCS_TEAM_CT );

        
// Make sure the difference between players is alright
        
Task_CheckTeams( );
    }

    
// Is the difference between counter-terrorists and terrorists higher than the specified value?
    
else if( iNum_CT iNum_TE get_pcvar_numg_iConVarCTerroristsDifference ) )
    {
        
// Get a counter-terrorist
        
iPlayer GetLowestFragsTargetCsTeamsCS_TEAM_CT );

        
// Is this specified target a valid one?
        
if( iPlayer == INVALID_PLAYER )
            return;

        
// Transfer him to the opposite team
        
cs_set_user_teamiPlayerCsTeamsCS_TEAM_T );

        
// Make sure the difference between players is alright
        
Task_CheckTeams( );
    }
}

// This function will return the player with the lowest frags from one team or INVALID_PLAYER on invalid specified target found
GetLowestFragsTargetCsTeamsiTeam )
{
    static 
iTargetiPlayers32 ], iNumiPlayeriiMinimumFragsiFrags;

    switch( 
CsTeamsiTeam )
    {
        case 
CS_TEAM_Tg_bCsdmEnabled get_playersiPlayersiNum"e""TERRORIST" ) : get_playersiPlayersiNum"be""TERRORIST" );
        case 
CS_TEAM_CTg_bCsdmEnabled get_playersiPlayersiNum"e""CT" ) : get_playersiPlayersiNum"be""CT" );
    }

    
// The biggest number
    
iMinimumFrags 0xFFFFFF;

    
// Invalid target
    
iTarget INVALID_PLAYER;

    for( 
0iNumi++ )
    {
        
iPlayer iPlayers];

        if( 
g_iFlag && get_user_flagsiPlayer ) & g_iFlag )
            continue;

        
iFrags get_user_fragsiPlayer );

        if( 
iFrags iMinimumFrags )
        {
            
iMinimumFrags iFrags;
            
iTarget iPlayer;
        }
    }

    return 
iTarget;


Przeczytaj cały wpis

Odnośnik do komentarza
Udostępnij na innych stronach

Gość
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
 Udostępnij

  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...