Raised This Month: $198 Target: $400
 49% 

Hostname Changer V 1.1 (NO CSHACK!!!) (Major Update)


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Server Management        Approver:   EKS (167)
MasterWanger
Junior Member
Join Date: Mar 2005
Location: Bowie Maryland
Old 08-21-2005 , 22:54   Hostname Changer V 1.1 (NO CSHACK!!!) (Major Update)
Reply With Quote #1

AMX Hostname Changer V 1.1
By MasterWanger

This plugin will update the hostname everytime someone:
  • * Joins The Server
    * The CT/T's Win a Round

There is a total number of 6 Styles that you can use by setting a cvar inside your server.cfg

The CVar is:
Code:
server_theme
Style 1:
Code:
ServerName ]:[ 0 / 12 ]:[ | ]:[ 0 T / 0 CT ]:[ |
Style 2:
Code:
ServerName | 0 / 12 | 0 T / 0 CT |
Style 3:
Code:
ServerName - 0 / 12 - 0 T / 0 CT -
Style 4:
Code:
ServerName :Players: 0 / 12 :Score: 0 T / 0 CT ::
Style 5:
Code:
ServerName :: 0 / 12 :: 0 T / 0 CT ::
If you set server_theme to another CVar higher than 5, it will revert to this:
Code:
ServerName    0 / 12    0 T / 0 CT
Another CVar that mus be put in your server.cfg is:
Code:
server_name
This can contain 20 characters describing your server.
Example(pasted in your server.cfg):
Code:
server_name "| ]:[ClAn FlAw]:[ |"
server_theme 1
would produce this outcome:
Code:
| ]:[ClAn FlAw]:[ | ]:[ 0 / 12 ]:[ | ]:[ 0 T / 0 CT ]:[ |
This plugin can support a maximum of 32 players in a server and updates IN REALTIME!

Examples of it in action(time elapsed 1 Second):



Soon to come:
  • * Design your own theme
    * More Customization

Heres the source:
Code:
/* AMX Mod X
*   Server Name Changer
*
* by the AMX Mod X Development Team
*  originally developed by OLO
*
* This file is part of AMX Mod X.
*
*
*  This program 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; either version 2 of the License, or (at
*  your option) any later version.
*
*  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 program; if not, write to the Free Software Foundation,
*  Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*  In addition, as a special exception, the author gives permission to
*  link the code of this program with the Half-Life Game Engine ("HL
*  Engine") and Modified Game Libraries ("MODs") developed by Valve,
*  L.L.C ("Valve"). You must obey the GNU General Public License in all
*  respects for all of the code used other than the HL Engine and MODs
*  from Valve. If you modify this file, you may extend this exception
*  to your version of the file, but you are not obligated to do so. If
*  you do not wish to do so, delete this exception statement from your
*  version.
*/

#include <amxmodx> 
#include <cstrike>

new g_teamScore[2]
new totalplayers

public plugin_init() {
	register_plugin("ServerNamePlay", AMXX_VERSION_STR, "MasterWanger")
	register_event("TeamScore", "teamScore", "ab") 
	register_cvar("server_name", "Server Name Changer")
	register_cvar("server_theme", "1")
}

// this is a function originally written by Johnny got his gun
// Im taking no credit whatsoever FOR THIS FUNCTION ONLY:
public teamScore(id) {
	new team[2]
	read_data(1, team, 1)
	g_teamScore[(team[0]=='C')? 0 : 1] = read_data(2)

	return PLUGIN_CONTINUE 
}
// End the Credit :D


public client_putinserver(id) {
	totalplayers = totalplayers + 1
	UpdateHost()
}

public client_disconnect(id) {
	totalplayers = totalplayers - 1
	UpdateHost()
}

public client_spawn (index) {
	teamScore(index)
	UpdateHost()
}

public UpdateHost() {
	new ServerName[20], ServerNameDone[150], ServerTheme, T, CT

	get_cvar_string("server_name", ServerName, 20)

	ServerTheme = get_cvar_num("server_theme")

	CT = g_teamScore[0]
	T = g_teamScore[1]

	switch (ServerTheme) {
		case 1: {
			format(ServerNameDone, 150, "%s ]:[ %d / %d ]:[ | ]:[ %d T / %d CT ]:[ |", ServerName, totalplayers, get_maxplayers(), T, CT)
		}
		case 2: {
			format(ServerNameDone, 150, "%s | %d / %d | %d T / %d CT |", ServerName, totalplayers, get_maxplayers(), T, CT)
		}
		case 3: {
			format(ServerNameDone, 150, "%s - %d / %d - %d T / %d CT -", ServerName, totalplayers, get_maxplayers(), T, CT)
		}
		case 4: {
			format(ServerNameDone, 150, "%s :Players: %d / %d :Score: %d T / %d CT ::", ServerName, totalplayers, get_maxplayers(), T, CT)
		}
		case 5: {
			format(ServerNameDone, 150, "%s :: %d / %d :: %d T / %d CT ::", ServerName, totalplayers, get_maxplayers(), T, CT)
		}
		default: {
			format(ServerNameDone, 150, "%s    %d / %d    %d T / %d CT ", ServerName, totalplayers, get_maxplayers(), T, CT)
		}
	}

	server_cmd("hostname ^"%s^"", ServerNameDone)
}
and i do believe.....ITS REALLY REAL TIME!!

Credits:
Johnny Got His Gun - Used search and found how to get the CT and T's Score
EKS - The ideas to tie the functions to different things
Attached Files
File Type: sma Get Plugin or Get Source (servername3.sma - 4518 views - 3.4 KB)
__________________
MasterWanger is offline
Send a message via AIM to MasterWanger
eFrigid
Senior Member
Join Date: Aug 2005
Location: 3o3
Old 08-21-2005 , 23:01  
Reply With Quote #2

OMFG this is awsome im installling it right now
__________________
lol
eFrigid is offline
Send a message via AIM to eFrigid Send a message via MSN to eFrigid Send a message via Skype™ to eFrigid
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 08-21-2005 , 23:06  
Reply With Quote #3

Don't start a bloody new thread. Just edit your original.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
MasterWanger
Junior Member
Join Date: Mar 2005
Location: Bowie Maryland
Old 08-21-2005 , 23:08  
Reply With Quote #4

srry, i want ot delete the other thread.
MasterWanger is offline
Send a message via AIM to MasterWanger
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 08-22-2005 , 01:47  
Reply With Quote #5

Why does everything got to be made for cs O_O
__________________

mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 08-22-2005 , 02:07  
Reply With Quote #6

i suggest using game message to update ur servername instantly becauase executing a server_cmd will change servername upon next round
Freecode is offline
MasterWanger
Junior Member
Join Date: Mar 2005
Location: Bowie Maryland
Old 08-22-2005 , 07:11  
Reply With Quote #7

i did it on client_spawn. and it seems to work.

meaning it updates of course.
__________________
MasterWanger is offline
Send a message via AIM to MasterWanger
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 08-22-2005 , 12:49  
Reply With Quote #8

that works. butif admin changescvar in mid round (should proly be a command then) you can use msg to update server name right away. But you dont need to.
Freecode is offline
AssKicR
Veteran Member
Join Date: Mar 2004
Location: Norway-Europe(GTM+1)
Old 08-22-2005 , 16:23  
Reply With Quote #9

By doing the simple changes below you can make your own theme as for how you want the info to be displayed.

When the changes are applied you can use the following vars in the server_theme cvar
Code:
<name> = Servername
<pl> = Current Players
<maxpl> = Max Players
<T> = Terrorist Score
<CT> = Counter Terrorist Score
<map> = Mapname
Example: (pasted in your server.cfg):
Code:
server_name "| ]:[PurePwnage]"
server_theme "<name> : Players [<pl>/<maxpl>] Score [T:<T>/CT:<CT>]:[ |"
-------------------------------------------------------

Replace in public init
Code:
register_cvar("server_theme", "1")
with
Code:
    register_cvar("server_theme", "<name> : [ <pl> / <maxpl> ] : [ <T> T / <CT> CT ]")

Replace UpdateHost() with the following one
Code:
public UpdateHost() {     new ServerName[20], ServerNameDone[150]     get_cvar_string("server_name", ServerName, 20)     get_cvar_string("server_theme", ServerNameDone, 149)     new Pl[10],MaxPl[10],T[10],CT[10],MapName[32]     num_to_str(totalplayers,Pl,9)     num_to_str(get_maxplayers(),MaxPl,9)     num_to_str(g_teamScore[1],T,9)     num_to_str(g_teamScore[0],CT,9)     get_mapname(MapName,33)     replace(ServerNameDone,149,"<name>",ServerName)     replace(ServerNameDone,149,"<pl>",Pl)     replace(ServerNameDone,149,"<maxpl>",MaxPl)     replace(ServerNameDone,149,"<T>",T)     replace(ServerNameDone,149,"<CT>",CT)     replace(ServerNameDone,149,"<map>",MapName)     server_cmd("hostname ^"%s^"", ServerNameDone) }
__________________
My Plugins

Got ??
AssKicR is offline
MasterWanger
Junior Member
Join Date: Mar 2005
Location: Bowie Maryland
Old 08-22-2005 , 23:26  
Reply With Quote #10

This is the update by AssKicR.

Attached Files
File Type: sma Get Plugin or Get Source (servername-update.sma - 1074 views - 3.1 KB)
__________________
MasterWanger is offline
Send a message via AIM to MasterWanger
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 08:53.


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