Auto changing host name? - 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)
+--- Thread: Auto changing host name? (
/showthread.php?tid=499883)
Auto changing host name? -
ChristianIvann09 - 10.03.2014
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?
Re: Auto changing host name? -
SaltySandy - 10.03.2014
Do it scriptwise. Set a timer after which the script changes the hostname.
Re: Auto changing host name? -
amirab - 10.03.2014
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;
}
Re: Auto changing host name? - Emmet_ - 10.03.2014
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);
}
Re: Auto changing host name? -
ChristianIvann09 - 10.03.2014
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!!