Auto change HostName
#1

I have seen some server, it changes the HostName each 5seg, how can I do this for my server?
Reply
#2

SendRconCommand("hostname ChangeThis");

Totally untested btw, not sure if it will even work.
Reply
#3

Tez just go and play Roller Coaster Tycoon, you obviously suck at SA-MP.

You can use this as a filterscript if you want, else just change things around for it to be in gamemode format:

pawn Code:
// above main()
forward ChangeHostname();

public OnFilterScriptInit()
{
   SetTimer("ChangeHostname",1000,1); // Change the, 1000 to whatever you want, in milliseconds ofc.
   return 1;
}

public ChangeHostname()
{
   new var = random(3);
   switch (var)
   {
     case 0: SendRconCommand("hostname My server name 1");
     case 1: SendRconCommand("hostname Server name 2");
     case 2: SendRconCommand("hostname Name 3 here");
   }
}
Reply
#4

Quote:
Originally Posted by •Lj•
Tez just go and play Roller Coaster Tycoon, you obviously suck at SA-MP.

You can use this as a filterscript if you want, else just change things around for it to be in gamemode format:

pawn Code:
// above main()
forward ChangeHostname();

public OnFilterScriptInit()
{
  SetTimer("ChangeHostname",1000,1); // Change the, 1000 to whatever you want, in milliseconds ofc.
  return 1;
}

public ChangeHostname()
{
  new var = random(3);
  switch (var)
  {
    case 0: SendRconCommand("hostname My server name 1");
    case 1: SendRconCommand("hostname Server name 2");
    case 2: SendRconCommand("hostname Name 3 here");
  }
}
It gives me a mistake to form the filterscript, I can spend longer in .pwn?
Reply
#5

Can you show me what it says?
Reply
#6

Quote:
Originally Posted by •Lj•
Tez just go and play Roller Coaster Tycoon, you obviously suck at SA-MP.

You can use this as a filterscript if you want, else just change things around for it to be in gamemode format:

pawn Code:
// above main()
forward ChangeHostname();

public OnFilterScriptInit()
{
  SetTimer("ChangeHostname",1000,1); // Change the, 1000 to whatever you want, in milliseconds ofc.
  return 1;
}

public ChangeHostname()
{
  new var = random(3);
  switch (var)
  {
    case 0: SendRconCommand("hostname My server name 1");
    case 1: SendRconCommand("hostname Server name 2");
    case 2: SendRconCommand("hostname Name 3 here");
  }
}
That's what I did but 10times as complicated!
Reply
#7

Nice it work's
Reply
#8

Quote:
Originally Posted by Tez2k7
View Post
That's what I did but 10times as complicated!
You obviously haven't realized that your code will set the hostname once, and only a static hostname.

What he does will set the hostname to various names, and repeat it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)