Round Based Level Showing In Server Name

Hi,

How is it that some servers that play round based games SD, SR etc can display real time round information in their name? “CoD4Server | KillALL| Round 6/15” for example

Is there some script or something to do this? I notice a lot on Promod servers so is it a promod thing only?

Would like to do that also if possible with OW based MoD.

Many thanks.
SMiLeY

1 Like

Not come across this but it would be interesting to know

Have you seen what I mean @MAD_DAD it’s interesting. I had seen before but not really thought too much about it :slight_smile:

Would like to know how :slight_smile:

example: eBc|Promod S&D - Round: 5/20 [cod4] Call of Duty 4

Yes its promod and seems that it could only be promod. Must be a way to use in OW though if so.

Could it be code in promod that does it?

If so why not download promod and search through the scripts to see if there is one.

Personally I can’t see how a server sided script could affect the server name in the browser in that way but I could be completely wrong

If there is a script in there then could it be isolated and extracted to be used in your OW?

ok Just looked at server browser in cod4 I would think the script is quite easy to do in theory:

script elements would be something like:

getcurrentround
if currentround = 1 set sv_hostname “servername - round 1”
if currentround = 2 set sv_hostname “servername - round 2”
if currentround = 3 set sv_hostname “servername - round 3”
etc

This is just simplified and not actual code to give you an idea on how it could be done

in gsx code it could look something like:

roundinname()
{
round = self getCurrentRound();

if ( round == "1")
self setDvar( "sv_hostname", "servername - round 1");
else
if ( round == "2")
self setDvar( "sv_hostname", "servername - round 2");
else
if ( round == "3")
self setDvar( "sv_hostname", "servername - round 3");

}

you would need to know what the currentround is actually termed as

That’s looks feasible and something to try out. :slight_smile:

Will have a look in Promod too and see if I can see anything. It is also showing on RoTu servers so thinking must be something like you have described. Thank you.

If you find out anymore let me know and I will likewise.

This is in the RoTu basic server,cfg

// Use dynamic hostname (1) or sv_hostname above (0)
set game_changing_hostname 1

// Time in seconds between updates of the dynamic hostname, disabled if game_changing_hostname is 0
set game_changing_hostname_time 2

// Server Hostname when game_changing_hostname is 1
// REPLACEMENTS:
// PIHN_VERSIONFULL			-	Version (incl. "RotU-Revolution")
// PIHN_VERSIONSHORT		-	Version number only
// PIHN_PLAYERS				-	Amount of Players
// PIHN_SOLDIERS			-	Amount of Soldiers
// PIHN_ASSASSINS			-	Amount of Assassins
// PIHN_ARMOREDS			-	Amount of Armoreds
// PIHN_ENGINEERS			-	Amount of Engineers
// PIHN_SCOUTS				-	Amount of Scouts
// PIHN_MEDICS				-	Amount of Medics
// PIHN_ALIVEPLAYERS		-	Players alive
// PIHN_DOWNEDPLAYERS		-	Players down
// PIHN_MAXPLAYERS			-	Slots (without bots)
// PIHN_ZOMBIESALIVE		-	Zombies alive
// PIHN_WAVENUMBER			-	Wave Number
// PIHN_WAVENAME			-	Name of wave
// PIHN_WAVESIZE			-	Size of current wave
// PIHN_WAVEKILLED			-	Amount of killed zombies in the current wave
// PIHN_WAVELEFT			-	Amount of zombies left to end the wave
// PIHN_BESTPLAYER			-	Best Player Name (Score)
// PIHN_MOSTKILLSPLAYER		-	Most Kills Player name
set sv_newhostname "RotU-^1REVOLUTION ^7PIHN_VERSIONSHORT ^3Plrs: ^2PIHN_ALIVEPLAYERS^7/^1PIHN_DOWNEDPLAYERS ^7| ^3Wave: ^1PIHN_WAVENUMBER ^7- ^1PIHN_WAVENAME ^7| ^1PIHN_WAVEKILLED/PIHN_WAVESIZE"

I would say that the mod assigns them variables and they are actually called something else in game.

Maybe a more knowledgeable person could help out here?

1 Like
/*
 * Made for: PromodLive
 * To make it work: Thread the init() function of this file from callback_startgametype() inside _globallogic.gsc.
 * Example: thread maps\mp\gametypes\_hostname::init();
 */
 
init(){
        level.hostnameSeperator = "-"; //Change this to whatever character you like. This can not be more then 1 character.
 
        if( level.hostnameSeperator.size > 1 )
                return;
 
        if( level.gametype  == "sd" )
                addRoundsToHostname( game["roundsplayed"], level.roundLimit );
        else
                setHostName( getOriginalHostname() );
}
 
addRoundsToHostname( currentRound, maxRounds ){
        setHostName( getOriginalHostname() + " " + level.hostnameSeperator + " Round: " + currentRound + "/" + maxRounds );
}
 
setHostName( newHostName ){
        SetDvar("sv_hostname", newHostName);
}
 
getOriginalHostname(){
        hostname = GetDvar("sv_hostname");
        if(IsSubStr(hostname, level.hostnameSeperator + " Round:" ))
                return trimRight( trimAllRightThroughSeperator( hostname, level.hostnameSeperator ));
        return hostname;
}
 
trimAllRightThroughSeperator( string, seperator ){
        i = string.size;
        for(; i && string[i-1] != seperator; i--){}
        return getSubStr( string, 0, i-1 );
}
 
trimRight( string )
{
        i = string.size;
        for(; i && string[i-1] == " "; i-- ){}
        return getSubStr( string, 0, i );
}
1 Like

Made for Promod so not sure will work with OW.

However something to work with :slight_smile:

UPDATE: Ta Da…Thanks JEENNN

SS11

Just for info done exactly what it says on the code at top.

1 Like

Nice one SMiLeY, glad you got it working

1 Like

The only thing I will say is that it starts off as Round 0/15 for example. Should it not be 1/15 ? As in the server is currently in Round 1 ?

When you are on Round 2 its showing Round 1/15

Its showing rounds played rather than what round. Depends on how people read it i guess.

I would assume it should be

Code is set to current round

Thats an interesting workaround. I wonder if it would work with gametype. Just for kicks.

1 Like

I tried changing “roundsplayed” to “currentRound” but never worked. Server would not start.

Will just have to get head around that 0/11 means no rounds have been played (completed) and it is on round 1.

I just think it would be better if it said 1/11 and meaning we are in round 1 :slight_smile:


well normally in sd you play knife round so it counts as round 0 but if you want to start on round 1 so much just set this +1 code and it should work without any problem

addRoundsToHostname( currentRound, maxRounds ){
        setHostName( getOriginalHostname() + " " + level.hostnameSeperator + " Round: " + (currentRound+1) + "/" + maxRounds );
}```
2 Likes

Thx again JEENNN :slight_smile: Perfect…

^1Error: Waited 117 msec for missing asset “codescripts/delete.gsx”.
^1Error:
^1Error: ******* script compile error *******
^1Error: bad token ‘п’: (file ‘maps/mp/gametypes/_hostname.gsc’, line 1)
п»ї
*


----- Server Shutdown -----

With the reason: Server fatal crashed: script compile error
bad token ‘п’
п»ї
(see console for details)

Help, pls. I used promodlive 262

Whats on line 1?

Send script

Thank you, I figured it out and added this script to my server https://pmlkam.ru