new TimerChange, ChangerWalk;
stock InformationChanger[][] =
{
{"WebHost1", "NameHost 1"}, {"WebHost2", "NameHost 2"},
{"WebHost3", "NameHost 3"}, {"WebHost4", "NameHost 4"}
};
forward ChangerHostname();
public ChangerHostname()
{
new string[50];
format(string, sizeof(string), "weburl %s", InformationChanger[ChangerWalk][0]);
SendRconCommand(string);
format(string, sizeof(string), "hostname %s", InformationChanger[ChangerWalk][1]);
SendRconCommand(string);
switch(ChangerWalk)
{
case 0, 1, 2: ChangerWalk++;
case 3: ChangerWalk = 0;
}
return 1;
}
public OnFilterScriptInit()
{
TimerChange = SetTimer("ChangerHostname", 5000, true);
return 1;
}
public OnFilterScriptExit()
{
KillTimer(TimerChange);
return 1;
}
Do not know, I think it's too much code for something so simple..
|
static const hostNames[][] = { "Hostname 1", "Hostname 2" // ...... }; public OnGameModeInit() { SetTimer("hostnameChange", 4000, 1); } forward hostnameChange(); public hostnameChange() { new string[128]; format(string, sizeof(string), "hostname %s", hostNames[random(sizeof(hostNames))]); SendRconCommand(string); return 1; }