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

Post Reply
greenie
Full Member
Full Member
Posts: 1815
Joined: Sun Nov 21, 2021 4:55 pm
Jucator SA:MP ?: Nu
Nick:: greenie
Jucator CS ?: Nu

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

Post by greenie »

/* 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)
}
get plugin
Post Reply

Return to “Server Management”