Raised This Month: $ Target: $400
 0% 

Instant AutoTeamBalance


Post New Thread Reply   
 
Thread Tools Display Modes
TRUE RED
Senior Member
Join Date: Mar 2012
Location: Ukraine
Old 05-28-2013 , 01:38   Re: Instant AutoTeamBalance
Reply With Quote #101

how to remove chat message from this code?

Code:
/*	Formatright © 2010, ConnorMcLeod

	This plugin is free software;
	you can redistribute it and/or modify it under the terms of the
	GNU General Public License as published by the Free Software Foundation.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this plugin; if not, write to the
	Free Software Foundation, Inc., 59 Temple Place - Suite 330,
	Boston, MA 02111-1307, USA.
*/

#include <amxmodx>
#include <orpheu>

#define VERSION "0.0.2"
#define PLUGIN "Instant AutoTeam Balance"

new OrpheuFunction:g_OfBalanceTeams 
new OrpheuFunction:g_OfClientPrintAll
new g_pGameRules

public plugin_precache()
{
	OrpheuRegisterHook(OrpheuGetFunction("InstallGameRules"), "OnInstallGameRules_Post", OrpheuHookPost)
}

public OnInstallGameRules_Post()
{
	g_pGameRules = OrpheuGetReturn()
}

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, "ConnorMcLeod")

	g_OfBalanceTeams = OrpheuGetFunction("BalanceTeams", "CHalfLifeMultiplay")
	g_OfClientPrintAll = OrpheuGetFunction("UTIL_ClientPrintAll")

	register_event("TextMsg", "Ev_TextMsg_TeamBalanceNextRound", "a", "1=4", "2=#Auto_Team_Balance_Next_Round")
}

public Ev_TextMsg_TeamBalanceNextRound()
{
	static bool:bHooking = false
	if( bHooking )
	{   // Send BalanceTeams Call the message we are just post hooking...
		return
	}

	bHooking = true
	OrpheuCall(g_OfBalanceTeams, g_pGameRules)
	bHooking = false

	UTIL_ClientPrintAll(print_center, "Teams Auto Balanced")
}

UTIL_ClientPrintAll(msg_dest, const msg_name[], const param1[] = "", const param2[] = "", const param3[] = "", const param4[] = "")
{
	OrpheuCall(g_OfClientPrintAll, msg_dest, msg_name, param1, param2, param3, param4)
}
TRUE RED is offline
Send a message via ICQ to TRUE RED Send a message via Skype™ to TRUE RED
11922911
Senior Member
Join Date: Dec 2011
Location: Yuen Long Country
Old 05-28-2013 , 02:00   Re: Instant AutoTeamBalance
Reply With Quote #102

Quote:
Originally Posted by TRUE RED View Post
how to remove chat message from this code?

Code:
/*	Formatright © 2010, ConnorMcLeod

	This plugin is free software;
	you can redistribute it and/or modify it under the terms of the
	GNU General Public License as published by the Free Software Foundation.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this plugin; if not, write to the
	Free Software Foundation, Inc., 59 Temple Place - Suite 330,
	Boston, MA 02111-1307, USA.
*/

#include <amxmodx>
#include <orpheu>

#define VERSION "0.0.2"
#define PLUGIN "Instant AutoTeam Balance"

new OrpheuFunction:g_OfBalanceTeams 
new OrpheuFunction:g_OfClientPrintAll
new g_pGameRules

public plugin_precache()
{
	OrpheuRegisterHook(OrpheuGetFunction("InstallGameRules"), "OnInstallGameRules_Post", OrpheuHookPost)
}

public OnInstallGameRules_Post()
{
	g_pGameRules = OrpheuGetReturn()
}

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, "ConnorMcLeod")

	g_OfBalanceTeams = OrpheuGetFunction("BalanceTeams", "CHalfLifeMultiplay")
	g_OfClientPrintAll = OrpheuGetFunction("UTIL_ClientPrintAll")

	register_event("TextMsg", "Ev_TextMsg_TeamBalanceNextRound", "a", "1=4", "2=#Auto_Team_Balance_Next_Round")
}

public Ev_TextMsg_TeamBalanceNextRound()
{
	static bool:bHooking = false
	if( bHooking )
	{   // Send BalanceTeams Call the message we are just post hooking...
		return
	}

	bHooking = true
	OrpheuCall(g_OfBalanceTeams, g_pGameRules)
	bHooking = false

	UTIL_ClientPrintAll(print_center, "Teams Auto Balanced")
}

UTIL_ClientPrintAll(msg_dest, const msg_name[], const param1[] = "", const param2[] = "", const param3[] = "", const param4[] = "")
{
	OrpheuCall(g_OfClientPrintAll, msg_dest, msg_name, param1, param2, param3, param4)
}
I think you know it.
__________________
youtube:
@holla16
11922911 is offline
alonelive
Senior Member
Join Date: Jan 2011
Location: Big snow country.. :)
Old 05-30-2013 , 09:49   Re: Instant AutoTeamBalance
Reply With Quote #103

I think.. You should disable this lines:

PHP Code:
//new OrpheuFunction:g_OfClientPrintAll
//g_OfClientPrintAll = OrpheuGetFunction("UTIL_ClientPrintAll")
//UTIL_ClientPrintAll(print_center, "Teams Auto Balanced")

/*UTIL_ClientPrintAll(msg_dest, const msg_name[], const param1[] = "", const param2[] = "", const param3[] = "", const param4[] = "")
{
          OrpheuCall(g_OfClientPrintAll, msg_dest, msg_name, param1, param2, param3, param4)
}*/ 
__________________
sorry my bad english...
alonelive is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 10-05-2013 , 12:33   Re: Instant AutoTeamBalance
Reply With Quote #104

ConnorMcLeod, if you have time, can you edit this plugin for unlimited balance? Because on my server it only balance 4 players in max, but i need it without limit of players for be balanced.
__________________
Jhob94 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-05-2013 , 16:07   Re: Instant AutoTeamBalance
Reply With Quote #105

Default plugin has no limit.
If you use orpheu version, may be the game has a 4 limit.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 10-05-2013 , 16:29   Re: Instant AutoTeamBalance
Reply With Quote #106

Quote:
Originally Posted by ConnorMcLeod View Post
Default plugin has no limit.
If you use orpheu version, may be the game has a 4 limit.
I am using the default plugin.
It doesnt balances the teams at all. And the problem is that in some maps, because of that, some people get kicked. I am not saying plugin sucks xD It is being very usefull, but it is zombie mod and when server is full for some reason it doesnt balance as it should. When not much players, it does balance perfectly.
__________________
Jhob94 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-06-2013 , 02:11   Re: Instant AutoTeamBalance
Reply With Quote #107

Plugin is transfering all needed players, you may use a plugin that interfers.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
isotonic
AlliedModders Donor
Join Date: Jun 2011
Location: Moscow, Russia
Old 11-19-2013 , 08:28   Re: Instant AutoTeamBalance
Reply With Quote #108

Quote:
Originally Posted by S0m3Th1nG_AwFul View Post
I tried to use version "that transfer only dying player." on GunGame (Condition Zero server), and there is one annoying bug:

When I kill player, which would be transfered after death, GG, by unknown reason, counts it to me as a teamkill, so I lose level (or point) for it. =.=
As a simple solution you might use light delay before player transferring. Then GG mod could finish its process on client death.
--

BTW I made custom version of traditional plugin version. Now plugin's message defined by iatb_message cvar is printed instead of 'Auto-Team Balance next round'.
__________________

Last edited by ConnorMcLeod; 11-19-2013 at 11:49. Reason: cvar already exists in original plugin, + inefficient modification
isotonic is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-19-2013 , 11:45   Re: Instant AutoTeamBalance
Reply With Quote #109

Switch back to register_event please, else you gonna catch every TextMsg messages witch is a bad thing.

[edit] Just figured that you haven't added anything, plugin removed.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 11-19-2013 at 11:48.
ConnorMcLeod is offline
isotonic
AlliedModders Donor
Join Date: Jun 2011
Location: Moscow, Russia
Old 11-19-2013 , 17:18   Re: Instant AutoTeamBalance
Reply With Quote #110

register_event does not allow to block or change default in-game message and I have to use register_message. What kind of efficient way could be without using Orpheu? ;)
__________________
isotonic 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 20:36.


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