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

Looking for the best autobalance plugin


Post New Thread Reply   
 
Thread Tools Display Modes
_GamerX
AlliedModders Donor
Join Date: Jun 2011
Location: Fun Server
Old 06-22-2017 , 13:00   Re: Looking for the best autobalance plugin
Reply With Quote #11

This: HookEvent("round_start", OnRoundStart, EventHookMode_Pre);
change to this HookEvent("round_prestart", OnRoundStart);
__________________
_GamerX is offline
Send a message via ICQ to _GamerX Send a message via Skype™ to _GamerX
Obyboby
Veteran Member
Join Date: Sep 2013
Old 06-22-2017 , 14:53   Re: Looking for the best autobalance plugin
Reply With Quote #12

Quote:
Originally Posted by _GamerX View Post
This: HookEvent("round_start", OnRoundStart, EventHookMode_Pre);
change to this HookEvent("round_prestart", OnRoundStart);
Thanks dude, I replaced that in the latest source of the plugin as posted in the previous page, let's see if it works
__________________
Obyboby is offline
WatchDogs
Senior Member
Join Date: Oct 2015
Location: Iran
Old 07-02-2017 , 08:51   Re: Looking for the best autobalance plugin
Reply With Quote #13

Oh Thank you so much _GamerX.

Here is fixed-working version:

PHP Code:
#pragma semicolon 1

#define PLUGIN_AUTHOR "[W]atch [D]ogs"
#define PLUGIN_VERSION "1.0.6"

#include <sourcemod>
#include <cstrike>
#include <sdktools_functions>

#pragma newdecls required

Handle h_bEnable;

public 
Plugin myinfo 
{
    
name "Fast Team Balancer",
    
author PLUGIN_AUTHOR,
    
description "Balances teams at start of every rounds",
    
version PLUGIN_VERSION,
    
url "https://forums.alliedmods.net/showthread.php?t=298717"
};

public 
void OnPluginStart()
{
    
h_bEnable CreateConVar("sm_ftb_enable""1""Enable / Disable fast team balancing"_true0.0true1.0);
    if(
GetEngineVersion() == Engine_CSGO)
        
HookEvent("round_prestart"Event_PreRoundStart);
    else
        
HookEvent("round_end"Event_PreRoundStart);
}

public 
Action Event_PreRoundStart(Handle event, const char[] namebool dontBroadcast)
{
    
int T_Count GetTeamClientCount(CS_TEAM_T);
    
int CT_Count GetTeamClientCount(CS_TEAM_CT);
    
    if(!
GetConVarBool(h_bEnable) || T_Count == CT_Count || T_Count == CT_Count || CT_Count == T_Count)
        return 
Plugin_Continue;
        
    while(
T_Count CT_Count && T_Count != CT_Count 1)
    {
        
int client GetRandomPlayer(CS_TEAM_T);
        
CS_SwitchTeam(clientCS_TEAM_CT);
        
T_Count--;
        
CT_Count++;
    }
    while(
T_Count CT_Count && CT_Count != T_Count 1)
    {
        
int client GetRandomPlayer(CS_TEAM_CT);
        
CS_SwitchTeam(clientCS_TEAM_T);
        
CT_Count--;
        
T_Count++;
    }
    return 
Plugin_Continue;
}

stock int GetRandomPlayer(int team

    
int[] clients = new int[MaxClients]; 
    
int clientCount
    for (
int i 1<= MaxClientsi++) 
    { 
        if (
IsClientInGame(i) && GetClientTeam(i) == team)
        { 
            
clients[clientCount++] = i
        } 
    } 
    return (
clientCount == 0) ? -clients[GetRandomInt(0clientCount 1)]; 

EDIT: 1.0.6 | Fixed a bug for non-CSGO games.
Attached Files
File Type: sp Get Plugin or Get Source (FastTeamBalance.sp - 347 views - 1.8 KB)

Last edited by WatchDogs; 07-03-2017 at 04:01.
WatchDogs is offline
Obyboby
Veteran Member
Join Date: Sep 2013
Old 07-02-2017 , 17:42   Re: Looking for the best autobalance plugin
Reply With Quote #14

This is nearly perfect but sometimes players are slayed at the end of a round in order to be moved. It doesn't always happen though.
Could you look into that?
__________________
Obyboby is offline
WatchDogs
Senior Member
Join Date: Oct 2015
Location: Iran
Old 07-03-2017 , 02:09   Re: Looking for the best autobalance plugin
Reply With Quote #15

Are you using the last version ?

CS_SwitchTeam shouldn't slay them.

Check the version if problem continues I'll give you another thing to test.
WatchDogs is offline
Obyboby
Veteran Member
Join Date: Sep 2013
Old 07-03-2017 , 03:51   Re: Looking for the best autobalance plugin
Reply With Quote #16

Quote:
Originally Posted by WatchDogs View Post
Are you using the last version ?

CS_SwitchTeam shouldn't slay them.

Check the version if problem continues I'll give you another thing to test.
Oops, I had 1.0.2 installed
Wil update to 1.0.6 and test.
__________________

Last edited by Obyboby; 07-03-2017 at 04:09.
Obyboby is offline
Obyboby
Veteran Member
Join Date: Sep 2013
Old 07-20-2017 , 12:56   Re: Looking for the best autobalance plugin
Reply With Quote #17

Hey man, can you please check the plugin?
Some players reported that it resets their money upon moving to the other team.
It would be cool if the money was saved
I'm still not sure if this is related to this plugin itself or it's an incompatibility with another one... just trying to trouble shoot.
Thanks!
__________________
Obyboby is offline
vortex.
AlliedModders Donor
Join Date: Jan 2017
Location: OnGameFrame()
Old 07-20-2017 , 13:03   Re: Looking for the best autobalance plugin
Reply With Quote #18

I do not think it has anything to do with the plugin. But if you want, money can save before team transfer. When team transfer done, give money again. I can do that, if you want.
__________________
vortex. is offline
Obyboby
Veteran Member
Join Date: Sep 2013
Old 07-20-2017 , 13:14   Re: Looking for the best autobalance plugin
Reply With Quote #19

Quote:
Originally Posted by vortex. View Post
I do not think it has anything to do with the plugin. But if you want, money can save before team transfer. When team transfer done, give money again. I can do that, if you want.
Yes please! So that I can add it to this plugin and see if the issue gets fixed.
Another "suspect" is the teambets plugin that I have recently installed but..one thing at a time :p
__________________
Obyboby is offline
vortex.
AlliedModders Donor
Join Date: Jan 2017
Location: OnGameFrame()
Old 07-20-2017 , 14:09   Re: Looking for the best autobalance plugin
Reply With Quote #20

I know this is very strange. But we must try. It will work.
This idea is ridiculous xD

EDIT: Test and report please, if dont working, we can add timers.

PHP Code:
#pragma semicolon 1 

#define PLUGIN_AUTHOR "[W]atch [D]ogs" // Respect ;)
#define PLUGIN_VERSION "1.0.6" 

#include <sourcemod> 
#include <cstrike> 
#include <sdktools_functions> 
#include <smlib>

#pragma newdecls required 

Handle h_bEnable

public 
Plugin myinfo =  

    
name "Fast Team Balancer"
    
author PLUGIN_AUTHOR
    
description "Balances teams at start of every rounds"
    
version PLUGIN_VERSION
    
url "https://forums.alliedmods.net/showthread.php?t=298717" 
}; 

public 
void OnPluginStart() 

    
h_bEnable CreateConVar("sm_ftb_enable""1""Enable / Disable fast team balancing"_true0.0true1.0); 
    if(
GetEngineVersion() == Engine_CSGO
        
HookEvent("round_prestart"Event_PreRoundStart); 
    else 
        
HookEvent("round_end"Event_PreRoundStart); 


public 
Action Event_PreRoundStart(Handle event, const char[] namebool dontBroadcast

    
int T_Count GetTeamClientCount(CS_TEAM_T); 
    
int CT_Count GetTeamClientCount(CS_TEAM_CT); 
     
    if(!
GetConVarBool(h_bEnable) || T_Count == CT_Count || T_Count == CT_Count || CT_Count == T_Count
        return 
Plugin_Continue
         
    while(
T_Count CT_Count && T_Count != CT_Count 1
    { 
        
int client GetRandomPlayer(CS_TEAM_T);
        
int oldmoney Client_GetMoney(client);
        
CS_SwitchTeam(clientCS_TEAM_CT);
        
int newmoney Client_GetMoney(client);
        
T_Count--; 
        
CT_Count++; 
        if(
newmoney != oldmoney)
        {
            
Client_SetMoney(clientoldmoney);
        }
    } 
    while(
T_Count CT_Count && CT_Count != T_Count 1
    { 
        
int client GetRandomPlayer(CS_TEAM_CT); 
        
int oldmoney Client_GetMoney(client);
        
CS_SwitchTeam(clientCS_TEAM_T);
        
int newmoney Client_GetMoney(client);        
        
CT_Count--; 
        
T_Count++; 
        if(
newmoney != oldmoney)
        {
            
Client_SetMoney(clientoldmoney);
        }
    } 
    return 
Plugin_Continue


stock int GetRandomPlayer(int team)  
{  
    
int[] clients = new int[MaxClients];  
    
int clientCount;  
    for (
int i 1<= MaxClientsi++)  
    {  
        if (
IsClientInGame(i) && GetClientTeam(i) == team
        {  
            
clients[clientCount++] = i;  
        }  
    }  
    return (
clientCount == 0) ? -clients[GetRandomInt(0clientCount 1)];  

__________________

Last edited by vortex.; 07-20-2017 at 14:10.
vortex. is offline
Reply


Thread Tools
Display Modes

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 09:23.


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