Raised This Month: $32 Target: $400
 8% 

Plugin AutoBalance Team's


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
infogod
Junior Member
Join Date: Aug 2009
Old 10-06-2010 , 06:29   Plugin AutoBalance Team's
Reply With Quote #1

Good Morning Guys,

I made a plugin autobalance team per LVL, but, I would like to freeze round when this finish, it's possible? How?

Cordially,
Infogod.
infogod is offline
The Art of War
Veteran Member
Join Date: Dec 2009
Location: Sweden Rock Festival
Old 10-06-2010 , 07:39   Re: Plugin AutoBalance Team's
Reply With Quote #2

Post the plugin and please explain exactly what you want to be done with it.
__________________
The Art of War is offline
infogod
Junior Member
Join Date: Aug 2009
Old 10-06-2010 , 07:42   Re: Plugin AutoBalance Team's
Reply With Quote #3

I'm at office, coming home I post the plugin..

I want freeze round when this finish..
infogod is offline
The Art of War
Veteran Member
Join Date: Dec 2009
Location: Sweden Rock Festival
Old 10-06-2010 , 07:51   Re: Plugin AutoBalance Team's
Reply With Quote #4

When what finishes? After players have been auto-balanced? The best way I can come up with is to do it like 0.1 sec's before new round and then you wouldnt need a freeze.. Sorry but I cant help you without the script.
__________________
The Art of War is offline
infogod
Junior Member
Join Date: Aug 2009
Old 10-06-2010 , 07:56   Re: Plugin AutoBalance Team's
Reply With Quote #5

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <superheromod>

#define PLUGIN "AutoBalance no Final de cada round"
#define AUTHOR "infogod"
#define VERSION "1.0"


#define BALANCE_IMMUNITY        ADMIN_RCON

#define MAX_PLAYERS    32

enum {
    
aTerro,
    
aCt
}

new 
bool:g_bImmuned[MAX_PLAYERS+1]

new 
Float:g_fJoinedTeam[MAX_PLAYERS+1] = {-1.0, ...}

new 
g_iMaxPlayers
new g_pcvarEnableg_pcvarImmuneg_pCvarMessage
new bool:g_bValid[MAX_PLAYERS+1]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
g_pcvarEnable register_cvar("iatb_active""1")
    
g_pcvarImmune register_cvar("iatb_admins_immunity""1")
    
g_pCvarMessage register_cvar("iatb_message""Teams Auto Balanced")
    
register_logevent("round_End"2"1=Round_End")
    
g_iMaxPlayers get_maxplayers();
}



public 
client_authorized(id)
{
    
g_bImmuned[id] = bool:(get_user_flags(id) & BALANCE_IMMUNITY)
}

public 
client_putinserver(id)
{
    
g_bValid[id] = bool:!is_user_hltv(id)
}

public 
client_disconnect(id)
{
    
g_bValid[id] = false
}

cs_set_user_team_custom(idCsTeams:iTeam)
{
    
cs_set_user_team(idiTeam)
    return 
1
}




balance_teams()
{
    new 
allPlayerLevel[MAX_PLAYERS]
    new 
indice 0
    
new id
    
new playersConnected =0
   
      
for(id 1id <= g_iMaxPlayersid++)
       {
              if(!
g_bValid[id])
                        continue
              
playersConnected++
         
allPlayerLevel[indice++] = id
       
}
       new 
i,j,aux
       
for(i=0;i<playersConnected;i++){
    for(
j=i+1;j<playersConnected;j++){
           if(
sh_get_user_xp(allPlayerLevel[i]) > sh_get_user_xp(allPlayerLevel[j])){
        
aux allPlayerLevel[i]
        
allPlayerLevel[i] = allPlayerLevel[j]
        
allPlayerLevel[j] = aux
           
}
        
    }
       }
       
    
 
    if(
playersConnected 2){
        new 
t
        
if(random_num(1,7)%2==0){
          
0
          id 
0
        
}else{ 
          
1
          id 
1
        
}
        
        while(
id indice)
        {
        
set_user_godmode(id,1)
        
cs_set_user_team_custom(allPlayerLevel[id], CS_TEAM_T)
        
id=id+2
        
}
        if (
t==1)
           
id 0
         
else
           
id 1
           
        
while(id indice)
        {
            
set_user_godmode(id,1)
        
cs_set_user_team_custom(allPlayerLevel[id], CS_TEAM_CT)
        
id=id+2
        
}
        
   }
}

public 
round_End()
{
    
balance_teams()

infogod is offline
The Art of War
Veteran Member
Join Date: Dec 2009
Location: Sweden Rock Festival
Old 10-06-2010 , 08:21   Re: Plugin AutoBalance Team's
Reply With Quote #6

Okey so, what exactly is it you want to do?

Stop the round in

Code:
cs_set_user_team_custom(id, CsTeams:iTeam)
?
__________________
The Art of War is offline
infogod
Junior Member
Join Date: Aug 2009
Old 10-06-2010 , 08:24   Re: Plugin AutoBalance Team's
Reply With Quote #7

yeah
infogod is offline
The Art of War
Veteran Member
Join Date: Dec 2009
Location: Sweden Rock Festival
Old 10-06-2010 , 08:27   Re: Plugin AutoBalance Team's
Reply With Quote #8

... Why? It is called when the round ends, and when the new round starts, the round is already frozen lol.
__________________
The Art of War is offline
infogod
Junior Member
Join Date: Aug 2009
Old 10-06-2010 , 08:29   Re: Plugin AutoBalance Team's
Reply With Quote #9

Quote:
Originally Posted by The Art of War View Post
... Why? It is called when the round ends, and when the new round starts, the round is already frozen lol.
but players are balanced and can kill others players after balance..
infogod is offline
The Art of War
Veteran Member
Join Date: Dec 2009
Location: Sweden Rock Festival
Old 10-06-2010 , 08:41   Re: Plugin AutoBalance Team's
Reply With Quote #10

PHP Code:
register_logevent("round_End"2"1=Round_End")

public 
round_End()
{
    
balance_teams()

Is called when the round ends.
__________________
The Art of War is offline
Reply



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 17:54.


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