SA-MP Forums Archive
Changing gamemode name after few seconds? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Changing gamemode name after few seconds? (/showthread.php?tid=115379)



Changing gamemode name after few seconds? - Rickzor14 - 23.12.2009

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?


Re: Changing gamemode name after few seconds? - Virtual1ty - 23.12.2009

search for a 'Advanced mapname and hostname changer'


Re: Changing gamemode name after few seconds? - Niixie - 23.12.2009

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


Re: Changing gamemode name after few seconds? - Abernethy - 23.12.2009

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"");
    }
}



Re: Changing gamemode name after few seconds? - member - 23.12.2009

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!");
   }
}



Re: Changing gamemode name after few seconds? - Abernethy - 23.12.2009

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.