Changing gamemode name after few seconds?
#1

Hello,

I've saw a couple of servers with their gamemode name get changed after a few seconds.

I wonder how they do this

Anyone can tell me?
Reply
#2

search for a 'Advanced mapname and hostname changer'
Reply
#3

A Timer.

Set a timer, and when that timer runs out it changes servername and then a new timer starts. then goes in a circle
Reply
#4

Untested.
pawn Код:
#define NAME1 "Abernethy ftw" // Change this to the first name
#define NAME2 "Abernethy for t3h win" // Change this to the second name
#define TIME 5*1000 // 5 Seconds

new bool:Name;

forward ToggleServerName();

public OnGameModeInIt()
{
    SetTimer("ToggleServerName", true, TIME);
    return true;
}

public ToggleServerName()
{
    if (Name == false)
    {
        SendRconCommand("hostname "#NAME1"");
        Name = true;
    }
    else if (Name == true)
    {
      SendRconCommand("hostname "#NAME2"");
    }
}
Reply
#5

There is a more easier way of doing it. This was already posted a long time ago, which i also use on my server. Anyways here it is:
pawn Код:
forward ChangeHostname(); // at the top

public OnGameModeInit()
{
    SetTimer("ChangeHostname",2000,1); // every 2 seconds
}

public ChangeHostname()
{
   new var = random(3);
   switch (var)
   {
     case 0: SendRconCommand("hostname Gamemode Text 1");
     case 1: SendRconCommand("hostname I Fail");
     case 2: SendRconCommand("hostname Hello there!");
   }
}
Reply
#6

Quote:
Originally Posted by [B2K
Hustler ]
There is a more easier way of doing it. This was already posted a long time ago, which i also use on my server. Anyways here it is:
pawn Код:
forward ChangeHostname(); // at the top

public OnGameModeInit()
{
    SetTimer("ChangeHostname",2000,1); // every 2 seconds
}

public ChangeHostname()
{
   new var = random(3);
   switch (var)
   {
     case 0: SendRconCommand("hostname Gamemode Text 1");
     case 1: SendRconCommand("hostname I Fail");
     case 2: SendRconCommand("hostname Hello there!");
   }
}
Yeah that way would be better. My bad.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)