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:
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:
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