!!! Important !!! PtokaX not use in lua interface bool as true/false but for performance (and because lua do it internally in same way) it is nil for false and 1 (in some cases is possible as non-zero value) for true.

frmHub
------
RegBot(BotName)				- Chars $|<>:?*"/\ and space not allowed, max length 64 chars. Here hub not create myinfo, you need for compatibility with some clients (DC2) to send bot myinfo by script !
RegBot(BotName, bIsOP, Description, Email)	- Chars $|<>:?*"/\ and space not allowed in nick, $| not allowed in Description and Email, max length 64 chars per string. IsOP is number, 1 = have key, 0 = not have key. With this is created $MyINFO for bot !!! If you want $MyINFO without key/description/email use for example RegBot("botname", 0, "", "")
UnregBot(BotName)
GetUsersCount()				- Return hub user count, same value as Users: in gui.
GetHubName()
SetHubName(NewName)			- $ and | is not allowed ! Max lenght 256 chars.
GetHubDescr()
SetHubDescr(NewDescription)		- Max lenght 256 chars.
GetHubAddress()
GetHubIp()
GetHubPort()
GetHubUdpPort()
GetHubTopic()
SetHubTopic(NewTopic)			- Max lenght 256 chars.
GetRegServer()
SetRegServer(NewAddress)
GetAutoRegister()
SetAutoRegister(0/1)			- 0 disable 1 enable
GetMaxUsers()
SetMaxUsers(MaxUsers)			- number from 0 to 5000
GetMaxUsersLogins()
SetMaxUsersLogins(MaxUsersLogins)	- number from 0 to 500
GetMinShare()				- return minshare in Bytes
SetMinShare(MinShare, ShareUnit)	- ShareUnits 0 = B, 1 = kB, 2 = MB, 3 = GB, 4 = TB
GetMinSlots()
SetMinSlots(MinSlots)
GetMaxSlots()
SetMaxSlots(MaxSlots)
GetHubRatio()
GetSlotRatio()
SetHubSlotRatio(Hubs, Slots)
GetMaxHubs()
SetMaxHubs(MaxHubs)
GetCurrentShareAmount()
GetOnlineUsers(ProfileNumber)		- Without number return table with all logged user objects, with number only users with given profile.
GetOpChatName()
SetOpChatName(NewOpChatName)		- Max OpChat length is 64 chars !!!
GetOpChatDescription()
GetOpChatEmail()
SetOpChatData(NewOpChatName, NewDescription, NewEmail)	- Max length of string is 64 chars !!! In nick is not allowed $|<>:?*"/\ and space. In Description and Email is not allowed $ and |.
GetHubBotName()
SetHubBotName(NewHubBotName)		- Max Bot length is 64 chars !!!
GetHubBotDescription()
GetHubBotEmail()
SetHubBotData(NewHubBotName, NewDescription, NewEmail)	- Max length of string is 64 chars !!! In nick is not allowed $|<>:?*"/\ and space. In Description and Email is not allowed $ and |.
Restart()
GetOpChat()
SetOpChat(0/1)				- 0 disable 1 enable
GetHubBot()
SetHubBot(0/1)				- 0 disable 1 enable
GetPtokaXLocation()
GetRedirectAddress()
SetRedirectAddress(NewAddress)
GetShareRedirAddr()
SetShareRedirAddr(NewAddress)
GetShareRedirect()
SetShareRedirect(0/1)			- 0 disable 1 enable
GetSlotsRedirAddr()
SetSlotsRedirAddr(NewAddress)
GetSlotsRedirect()
SetSlotsRedirect(0/1)			- 0 disable 1 enable
GetRatioRedirAddr()
SetRatioRedirAddr(NewAddress)
GetRatioRedirect()
SetRatioRedirect(0/1)			- 0 disable 1 enable
GetMaxHubsRedirAddr()
SetMaxHubsRedirAddr(NewAddress)
GetMaxHubsRedirect()
SetMaxHubsRedirect(0/1)			- 0 disable 1 enable
GetNoTagRedirAddr()
SetNoTagRedirAddr(NewAddress)
GetNickRuleRedirAddr()
SetNickRuleRedirAddr(NewAddress)
GetNickRuleRedirect()
SetNickRuleRedirect(0/1)		- 0 disable 1 enable
GetTempBanRedirect()
SetTempBanRedirect(0/1)			- 0 disable 1 enable
GetTempBanRedirAddr()
SetTempBanRedirAddr(NewAddress)
GetBanRedirect()
SetBanRedirect(0/1)			- 0 disable 1 enable
GetBanRedirAddr()
SetBanRedirAddr(NewAddress)
GetRedirectAll()
SetRedirectAll(0/1)			- 0 disable 1 enable
GetRedirectFull()
SetRedirectFull(0/1)			- 0 disable 1 enable
GetNoTagOption()			- 1 accept 2 reject 3 redirect
SetNoTagOption(1/2/3)			- 1 accept 2 reject 3 redirect
GetRegOnlyRedirect()
SetRegOnlyRedirect(0/1)			- 0 disable 1 enable
GetRegOnlyRedirAddr()
SetRegOnlyRedirAddr(NewAddress)
GetHubBotIsAlias()
SetHubBotIsAlias(0/1)			- 0 disable 1 enable
GetHubSecAliasName()
GetUserPassword(Nick)			- Return user password, if is registered.
GetUpTime()				- Return hub uptime in seconds.
isNickRegged(Nick)			- Return 1 if user is registered, else nil.
GetActualUsersPeak()
GetMaxUsersPeak()
GetOnlineRegUsers()			- Return table with all logged and registered (profile > -1) user objects.
GetPrefixes()				- Return table with hub commands prefixes.
GetRegisteredUsers()			- Return table with all registered users as RegisteredUser objects.
GetTempBanList()			- Return table with TempBan objects.
GetPermBanList()			- Return table with PermBan objects.
GetOnlineOperators()			- Return table with all logged user objects with operator status.
GetOnlineNonOperators()			- Return table with all logged user objects without operator status.
GetOperators()				- Return table with all registered users with operator status as RegisteredUser objects.
GetNonOperators()			- Return table with all registered users without operator statusas RegisteredUser objects.
RestartScripts()			- Restart all scripts.
SetPrefixes(newprefixes)		- Set new hub commands prefixes, max 5 prefixes allowed !
SetChatTrace(0/1)			- Set CHAT checkbox in Users / Chat
SetCmdTrace(0/1)			- Set CMDs checkbox in Users / Chat
GetRegOnly()
SetRegOnly(0/1)
GetRegOnlyMess()
SetRegOnlyMess(message)
GetMaxShare()				- return maxshare in Bytes
SetMaxShare(MaxShare, ShareUnit)	- ShareUnits 0 = B, 1 = kB, 2 = MB, 3 = GB, 4 = TB
GetMinNickLen()
SetMinNickLen(number)
GetMaxNickLen()
SetMaxNickLen(number)
GetNickLenMess()
SetNickLenMess(message)			- Max lenght 256 chars.
GetNickLenRedir()
SetNickLenRedir(0/1)
GetNickLenRedirAddr()
SetNickLenRedirAddr(rediraddr)
GetTempRangeBans()			- Return table with TempRangeBan objects.
GetPermRangeBans()			- Return table with PermRangeBan objects.
GetMaxPsvSrchRpl()
SetMaxPsvSrchRpl(number)
GetBanMsgShowIP()
SetBanMsgShowIP(0/1)
GetBanMsgShowRange()
SetBanMsgShowRange(0/1)
GetBanMsgShowNick()
SetBanMsgShowNick(0/1)
GetBanMsgShowReason()
SetBanMsgShowReason(0/1)
GetBanMsgShowWho()
SetBanMsgShowWho(0/1)
GetBanMsgAddMsg()
SetBanMsgAddMsg(message)		- Max lenght 256 chars.
GetDefaultTempBanTime()
SetDefaultTempBanTime()
GetMOTD()
SetMOTD(string)
GetDisableMOTD()
SetDisableMOTD(0/1)
GetSendMOTDinPM()
SetSendMOTDinPM(0/1)
ClrRegBadPass(sNick)			- Clear advanced password protection bad password count.

deFlood
------
GetChat()				- Return defloodwithtime object.
SetChat(action, count, time)
GetSameChat()				- Return defloodwithtime object.
SetSameChat(action, count, time)
GetSameMultiChat()			- Return defloodwithlines object.
SetSameMultiChat(action, count, time)
GetMyINFO()				- Return defloodwithtime object.
SetMyINFO(action, count, time)
GetPM()					- Return defloodwithtime object.
SetPM(action, count, time)
GetSamePM()				- Return defloodwithtime object.
SetSamePM(action, count, time)
GetSameMultiPM()			- Return defloodwithlines object.
SetSameMultiPM(action, count, time)
GetNickList()				- Return defloodwithtime object.
SetNickList(action, count, time)
GetSearch()				- Return defloodwithtime object.
SetSearch(action, count, time)
GetSameSearch()				- Return defloodwithtime object.
SetSameSearch(action, count, time)
GetChatLen()
SetChatLen(count)
GetChatLines()
SetChatLines(count)
GetPMLen()
SetPMLen(count)
GetPMLines()
SetPMLines(count)
GetTempBan()
SetTempBan(time)
GetWarn()				- return warn object.
SetWarn(action, count)
GetReport()
SetReport(0/1)
GetGlobalChat()
SetGlobalChat(count, time, action, stoptime) - Return globaldeflood object.

Global
------
SendToAll(FromNick, Data)		- Data without ending | ! Max FromNick length 64 chars, max Data length 128000 chars.
SendToAll(Data)				- Data without ending | ! Max Data length 128000 chars.
SendPmToAll(FromNick, Data)		- Data without ending | ! Max FromNick length 64 chars, max Data length 128000 chars.
SendToNick(Nick, Data)			- Data without ending | ! Max Data length 128000 chars.
SendPmToNick(ToNick, FromNick, Data)	- Data without ending | ! Max FromNick length 64 chars, max Data length 128000 chars.
SendToOps(FromNick, Data)		- Data without ending | ! Max FromNick length 64 chars, max Data length 128000 chars.
SendToOps(Data)				- Data without ending | ! Max Data length 128000 chars.
SendPmToOps(FromNick, Data)		- Data without ending | ! Max FromNick length 64 chars, max Data length 128000 chars.
DisconnectByName(Nick)
GetItemByName(Nick)
GetBannedItemIp(Nick)
GetBannedItemName(IP)
Unban(Nick/IP)
TempUnban(Nick/IP)
ClearTempBan()
ClearPermBan()
AddRegUser(Nick, Pass, ProfileNumber)	- Default profile numbers 0 Master 1 Operator 2 VIP 3 Reg
ChangeRegUser(Nick, Pass, ProfileNumber)
DelRegUser(Nick)			- Return 1 success or -1 failed
Ban(IP)
Ban(IP, sReason, sBy, bFull)
NickBan(Nick)
NickBan(Nick, sReason, sBy)
TempBan(IP)
TempBan(IP, iTime, sReason, sBy, bFull)	- iTime is in minutes (0 = default tempban time from gui) !
TimeBan(IP, iTime)			- iTime is in minutes (0 = default tempban time from gui) !
NickTempBan(Nick, iTime, sReason, sBy)	- iTime is in minutes (0 = default tempban time from gui) !
GetTempBannedItemIp(Nick)
GetTempBannedItemName(IP)
GetTempBannedItemTime(IP)		- Return remaining temp ban time in seconds.
getHubVersion()				- Return appname and version like name, ver = getHubVersion() -> name = "PtokaX", ver = "0.3.3.1"
RangeUnban(FromIP, ToIP)		- Unban RangeBan.
RangePermUnban(FromIP, ToIP)		- Unban permanent RangeBan.
RangeTempUnban(FromIP, ToIP)		- Unban temporary RangeBan.
ClearRangeBans()
ClearRangeTempBans()
ClearRangePermBans()
RangeBan(FromIP, ToIP, sReason, sBy, bFull)
RangeTempBan(FromIP, ToIP, iTime, sReason, sBy, bFull)	- iTime is in minutes (0 = default tempban time from gui) !
SuspendAccepts(iTime)			- Stop listening sockets for given time in seconds.
SendToOpChat(sData)				- Send message to all users allowed for OpChat. OpChat must be enabled, max Data length 128000 chars. Data without ending | ! 

Profiles
-------
AddProfile(ProfileName, ProfileNumber)	- Return 1 success or -1 failed. Max ProfileName length 64 chars.
RemoveProfile(ProfileName)		- Return 1 success 0 failed (profile don't exist or default profile (0-3)) -1 failed (profile in use)
GetProfiles()				- Return table with profilenames ... table starting with 1 but real profile number is 0 !
GetProfileIdx(ProfileName)		- Return ProfileNumber or -1 failed
GetProfileName(ProfileNumber)		- Return ProfileName or nil for failed
GetUsersByProfile(ProfileName)		- Return table with user nicks of given profile name or nil for failed
GetUserProfile(Nick)			- Return user profile number if is registered, else nil.
GetProfilePermissions(ProfileNumber)	- Return profile permissions as permissions object.

Timer
-----
SetTimer(TimeInterval)
StartTimer()
StopTimer()
GetTimer()				- return timer state, 1 for enabled and nil for disabled.
GetTimerInterval()			- return timer interval.

User:
-----
SendData(FromNick, Data)		- Data without ending | ! Max FromNick length 64 chars, max Data length 128000 chars.
SendData(Data)				- Data without ending | ! Max Data length 128000 chars.
SendPM(FromNick, Data)			- Data without ending | ! Max FromNick length 64 chars, max Data length 128000 chars.
Disconnect()
Kick(KickerNick, Reason)		- Reason without ending | ! Max KickerNick length 64 chars, max Reason length 128000 chars.
Kick(Reason)				- Reason without ending | ! Max Reason length 128000 chars.
Ban()
Ban(sReason, sBy, bFull)
NickBan()
NickBan(sReason, sBy)
TempBan()
TempBan(iTime, sReason, sBy, bFull)	- iTime is in minutes (0 = default tempban time from gui) !
TimeBan(iTime)				- iTime is in minutes (0 = default tempban time from gui) !
NickTempBan(iTime, sReason, sBy)	- iTime is in minutes (0 = default tempban time from gui) !
Redirect(Address)			- Max Address length 1024 chars.
Redirect(Address, Reason)		- Max Address length 1024 chars. Max Reason length 128000 chars.

User.
-----
sName
sClient
sClientVersion
sMode
sIP
sMyInfoString
bUserCommand
bOperator
bRegistered
bHasTag
bActive
iShareSize
iProfile
iVersion				- return version from $Version nmdc command as string !
iHubs
iSlots
iBlimit
iLlimit
sTag
sDescription
sConnection
sEmail
iNormalHubs				- is nil if user don't have tag or have old-style (only H:x) tag.
iRegHubs				- is nil if user don't have tag or have old-style (only H:x) tag.
iOpHubs					- is nil if user don't have tag or have old-style (only H:x) tag.
bConnected				- User is added in hub (visible for other users) and added is after NewUser(Op)Connected.
iDefloodWarns
iMagicByte				- Number of ascii char after connection in myinfo.
bHasSuspiciousTag
iLoginTime				- Seconds from 1.1.1970

RegisteredUser.
-----
sNick
sPassword
iProfile

TempBan.
-----
sIP
sNick
iTime					- seconds !!!
sReason
sBy
bIpBan
bNickBan
bFullIpBan

PermBan.
-----
sIP
sNick
sReason
sBy
bIpBan
bNickBan
bFullIpBan

Defloodwithtime.
-----
iAction
iCount
iTime

Defloodwithlines.
-----
iAction
iCount
iLines

Warn.
-----
iAction
icount

Globaldeflood.
-----
iCount
iTime
iAction
iStopTime

ProfilePermissions.
-----
bIsOP						- User have key / is OP
bNoDefloodGetNickList				- No GetNickList Deflood
bNoDefloodNMyINFO				- No MyINFO Deflood
bNoDefloodSearch				- No Search Deflood
bNoDefloodPM					- No PM Deflood
bNoDefloodMainChat				- No Main Chat Deflood
bMassMsg					- Mass Message
bTopic						- Topic
bTempBan					- TempBan
bTempUnban					- TempUnban
bRefreshTxt					- Reload text files
bNoTagCheck					- No Tag check
bDelRegUser					- DelRegUser
bAddRegUser					- AddRegUser
bNoChatLimits					- No ChatLimits
bNoMaxHubCheck					- No MaxHubs Check
bNoSlotHubRatio					- No Slot/Hub Check
bNoSlotCheck					- No SlotCheck
bNoShareLimit					- No ShareLimit
bClrPermBan					- Clear PermBan
bClrTempBan					- Clear TempBan
bGetInfo					- GetInfo
bGetBans					- Get Bans
bRestartScripts					- Start/Stop/Restart script(s)
bRestartHub					- Restart hub
bTempOP						- TempOP
bGag						- Gag, Ungag
bRedirect					- Redirect
bBan						- Ban
bUnban						- Unban
bKick						- Kick
bDrop						- Drop
bEnterFullHub					- Enter full hub
bEnterIfIPBan					- Enter hub if IP banned
bAllowedOPChat					- Allowed for OpChat
bSendFullMyinfos				- Send full myinfos
bSendAllUserIP					- Send all users IP
bRangeBan					- Range ban
bRangeUnban					- Range unban
bRangeTempBan					- Range temp ban
bRangeTempUnban					- Range temp unban
bGetRangeBans					- Get range perm bans
bClearRangePermBans				- Clear range perm bans
bClearRangeTempBans				- Clear range temp bans
bNoIpCheck					- No IP checking in connection and search request.
bClose						- Close

RangeTempBan.
-----
sIPFrom
sIPTo
iTime					- seconds !!!
sReason
sBy
bFullIpBan

RangePermBan.
-----
sIPFrom
sIPTo
sReason
sBy
bFullIpBan

Functions
---------
Main()
OnExit()
OnTimer()
NewUserConnected(User)
UserDisconnected(User)
OpConnected(User)
OpDisconnected(User)
OnError(ErrorMsg)
SupportsArrival(User, Data)			- Incoming supports from user.
ChatArrival(User, Data)				- Incoming chat message from user. If script return 1 hub don't process data.
KeyArrival(User, Data)				- Incoming key from user.
ValidateNickArrival(User, Data)			- Incoming validate nick from user.
PasswordArrival(User, Data)			- Incoming password from user.
VersionArrival(User, Data)			- Incoming version from user.
GetNickListArrival(User, Data)			- Incoming get nick list request from user.
MyINFOArrival(User, Data)			- Incoming user myinfo.
GetINFOArrival(User, Data)			- Incoming get info request from user.
SearchArrival(User, Data)			- Incoming search request from user. If script return 1 hub don't process data.
ToArrival(User, Data)				- Incoming private message from user. If script return 1 hub don't process data.
ConnectToMeArrival(User, Data)			- Incoming active connection request from user. If script return 1 hub don't process data.
MultiConnectToMeArrival(User, Data)		- Incoming multi connection request from user. If script return 1 hub don't process data.
RevConnectToMeArrival(User, Data)		- Incoming pasive connection request from user. If script return 1 hub don't process data.
SRArrival(User, Data)				- Incoming search reply from user. If script return 1 hub don't process data.
UDPSRArrival(User, Data)			- Incoming search reply from user. If script return 1 hub don't process data.
KickArrival(User, Data)				- Incoming kick command from user. If script return 1 hub don't process data.
OpForceMoveArrival(User, Data)			- Incoming redirect command from user. If script return 1 hub don't process data.
UnknownArrival(User, Data)			- Incoming unknown command from user. If script return 1 hub don't process data (don't disconnect user).
BotINFOArrival(User, Data)			- Incoming hublist pinger request from user. If script return 1 hub don't process data.
CloseArrival(User, Data)			- Incoming close command from user. If script return 1 hub don't process data.