20.12.2016, 16:24
(
Последний раз редактировалось Logic_; 08.05.2017 в 19:33.
)
Hostname Changer
I made this script for fun when I was bored.
Features:
I made this script for fun when I was bored.
Features:
- Requires no or very basic scripting knowledge
- Very easy to write and read
- Never selects a previously selected hostname!
PHP код:
/*
Script Documentation
Script name: Hostname Changer
Script by: Logic_
Script made in: 5 minutes
Script indentation: perfect
Script tested: yes
*/
// Includes
#include <a_samp>
// Defines
#define FILTERSCRIPT // define if you want to use it as a FS
#define DEFAULT_TIME (5) // In seconds
// Arrays & Variables
new HOST[]=
{
{"Script by Logic_"}, // Message ID 0
{"Logic_"}, // Messaege ID 1
{"No restrictions!"}, // Message ID 2
{"Add as many names you want"} // Message ID 3
}, TimerCH, HostLast = -1;
// Forwards
forward ChangeHost();
// Callbacks
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
TimerCH = SetTimer("ChangeHost", DEFAULT_TIME * 1000, true);
return 1;
}
public OnFilterScriptExit()
{
KillTimer(TimerCH);
return 1;
}
#else
public OnGameModeInit()
{
TimerCH = SetTimer("ChangeHost", DEFAULT_TIME * 1000, true);
return 1;
}
public OnGameModeExit()
{
KillTimer(TimerCH);
return 1;
}
#endif
FetchHostID()
{
new ID = random(sizeof HOST);
return (ID == HostLast) ? FetchHostID() : ID;
}
public ChangeHost()
{
new ID = FetchHostID(), str[60] = "hostname ";
HostLast = ID;
strcat(str, HOST[ID][HOSTNAME]);
SendRconCommand(str);
return 1;
}