Auto changing host name?
#1

how to set this

evey 5 seconds the host name will change and come back again

for example: American Streets Roleplay[All Bugs Fixed]
after 5 seconds
American Streets Roleplay[All Accounts Reseted]
after 5 seconds
American Streets Roleplay[All Bugs Fixed]

and it will loop.

how?
Reply
#2

Do it scriptwise. Set a timer after which the script changes the hostname.
Reply
#3

At the top of your script :
PHP код:
new namechanged 0;
forward ChangingName(); 
in OnGameModeInit :
PHP код:
SetTimer("ChangingName" 5000 1); 
any where you want :

PHP код:
public ChangingName()
{
  if(
namechanged == 1)
  {
      
SendRconCommand("hostname your first server name"); // like "hostname American Streets Roleplay[All Bugs Fixed]"
      
namechanged 0;
  }
  if(
namechanged == 0)
  {
      
SendRconCommand("hostname your second server name"); // like "hostname American Streets Roleplay[All Accounts Reseted]"
      
namechanged 1;
  }
  return 
1;

Reply
#4

The best way is to do this:

pawn Код:
static const g_aServerNames[][64] = {
    {"American Streets Roleplay[All Bugs Fixed]"},
    {"American Streets Roleplay[All Accounts Reseted]"}
};

public OnGameModeInit()
{
    SetTimer("OnHostnameChange", 5000, true);
}

forward OnHostnameChange();
public OnHostnameChange()
{
    static
        index,
        str[64];

    if (index == sizeof(g_aServerNames) - 1)
        index = 0;

    format(str, sizeof(str), "hostname %s", g_aServerNames[index++]);
    SendRconCommand(str);
}
Reply
#5

Quote:
Originally Posted by Emmet_
Посмотреть сообщение
The best way is to do this:

pawn Код:
static const g_aServerNames[][64] = {
    {"American Streets Roleplay[All Bugs Fixed]"},
    {"American Streets Roleplay[All Accounts Reseted]"}
};

public OnGameModeInit()
{
    SetTimer("OnHostnameChange", 5000, true);
}

forward OnHostnameChange();
public OnHostnameChange()
{
    static
        index,
        str[64];

    if (index == sizeof(g_aServerNames) - 1)
        index = 0;

    format(str, sizeof(str), "hostname %s", g_aServerNames[index++]);
    SendRconCommand(str);
}
THAANK YOUU!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)