How to make Moving Host Name?
#1

I have seen servers like GamerX server the host name change after 5 min to "GamerX [Euro] 0.3 Visit www.sa-mp.com" and sometimes "GamerX [Euro] 0.3 Fun Fun Fun"

How i can make like this with this: SendRconCommand("hostname [0.3] blabla Fun Fun Fun");

Any ideas guys?
Reply
#2

Use SendRconCommand function in a timer.
Reply
#3

Like this??:
Not Tested i am still learning Pawno
pawn Code:
forward HostName();
SetTimer("HostName",100000,true);
new HostName;
public HostName()
{
    switch (HostName)
    {
      case 0: {SendRconCommand("hostname [0.3] blabla Fun Fun Fun");} // first message
      case 1: {SendRconCommand("hostname [0.3] blabla Stunting Server!");}
      case 2: {SendRconCommand("hostname [0.3] blabla Free Roam Also :P");}
    }
    return 1;
}
Reply
#4

You can't have the variable with the same name as the function (HostName) and you don't need those brackets at the switch cases.
Use a random function.
Reply
#5

Oh i just remove (HostName) and new HostName;
Please give me the correct code So i can understand it
Reply
#6

pawn Code:
forward myTimer();

// under OnGameModeInit/OnFilterScriptInit-callback.
SetTimer("myTimer", 100000, true); // repeating every 100 seconds.

public myTimer()
{
  new
      myMsg = random(3);
  switch(myMsg)
  {
    case 0: SendRconCommand("hostname message 1");
    case 1: SendRconCommand("hostname message 2");
    case 2: SendRconCommand("hostname message 3");
  }
  return true;
}
Reply
#7

Thanks
Reply
#8

You're welcome.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)