[FilterScript] ruddeTR's Simple Hostname Changer System
#1

Sorry, my english is not very good so dont just pastebin will throw codes even ****** Translate this article I'm writing to try to understand the buzzwords and topics now

Pastebin Link:

Click Here
Reply
#2

Do not know, I think it's too much code for something so simple..

pawn Код:
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;
}
Reply
#3

Quote:
Originally Posted by Zume-Zero
Посмотреть сообщение
Do not know, I think it's too much code for something so simple..
More practical and efficient way can be arranged.

Код:
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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)