# Round Based Level Showing In Server Name

**URL:** <https://cod4x.ovh/t/round-based-level-showing-in-server-name/1116>\
**Category:** CoD4x | Mods & Script Support\
**Created:** [November 4, 2022, 10:39pm UTC](https://cod4x.ovh/t/round-based-level-showing-in-server-name/1116 "2022-11-04T22:39:14Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![SMiLeY](https://cod4x.ovh/user_avatar/cod4x.ovh/smiley/32/2350_2.png) [@SMiLeY](https://cod4x.ovh/u/SMiLeY)\
**Post date:** [November 4, 2022, 10:39pm UTC](https://cod4x.ovh/t/round-based-level-showing-in-server-name/1116/1 "2022-11-04T22:39:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![MAD\_DAD](https://cod4x.ovh/letter_avatar_proxy/v4/letter/m/b2d939/32.png) [@MAD\_DAD](https://cod4x.ovh/u/MAD_DAD)\
**Post date:** [November 5, 2022, 11:32am UTC](https://cod4x.ovh/t/round-based-level-showing-in-server-name/1116/2 "2022-11-05T11:32:42Z")

</div>

Not come across this but it would be interesting to know

---

<div class="post-metadata">

**Author:** ![SMiLeY](https://cod4x.ovh/user_avatar/cod4x.ovh/smiley/32/2350_2.png) [@SMiLeY](https://cod4x.ovh/u/SMiLeY)\
**Post date:** [November 5, 2022, 12:57pm UTC](https://cod4x.ovh/t/round-based-level-showing-in-server-name/1116/3 "2022-11-05T12:57:45Z")

</div>

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

Would like to know how 🙂

example: [eBc|Promod S&D - Round: 5/20 [cod4] Call of Duty 4](https://www.gametracker.com/server_info/explicitbouncers.com:28950/)

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

---

<div class="post-metadata">

**Author:** ![MAD\_DAD](https://cod4x.ovh/letter_avatar_proxy/v4/letter/m/b2d939/32.png) [@MAD\_DAD](https://cod4x.ovh/u/MAD_DAD)\
**Post date:** [November 5, 2022, 1:02pm UTC](https://cod4x.ovh/t/round-based-level-showing-in-server-name/1116/4 "2022-11-05T13:02:29Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![MAD\_DAD](https://cod4x.ovh/letter_avatar_proxy/v4/letter/m/b2d939/32.png) [@MAD\_DAD](https://cod4x.ovh/u/MAD_DAD)\
**Post date:** [November 5, 2022, 1:08pm UTC](https://cod4x.ovh/t/round-based-level-showing-in-server-name/1116/5 "2022-11-05T13:08:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![SMiLeY](https://cod4x.ovh/user_avatar/cod4x.ovh/smiley/32/2350_2.png) [@SMiLeY](https://cod4x.ovh/u/SMiLeY)\
**Post date:** [November 5, 2022, 1:28pm UTC](https://cod4x.ovh/t/round-based-level-showing-in-server-name/1116/6 "2022-11-05T13:28:16Z")

</div>

That’s looks feasible and something to try out. 🙂

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.

---

<div class="post-metadata">

**Author:** ![SMiLeY](https://cod4x.ovh/user_avatar/cod4x.ovh/smiley/32/2350_2.png) [@SMiLeY](https://cod4x.ovh/u/SMiLeY)\
**Post date:** [November 5, 2022, 2:29pm UTC](https://cod4x.ovh/t/round-based-level-showing-in-server-name/1116/7 "2022-11-05T14:29:27Z")

</div>

This is in the RoTu basic server,cfg

```auto
// 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"

```

---

<div class="post-metadata">

**Author:** ![MAD\_DAD](https://cod4x.ovh/letter_avatar_proxy/v4/letter/m/b2d939/32.png) [@MAD\_DAD](https://cod4x.ovh/u/MAD_DAD)\
**Post date:** [November 5, 2022, 3:58pm UTC](https://cod4x.ovh/t/round-based-level-showing-in-server-name/1116/8 "2022-11-05T15:58:13Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![JEENNN](https://cod4x.ovh/user_avatar/cod4x.ovh/jeennn/32/397_2.png) [@JEENNN](https://cod4x.ovh/u/JEENNN)\
**Post date:** [November 5, 2022, 7:03pm UTC](https://cod4x.ovh/t/round-based-level-showing-in-server-name/1116/9 "2022-11-05T19:03:02Z")

</div>

```auto
/*
 * 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 );
}

```

---

<div class="post-metadata">

**Author:** ![SMiLeY](https://cod4x.ovh/user_avatar/cod4x.ovh/smiley/32/2350_2.png) [@SMiLeY](https://cod4x.ovh/u/SMiLeY)\
**Post date:** [November 5, 2022, 8:37pm UTC](https://cod4x.ovh/t/round-based-level-showing-in-server-name/1116/10 "2022-11-05T20:37:26Z")

</div>

Made for Promod so not sure will work with OW.

However something to work with 🙂

UPDATE: Ta Da…Thanks JEENNN

![SS11](https://cod4x.ovh/uploads/default/original/1X/16609b8f710148118d2453626b20f5dd0395e111.png)

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

---

<div class="post-metadata">

**Author:** ![MAD\_DAD](https://cod4x.ovh/letter_avatar_proxy/v4/letter/m/b2d939/32.png) [@MAD\_DAD](https://cod4x.ovh/u/MAD_DAD)\
**Post date:** [November 6, 2022, 10:33am UTC](https://cod4x.ovh/t/round-based-level-showing-in-server-name/1116/11 "2022-11-06T10:33:56Z")

</div>

Nice one SMiLeY, glad you got it working

---

<div class="post-metadata">

**Author:** ![SMiLeY](https://cod4x.ovh/user_avatar/cod4x.ovh/smiley/32/2350_2.png) [@SMiLeY](https://cod4x.ovh/u/SMiLeY)\
**Post date:** [November 7, 2022, 1:33pm UTC](https://cod4x.ovh/t/round-based-level-showing-in-server-name/1116/12 "2022-11-07T13:33:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![MAD\_DAD](https://cod4x.ovh/letter_avatar_proxy/v4/letter/m/b2d939/32.png) [@MAD\_DAD](https://cod4x.ovh/u/MAD_DAD)\
**Post date:** [November 7, 2022, 7:33pm UTC](https://cod4x.ovh/t/round-based-level-showing-in-server-name/1116/13 "2022-11-07T19:33:11Z")

</div>

I would assume it should be

Code is set to current round

---

<div class="post-metadata">

**Author:** ![Sheryl](https://cod4x.ovh/letter_avatar_proxy/v4/letter/s/ce7236/32.png) [@Sheryl](https://cod4x.ovh/u/Sheryl)\
**Post date:** [November 8, 2022, 1:23pm UTC](https://cod4x.ovh/t/round-based-level-showing-in-server-name/1116/14 "2022-11-08T13:23:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![SMiLeY](https://cod4x.ovh/user_avatar/cod4x.ovh/smiley/32/2350_2.png) [@SMiLeY](https://cod4x.ovh/u/SMiLeY)\
**Post date:** [November 8, 2022, 3:24pm UTC](https://cod4x.ovh/t/round-based-level-showing-in-server-name/1116/15 "2022-11-08T15:24:07Z")

</div>

> [@JEENNN](#):
>
> ```auto
> if( level.gametype == "sd" )
> addRoundsToHostname( game["roundsplayed"], level.roundLimit );
> 
> ```

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 🙂

---

<div class="post-metadata">

**Author:** ![JEENNN](https://cod4x.ovh/user_avatar/cod4x.ovh/jeennn/32/397_2.png) [@JEENNN](https://cod4x.ovh/u/JEENNN)\
**Post date:** [November 8, 2022, 6:49pm UTC](https://cod4x.ovh/t/round-based-level-showing-in-server-name/1116/16 "2022-11-08T18:49:56Z")

</div>

![image](https://cod4x.ovh/uploads/default/original/1X/4865a5ce75f86e593c23740a80215cfd047e3f2a.png)  
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

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

---

<div class="post-metadata">

**Author:** ![SMiLeY](https://cod4x.ovh/user_avatar/cod4x.ovh/smiley/32/2350_2.png) [@SMiLeY](https://cod4x.ovh/u/SMiLeY)\
**Post date:** [November 8, 2022, 9:52pm UTC](https://cod4x.ovh/t/round-based-level-showing-in-server-name/1116/17 "2022-11-08T21:52:19Z")

</div>

> [@JEENNN](#):
>
> ````auto
> addRoundsToHostname( currentRound, maxRounds ){
> setHostName( getOriginalHostname() + " " + level.hostnameSeperator + " Round: " + (currentRound+1) + "/" + maxRounds );
> }```
> 
> ````

Thx again JEENNN 🙂 Perfect…

---

<div class="post-metadata">

**Author:** ![Powerless](https://cod4x.ovh/user_avatar/cod4x.ovh/powerless/32/366_2.png) [@Powerless](https://cod4x.ovh/u/Powerless)\
**Post date:** [November 28, 2022, 12:23pm UTC](https://cod4x.ovh/t/round-based-level-showing-in-server-name/1116/18 "2022-11-28T12:23:21Z")

</div>

^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

---

<div class="post-metadata">

**Author:** ![SMiLeY](https://cod4x.ovh/user_avatar/cod4x.ovh/smiley/32/2350_2.png) [@SMiLeY](https://cod4x.ovh/u/SMiLeY)\
**Post date:** [November 30, 2022, 2:34pm UTC](https://cod4x.ovh/t/round-based-level-showing-in-server-name/1116/19 "2022-11-30T14:34:45Z")

</div>

Whats on line 1?

Send script

---

<div class="post-metadata">

**Author:** ![Powerless](https://cod4x.ovh/user_avatar/cod4x.ovh/powerless/32/366_2.png) [@Powerless](https://cod4x.ovh/u/Powerless)\
**Post date:** [February 18, 2023, 11:31am UTC](https://cod4x.ovh/t/round-based-level-showing-in-server-name/1116/20 "2023-02-18T11:31:29Z")

</div>

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

[Next page](https://cod4x.ovh/t/round-based-level-showing-in-server-name/1116.md?page=2)
