Recent posts - Page 6
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Recent posts

#51
Conversion Requests / Re: Regme Px
Last post by Massi - 30 June, 2021, 13:41:54
Take a look here  ;)

https://script-bot.dcstuff.nl/index.php?dir=PtokaX/lua-5-api-2/

Thanks for your support and assistance ;)

Best Regards,
Massimiliano
#52
Finished Scripts / GateKeeper
Last post by Cêñoßy†ê - 30 June, 2021, 10:41:50
GateKeeper written by Cêñoßy†ê
	
	This script includes:
		- Detection of faking users
			- Has on/off option command
			- Detect fake sharesizes (add/delete/show commands)
			- Detect fake files (add/delete/show commands)
		- Detection of forbidden files
			- Has on/off option commands
			- Add/delete/show commands
		- Detection of kademlia enabled clients
			- Has on/off option commands
			- Add/delete/show commands
		- Detection of empty 0b files
			- Has on/off option commands
			- Add/delete/show commands
		- Has allso ignored data database with add/delete/show commands
		- Option to change hubs UDP port
		- Option to set up alternative hub IP
		- Detection logging for 'data' to easyer check what detected when/how many times
		- Report/kick mode for detections (report sends info to op-chat if op-chat enabled,else it sends info to main chat for operators)
		- Adjustable command permissions
			Ptokax default profiles:
				-1 unregistered users
				0  master
				1  operator
				2  vip
				3  reg
	
	Tested on:
		Windows 8.1 ULTIMATE x64 PtokaX 0.5.2.2 556 Lua 5.3
		Windows 10 PRO x64 PtokaX 0.5.2.2 556 Lua 5.3
		Debian 9.0 x64 PtokaX 0.5.2.2 556 Lua 5.3
#53
Conversion Requests / Re: Command Px
Last post by Cêñoßy†ê - 29 June, 2021, 16:08:39
--[[

	PxCommands 1.1g Lite Ed. LUA 5.1 [Strict] [API 2]

	By Mutor	03/07/06
	
	40% less calories than the standard edition :P
	
	-Sends inbuilt PtokaX user commands (per profile permissions)
	-Allows for default custom / commands
	-Allows for raw commands for ops

	+Changes from 1.1 Standard Edition	08/08/07
		-Removed LUA version checking, converted for LUA 5.1 only.
		-Removed PxUtilities dependency and associated functions.
		+Profile commands sent in specific [editable] order.
		+Added profiles 4 - 6 for use with AIO scripts
		~Changed timer function, garbage collection.
		~Changed status message format and method
		~Moved config table to a local variable.
	
	+Changes from 1.1 Lite Ed. 	08/08/07
		-Removed Bot registration & related info.
		-Removed most anything not required for basic function
		+All commands written to external files, one per profile.
		+File read and sent to user at connect
		+Command functions Default, Raw & Prof nil after 1st run
		+This method offers a savings of ~20Kb memory usage

	+Changes from 1.1b Lite Ed.. 	09/14/07
		~Rewritten for the new PtokaX API [0.3.06d +]

	+Changes from 1.1c Lite Ed.. 	11/17/07
		-Removed Core.GetUserAllData in UserConnected, no longer req'd.
		+Added user message to data string

		*Optimizations suggestions by PPK:
		~Changed SendToNick to SendToUser, all data sent together

	+Changes from 1.1d Lite Ed.. 	04/26/08
		+Added custom user commands.


	+Changes from 1.1f Lite Ed.. 	01/11/09
		~Update for profile permission changes in PxLua API [version 0.4.1.2 and later]

	+Changes from 1.1f Lite Ed.. 	02/13/10
		~Changed Custom Commands, Custom Level to full profile table, per command. requested by JiMMy

]]--


local CmdCfg = {
--Command Menu Name ["" = Hub Name]
Menu = "",
--Bot Name ["" = Hub Bot]
Bot = "",
-- Clear the Hub/User menu first, before new commands set is sent at login?  true/false
-- Avoids duplicate menus. ***If enabled, load this script before other command scripts
ClearMenu = true,
--Send raw commands to operators? true/false
SendRaw = true,
}
-- Add your own custom commands
-- Set first value as table of profiles, second as typical User Command, ending in ||
CustomCmds = {
	--{{[-1]=false,[0]=true,[1]=true,[2]=true,[3]=true},"$UserCommand 1 1 Menu\\SubMenu\\Command Description$<%[mynick]> +command %[line:arg]&#124;|"}
	{{[-1]=true,[0]=true,[1]=true,[2]=true,[3]=true},"$UserCommand 1 3 Menu\\SubMenu\\Common Knowledge$<%[mynick]> Mutor is dead sexy!&#124;|"},
}

OnStartup = function()
	Set=function(a,v,h)--(arg,val,hub)
		if a == "" then if h then return SetMan.GetString(v) else return v end else return a end
	end
	CmdCfg.Bot = Set(CmdCfg.Bot,21,true) CmdCfg.Menu = Set(CmdCfg.Menu,0,true)
	CmdCfg.Path = Core.GetPtokaXPath().."scripts/"
	local t,x = ProfMan.GetProfiles(),DefaultCmds(-1)
	for i,v in ipairs(t) do
		local p = i-1
		local Commands = DefaultCmds(p)
		if CmdCfg.SendRaw and ProfMan.GetProfile(p).tProfilePermissions.bIsOP then
			local Raw = RawCmds(p)
			if Raw then Commands = Commands..Raw end
		end
		Commands = Commands..ProfCmds(p)
		local f,e = io.open(CmdCfg.Path..p..".uc","wb")
		f:write("return "..string.format("%q",Commands)) f:flush() f:close()
	end
	local f,e = io.open(CmdCfg.Path.."-1.uc","wb")
	f:write("return "..string.format("%q",x)) f:flush() f:close()
	DefaultCmds,RawCmds,ProfCmds = nil,nil,nil
end

UserConnected = function(user)
	if loadfile(CmdCfg.Path..tostring(user.iProfile)..".uc") then
		local x,count = dofile(CmdCfg.Path..tostring(user.iProfile)..".uc")
		if x then _,count = x:gsub("&#124;|","%1") end
		if x then _,count = x:gsub("UserCommand","%1") end
		if count and count > 0 then
			if CmdCfg.ClearMenu then x = "$UserCommand 255 3 "..CmdCfg.Menu.."&#124;|"..x end
			local HubApp,HubVer,Prof = "PtokaX", Core.Version,"Unregistered User"
			if user.iProfile ~= -1 then Prof = ProfMan.GetProfile(user.iProfile).sProfileName end
			x = x.."<"..CmdCfg.Bot.."> Welcome "..user.sNick..", [ "..
			tostring(count).." ] "..Prof.."'s "..HubApp.." "..HubVer.." commands enabled. Right "..
			"click hub tab or user list for menu.|"
			for i,v in ipairs(CustomCmds) do
				if v[1][user.iProfile] then x = x..v[2] end
			end
			Core.SendToUser(user,x)
		end
	end
end
RegConnected,OpConnected = UserConnected,UserConnected

DefaultCmds = function(idx)
	local str,pfx,menu = "",SetMan.GetString(29):sub(1,1) or "+",CmdCfg.Menu
	--//-- Add your custom/default commands here
	--//-- 	Index = {
	--//--	  [0] = {[-1]=1,[0]=1,[1]=1,[2]=1,[3]=1},
	--//--		[#] = {"command", "args", "Command Description", "Submenu", *Context},
	--//--	  },
	--//--
	--//-- Key [0] contains idx profiles, use =1 to enable that profile, =0 to disable
	--//-- *Context
	--//-- 1=Hub Menu 2=User Menu 3=Hub/User Menu 4 = File[Search] 5 = Hub/File 6 = User/File 7 = Hub/User/File
	local Default = {
	[1] = {
		[0] = {[-1]=true,[0]=true,[1]=true,[2]=true,[3]=1},
		[1] = {"help", "", "Get Command Help", "General",3,},
		},
	[2] = {
		[0] = {[-1]=false,[0]=true,[1]=true,[2]=true,[3]=true,},
		[1] = {"passwd", " %[line:New Password]", "Change Your Password", "General",3},
		},
	[3] = {
		[0] = {[-1]=true,[0]=true,[1]=true,[2]=true,[3]=true,},
		[1] = {"myip", "", "Display Your IP Address", "General",3},
		},
	[4] = {
		[0] = {[-1]=false,[0]=true,[1]=true,[2]=true,[3]=true,},
		[1] = {"me", " %[line:Say What?]", "Speak In The Third Person", "General",3},
		},
	[5] = {
		[0] = {[-1]=true,[0]=true,[1]=true,[2]=true,[3]=true,},
		[1] = {"stats", "", "Get Hub Statistics", "General",3},
		},
	[6] = {
		[0] = {[-1]=true,[0]=true,[1]=true,[2]=true,[3]=true,},
		[1] = {"memstats", "", "Get Hub Memory Statistics", "General",3},
		},
	}
	for i,v in ipairs(Default) do
		if v[0][idx]then
			for a,b in ipairs(v) do
				if a > 0 then
					str = str.."$UserCommand 1 "..b[5].." "..menu.."\\"..b[4].."\\"..
					b[3].." $<%[mynick]> "..pfx..b[1]..b[2].."&#124;|"
				end
			end
		end
	end
	return str
end

--There is not a whole lot of need for this but I was bored
--Note: Badly formed raw commands will disconnect you from hub
--These commands offered as examples, check your hub settings before use
RawCmds = function(idx)
	local str,menu,rda,srda = "",CmdCfg.Menu,
	SetMan.GetString(6) or " %[line:Redirect To? (Address:Port)]",
	SetMan.GetString(12) or " %[line:Redirect Bad Share To? (Address:Port)]"
	local RawCommands = {
	[1] = {
		[1] = {"$$To:"," %[nick] From: %[mynick] $<%[mynick]> %[line:Message (Select Nicks First)]",
		"Selective Private Message","Messages",2},
		},
	[2] = {
		[1] = {"$$OpForceMove", " $Who:%[line:Victim Nick]$Where:"..rda..
		"$Msg:%[line:Reason]", "Redirect To Default", "User Admin",1},
		[2] = {"$$OpForceMove", " $Who:%[nick]$Where:"..rda..
		"$Msg:%[line:Reason]", "Redirect To Default", "User Admin",2},
		[3] = {"$$OpForceMove", " $Who:%[line:Victim Nick]$Where:"..srda..
		"$Msg:%[line:Reason]", "Redirect Bad Share", "User Admin",1},
		[4] = {"$$OpForceMove", " $Who:%[nick]$Where:"..srda..
		"$Msg:%[line:Reason]", "Redirect Bad Share", "User Admin",2},
		},
	[3] = {
		[1] = {"$$Quit"," %[mynick]","Disconnect From Hub","Hub Admin",2},
		},
	[4] = {
		[1] = {"$$Close"," %[line:Close Who?]","Close User","User Admin",1},
		[2] = {"$$Close"," %[nick]","Close User","User Admin",2},
		},
	[5] = {
		[1] = {"$$To:"," %[line:Nick] From: %[mynick] $<%[mynick]> You are being kicked.&#124;&#124;<%[mynick]> is kicking %[line:Nick]&#124;&#124;$Kick %[line:Nick]","Kick User","Raw Cmds",1},
		[2] = {"$$To:"," %[nick] From: %[mynick] $<%[mynick]> You are being kicked.&#124;&#124;<%[mynick]> is kicking %[nick]&#124;&#124;$Kick %[nick]","Kick User","Raw Cmds",2},
		},
	}
	for i,v in ipairs(RawCommands) do
		for a,b in ipairs(v) do
			str = str.."$UserCommand 1 "..b[5].." "..menu.."\\"..
			b[4].."\\"..b[3]..b[1]..b[2].."&#124;|"
		end
	end
	return str
end

ProfCmds = function(idx)
	local str,pfx,menu,perms = "",SetMan.GetString(29):sub(1,1) or "+",CmdCfg.Menu,ProfMan.GetProfile(idx).tProfilePermissions
	--Format change here, don't edit the first [1] key/value pair of each command or script will fail
	-- You may however, edit entries after [1] if you'd like
	local Commands = {
	[1] = {
		[1] = {bTempUnban = 0},
		[2] = {"tempunban", " %[line:Nick Or IP To unban]", "Temp Unban Nick/IP", "Ban Admin",3},
		},
	[2] = {
		[1] = {bGetInfo = 0},
		[2] = {"getinfo", " %[nick]", "Get User Info", "User Info",2},
		},
	[3] = {
		[1] = {bGag = 0},
		[2] = {"gag", " %[line:Nick To Gag]", "The User Can't Post To Mainchat Anymore", "User Admin",1},
		[3] = {"gag", " %[nick]", "The User Can't Post To Mainchat Anymore", "User Admin",2},
		[4] = {"ungag", " %[line:Nick To Ungag]", "The User Can Post To Mainchat Again", "User Admin",1},
		[5] = {"ungag", " %[nick]", "The User Can Post To Mainchat Again", "User Admin",2}
		},
	[4] = {
		[1] = {bGetBans = 0},
		[2] = {"getbans", "", "Display Bans", "Ban Admin",3},
		[3] = {"getpermbans", "", "Display Permanent Bans", "Ban Admin",3},
		[4] = {"gettempbans", "", "Display Temporary Bans", "Ban Admin",3},
		[5] = {"checknickban", " %[line:Check This Nick]", "Check Nick For Ban", "Ban Admin",3},
		[6] = {"checkipban", " %[line:Check This IP]", "Check IP For Ban", "Ban Admin",3},
		},
	[5] = {
		[1] = {bMassMsg = 0},
		[2] = {"massmsg", " %[line:Mass Message For Users]", "Send A Private Message To All Users", "Messages",3},
		[3] = {"opmassmsg", " %[line:Mass Message For Ops]", "Send A Private Message To All Ops", "Messages",3},
		},
	[6] = {
		[1] = {bClearRangeTempBans = 0},
		[2] = {"clrrangetempbans", "", "Clear Temporary Range Bans", "Range Ban Admin",3},
		},
	[7] = {
		[1] = {bRangeUnban = 0},
		[2] = {"rangeunban", " %[line:Start Of IP Range] %[line:End Of IP Range]", "Unban An IP Range", "Range Ban Admin",3},
		},
	[8] = {
		[1] = {bTopic = 0},
		[2] = {"topic", " %[line:Topic (off = Clear Topic)]", "Set/Change/Clear Hub Topic", "Hub Admin",3},
		},
	[9] = {--m=Mins, h=Hours, d=Days, w=Weeks, M=Months, Y=Years.
		[1] = {bTempBan = 0},
		[2] = {"tempban", " %[nick] %[line:Time To Ban] %[line:Reason For Ban]", "Temp Ban User", "Ban Admin",2},
		[3] = {"nicktempban", " %[nick] %[line:Time To Ban] %[line:Reason For Ban]", "Temp Ban Nick", "Ban Admin",2},
		[4] = {"tempbanip", " %[ip] %[line:Time To Ban] %[line:Reason For Ban]", "Temp Ban IP", "Ban Admin",2},
		[5] = {"fulltempban", " %[nick] %[line:Time To Ban] %[line:Reason For Ban]", "Full Temp Ban Nick", "Ban Admin",2},
		[6] = {"fulltempbanip", " %[ip] %[line:Time To Ban] %[line:Reason For Ban]", "Full Temp Ban IP", "Ban Admin",2},
		},
	[10] = {
		[1] = {bKick = 0},
		[2] = {"$$Kick", " %[line:Nick To Kick]", "Kick User", "User Admin",1},
		[3] = {"$$Kick", " %[nick]", "Kick User", "User Admin",2},
		},
	[11] = {
		[1] = {bRestartScripts = 0},
		[2] = {"getscripts", "", "Display Current Script & Status", "Hub Admin",3},
		[3] = {"restartscripts", "", "Restart All Scripts", "Hub Admin",3},
		[4] = {"startscript", " %[line:Script Filename]", "Start Specified Script", "Hub Admin",3},
		[5] = {"stopscript", " %[line:Script Filename]", "Stop Specified Script", "Hub Admin",3},
		[6] = {"restartscript", " %[line:Script Filename]", "Restart Specified Script", "Hub Admin",3},
		},
	[12] = {
		[1] = {bRangeTempBan = 0},
		[2] = {"rangetempban", " %[line:Start Of IP Range] %[line:End Of IP Range] %[line:Time For Ban] %[line:Reason For Ban]", "Temporary Ban An IP Range", "Range Ban Admin",3},
		[3] = {"fullrangetempban", " %[line:Start Of IP Range] %[line:End Of IP Range] %[line:Time For Ban] %[line:Reason For Ban]", "Full Temporary Ban An IP Range", "Range Ban Admin",3},
		},
	[13] = {
		[1] = {bTempOP = 0},
		[2] = {"op", " %[line:Nick]", "Grant Temporary Op Status To User For One Session", "Registration",1},
		[3] = {"op", " %[nick]", "Give Temporary Op Status To User For One Session", "Registration",2},
		},
	[14] = {
		[1] = {bAddRegUser = 0},
		[2] = {"addreguser", " %[line: Nick To Register] %[line:Password For Nick] %[line:Profile (Reg/VIP/Operator/Master)]", "Register A User", "Registration",1},
		[3] = {"addreguser", " %[nick] %[line:Password For Nick] %[line:Profile (Reg/VIP/Operator/Master)]", "Register A User", "Registration",2},
		},
	[15] = {
		[1] = {bUnban = 0},
		[2] = {"unban", " %[line:Nick or IP to Unban]", "Unban Nick/IP", "Ban Admin",3},
		[3] = {"permunban", " %[line:Nick or IP to Unban]", "Perm Unban Nick/IP", "Ban Admin",3},
		},
	[16] = {
		[1] = {bClrPermBan = 0},
		[2] = {"clrpermbans", "", "Clear Permanent Bans", "Ban Admin",3},
		},
	[17] = {
		[1] = {bRangeTempUnban = 0},
		[2] = {"rangetempunban", " %[line:Start Of IP Range] %[line:End Of IP Range] %[line:Time For Ban] %[line:Reason For Ban]", "Unban Temporary IP Range Ban", "Range Ban Admin",3},
		},
	[18] = {
		[1] = {bDelRegUser = 0},
		[2] = {"delreguser", " %[line:Nick To Delete]", "Delete A User From Registry", "Registration",1},
		[3] = {"delreguser", " %[nick]", "Delete A User From Registry", "Registration",2},
		},
	[19] = {
		[1] = {bClearRangePermBans = 0},
		[2] = {"clrrangepermbans", "", "Clear Permanent Range Bans", "Range Ban Admin",3},
		},
	[20] = {
		[1] = {bRefreshTxt = 0},
		[2] = {"reloadtxt", "", "Reload Textfiles", "Hub Admin",3},
		},
	[21] = {
		[1] = {bRangeBan = 0},
		[2] = {"rangeban", " %[line:Start Of IP Range] %[line:End Of IP Range] %[line:Reason For Ban]", "Permanently Ban An IP Range", "Range Ban Admin",3},
		[3] = {"fullrangeban", " %[line:Start Of IP Range] %[line:End Of IP Range] %[line:Reason For Ban]", "Permanently Ban An IP Range", "Range Ban Admin",3},
		},
	[22] = {
		[1] = {bGetRangeBans = 0},
		[2] = {"getrangebans", "", "Display Banned IP Ranges", "Range Ban Admin",3},
		[3] = {"getrangepermbans", "", "Display Permanently Banned IP Ranges", "Range Ban Admin",3},
		[4] = {"getrangetempbans", "", "Display Temporarily Banned IP Ranges", "Range Ban Admin",3},
		[5] = {"checkrangeban", " %[line:Start Of IP Range] %[line:End Of IP Range]", "Check Bans For This IP Range", "Range Ban Admin",3},
		},
	[23] = {
		[1] = {bDrop = 0},
		[2] = {"drop", " %[line:Nick To Drop] %[line:Reason For Drop]", "Silent Kick With Tempban", "User Admin",1},
		[3] = {"drop", " %[nick] %[line:Reason For Drop]", "Silent Kick With Tempban", "User Admin",2},
		},
	[24] = {
		[1] = {bBan = 0},
		[2] = {"ban", " %[nick] %[line:Reason For Ban]", "Ban By Nickname", "User Admin",1},
		[3] = {"ban", " %[line:Nick To Ban] %[line:Reason For Ban]", "Ban By Nickname", "User Admin",2},
		[4] = {"nickban", " %[line:Nick To Ban] %[line:Reason For Ban]", "Ban Nickname", "User Admin",1},
		[5] = {"nickban", " %[nick] %[line:Reason For Ban]", "Ban Nickname", "User Admin",2},
		[6] = {"banip", " %[line:Ban This IP] %[line:Reason For Ban]", "Ban IP Address", "User Admin",1},
		[7] = {"banip", " %[ip] %[line:Reason For Ban]", "Ban IP Address", "User Admin",2},
		[8] = {"fullbanip"," %[line:Ban This IP] %[line:Reason For Ban]", "FullBan IP Address", "User Admin",1},
		[9] = {"fullbanip"," %[ip] %[line:Reason For Ban]", "FullBan IP Address", "User Admin",2},
		},
	[25] = {
		[1] = {bRestartHub = 0},
		[2] = {"restart", "", "Restart The Hub", "Hub Admin",3},
		},
	[26] = {
		[1] = {bClrTempBan = 0},
		[2] = {"clrtempbans", "", "Clear Temporary Bans", "Ban Admin",3},
		},
	}
	for i,v in ipairs(Commands) do
		local t = {}
		for key,val in pairs(v[1]) do if perms[key] then t = v end end
		if next(t) then
			for a,b in ipairs(t) do
				if a > 1 then
					local uc,pre,p = "$UserCommand 1 "," $<%[mynick]> "..pfx,"&#124;|"
					if i == 10 then pre = "" end
					str = str..uc..b[5].." "..menu.."\\"..b[4].."\\"..b[3]..pre..b[1]..b[2]..p
				end
			end
		end
	end
	return str
end
#54
Conversion Requests / Re: Regme Px
Last post by Cêñoßy†ê - 29 June, 2021, 16:01:15
Try this.
I wonder where you get your scripts in that format ?

--[[

	RegMe 1.0g LUA 5.11 [Strict][API 2]
	
	By Mutor	04/07/07
	
	Self Registration / Change Password Script
	
	-Checks if user is already registered
	-Checks for invalid characters in nick and password
	-Context menus [right click]
	-Responds to user in PM only
	-Existing password required to changed password
	-Prompts unregisted user to reg at script start and at user connect
	
	+Changes from 1.0	04/07/07	Requested by Yahoo
		+Added block unregistered user file transfer/search/chat and pm to non ops
		+Added 'block' message to unregistered user at connect attempt
		+Added report new self-registered user to online ops.
		
	+Changes from 1.0b	04/13/07
		+Added report Unregistered User login to OpNick 	Requested by Yahoo
		
	+Changes from 1.0c	10/21/07
		~Converted for the new PtokaX API

	+Changes from 1.0d	10/21/07
		~Bugfix in user reg, forgot all user data must be requested. Report by DarkElf

	+Changes from 1.0e	02/16/08
		+Added RegOnly/RegChat/RegPms options. Requested by Giorgos
		+Added Report option
		~Changed all SendToNick to SendToUser [faster call]

	+Changes from 1.0f	10/06/09
		+Blocked invalid command syntax, Requested by alcorp.
		+Filtered help message per profile status.
		+Added option for command notification to connecting users.

	RegMe Command Help

	Command		Description 
	¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
	!rmhelp		RegMe Command Help 
	!regme		Register Yourself  
	!passwd		Change Your Password  

	¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
	
]]

--//--
-- Disable transfer and search by unregistered users? true/false
local RegOnly = true
-- Disable chat for unregistered users? true/false
local RegChat = true
-- Disable private messages for unregistered users? true/false [pm's to ops are never blocked]
local RegPms = true
-- Report unregistered user logins to OpNick? true/false
local Report = true
-- Report nick for error messages and unregistered user logins [if Report = true]
local OpNick = "Mutor"
-- Show command notification to new connections? true/false
local Notify = true
--//--


local Bot,Scp,Pfx,Menu,SubMenu = "","","","",""
local BlockMsg = "\r\n\r\n\tUnregistered users may not chat, pm, search or transfer files in this hub.\r\n"..
"\tYou may pm operators for assistance. You may also self-register by typing.\r\n"..
"\t!regme <password> or use context menu commands [right click].\r\n\r\n"

OnStartup = function()
	Bot,Scp,Pfxs = SetMan.GetString(21),"RegMe 1.0g by Mutor",SetMan.GetString(29)
	Menu,SubMenu,Pfx =SetMan.GetString(0),"Self Registration",Pfxs:sub(1,1)
	for _,user in ipairs(Core.GetOnlineUsers(-1)) do
		Core.SendToUser(user,"<"..Bot.."> "..BlockMsg..RegCmds["rmhelp"](user,data,cmd))
	end
end

UserConnected = function(user)
	if user.iProfile == -1 then
		SendCmds(user)
		if Report then
			OnError("The Unregistered User: "..user.sNick.." has logged in to "..SetMan.GetString(0))
		end
		if RegOnly then
			Core.SendToUser(user,"<"..Bot.."> "..BlockMsg..RegCmds["rmhelp"](user,data,cmd))
		end
	end
end
OpConnected,RegConnected = UserConnected,UserConnected

ChatArrival = function(user,data)
	local _,_,pfx,cmd = data:find("%b<> (["..Pfxs.."])(%a+)")
	if pfx and cmd then
		cmd = cmd:lower()
		local i = user.iProfile
		local p = "Unregistered User",user.iProfile
		if i ~= -1 then p = ProfMan.GetProfile(i).sProfileName end
		local msg = "Sorry "..user.sNick..", "..p.."'s may not use the "..pfx..cmd.." command."
		if RegCmds[cmd] then
			if i == -1 and cmd == "regme" or i ~= -1 and cmd == "passwd" or cmd == "rmhelp" then
				return Core.SendPmToUser(user,Bot,RegCmds[cmd](user,data,cmd)), true
			else
				return Core.SendPmToUser(user,Bot,msg), true
			end
		else
			return Core.SendToUser(user,"<"..Bot.."> "..msg),
			Core.SendToUser(user,"<"..Bot.."> "..BlockMsg),true
		end
	else
		local _,_,to,from = string.find(data,"^$To: (%S+) From: (%S+)")
		if to and from then
			if RegPms and user.iProfile == -1 then
				local prof = Core.GetUser(to)
				if prof then
					if not Core.GetUserValue(prof,11) then
						return Core.SendPmToUser(user,to,"<"..Bot.."> "..BlockMsg),true
					end
				else
					return true
				end
			end
		else
			if RegChat and user.iProfile == -1 then
				return Core.SendToUser(user,"<"..Bot.."> "..BlockMsg),true
			end
		end
	end
end
ToArrival = ChatArrival

ConnectToMeArrival = function(user, data)
	if RegOnly and user.iProfile == -1 then
		local CtmMsg = "\t*Please remove this transfer from your download queue.*"
		return Core.SendToUser(user,"<"..Bot.."> "..BlockMsg..
		CtmMsg:gsub(" ",string.char(160)).."\r\n\r\n|"),true
	end
end
RevConnectToMeArrival = ConnectToMeArrival

SearchArrival = function (user, data)
	if RegOnly and user.iProfile == -1 then
		local _,_,search = string.find(data,"([^?]+)|$")
		if search then
			local t = "TTH:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"--hash(t) in lieu of hub(h)
			local n,h,b,i,u = user.sNick,SetMan.GetString(0),SetMan.GetString(21),
			SetMan.GetString(3):gsub(";.*",""),SetMan.GetString(4)
			local res = "Unknown Path"..string.char(92)..n..", search is "..
			"disabled for you :P "..string.rep("\t",15)..search
			return Core.SendToUser(user,"$SR "..b.." "..res.." 0 1/2"..t.." ("..i..":"..u..")|"..
			"<"..Bot.."> "..n..", search is disabled for you. Please close the "..
			string.format("%q",search:gsub("%$"," ")).." search window. Thank you.|"),true
		end
	end
end

OnError = function(msg)
	local user = Core.GetUser(OpNick)
	if user then
		Core.SendToUser(user,"<"..Bot.."> "..msg)
	end
end

SendCmds = function(user)
	local n,b = user.iProfile
	for i,v in pairs(RegCmds) do
		local c = i:lower()
		if n == -1 and c == "regme" or n ~= -1 and c == "passwd" or c == "rmhelp" then
			local desc,arg1,arg2 = RegCmds[i]()
			Core.SendToUser(user,"$UserCommand 1 1 "..Menu.."\\"..SubMenu.."\\"..
			desc.."$<%[mynick]> "..Pfx..i..arg1.."&#124;")
			Core.SendToUser(user,"$UserCommand 1 2 "..Menu.."\\"..SubMenu.."\\"..
			desc.."$<%[mynick]> "..Pfx..i..arg2.."&#124;")
			if not b then b = true end
		end
	end
	if b and Notify then
		local Prof = "Unregistered User"
		if user.iProfile > -1 then Prof = ProfMan.GetProfile(user.iProfile).sProfileName end
		Core.SendToUser(user,"<"..Bot.."> "..Prof.."'s "..Scp.." commands "..
		"enabled. See hub tab or user list for a menu.")
	end
end

FormatSize = function(int)
	local i,u,x = tonumber(int) or 0,{"","K","M","G","T","P"},1
	while i > 1024 do i,x = i/1024,x+1 end return string.format("%.2f %sB.",i,u[x])
end

RegCmds = {
	regme = function(user,data,cmd)
		if user then
			local nick = user.sNick
			if user.iProfile ~= -1 then
				return "Don't be silly "..nick.." you're already registered here."
			elseif Core.GetUserAllData(user) then
				local _,_,pwd = data:find("%b<> %p%w+ (%S+)|$")
				if pwd then
					if nick:find("[%c\$\|\<\>\:\?\*\"\/\\]") then
						return "Your nickname contains invalid characters. "..
						"Please choose a new one."
					end
					if pwd:find("[%c\$\|\<\>\:\?\*\"\/\\]") then
						return "Your password contains invalid characters. "..
						"Please choose a new one."
					end
					local hub = SetMan.GetString(0)
					local addy = SetMan.GetString(2)..":"..SetMan.GetString(3)
					local share,ip = FormatSize(user.iShareSize),user.sIP
					local slots = user.iSlots or 0
					local mode = "Passive"
					if user.bActive then mode = "Active" end
					if user.sMode and user.sMode == "5" then mode = "Socks5" end
					local opmsg = "\r\n\r\n\tA user has self-registered\r\n"..
					"\twith the the following details:\r\n"..
					"\t"..string.rep("¯",22).."\r\n"..
					"\tNick:\t"..nick.."\r\n"..
					"\tPass:\t"..pwd:gsub(".","x").."\r\n"..
					"\tShare:\t"..share.."\r\n"..
					"\tI.P.:\t"..ip.."\r\n"..
					"\tMode:\t"..mode.."\r\n"..
					"\tSlots:\t"..slots.."\r\n"
					RegMan.AddReg(nick, pwd, 3)
					Core.SendToOps("<"..Bot.."> "..opmsg)
					return "\r\n\r\n\tWelcome. You have successfully "..
					"registered yourself.\r\n\t"..string.rep("¯",40).."\r\n"..
					"\tHub Name:\t"..hub.."\r\n"..
					"\tHub Address:\t"..addy.."\r\n"..
					"\tUser Name:\t"..nick.."\r\n"..
					"\tPassword:\t"..pwd.."\r\n\r\n"..
					"\t"..string.rep("¯",40).."\r\n"..
					"\tPlease make a note of this information.\r\n"..
					"\tPlease reconnect to activate your status.\r\n"
				else
					return "Error! Usage: "..Pfx..cmd.." <password>"
				end
			end
		else
			return "Register Yourself "," %[line:Password]"," %[line:Password]"," <password>>"
		end
	end,
	passwd = function(user,data,cmd)
		if user then
			if user.iProfile == -1 then
				return "Don't be silly "..user.sNick.." you're not registered here."
			elseif Core.GetUserAllData(user) then
				local _,_,oldpass,newpass = data:find("%b<> %p%w+ (%S+) (.+)|$")
				if oldpass and newpass then
					local pwd,prof = RegMan.GetReg(user.sNick).sPassword,user.iProfile
					if pwd and prof then
						if oldpass:lower() ~= pwd:lower() then
							return "That is not your correct password. "..
							"Please try again. [case insensitive]"
						end
						if newpass:find("[%c\$\|\<\>\:\?\*\"\/\\]") then
							return "Your new password contains invalid characters. "..
							"Please choose a new one."
						end
						if newpass:lower() == oldpass:lower() then
							return "Your cannot change to the same password. "..
							"Please choose a new one."
						end
						RegMan.ChangeReg(user.sNick, newpass, prof)
						return "You have successfully changed your password from "..
						oldpass.." to "..newpass
					end
				else
					return "Error! Usage: ."..Pfx..cmd.." <old password> <new password>"
				end
			end
		else
			return "Change Your Password"," %[line:Old Password] %[line:New Password]",
			" %[line:Old Password] %[line:New Password]"," <old password> <new password>"
		end
	end,
	rmhelp = function(user,data,cmd,reg)
		if user then
			local n,b = user.iProfile
			local reply = "\r\n\r\n\t"..Scp.." Help\r\n\r\n\tCommand\t\tDescription\r\n"..
			"\t"..string.rep("¯",40).."\r\n"
			for i,v in pairs(RegCmds) do
				local c = i:lower()
				if n == -1 and c == "regme" or n ~= -1 and c == "passwd" or c == "rmhelp" then
				local desc = RegCmds[i]()
				reply = reply.."\t"..Pfx..string.format("%-15s",i).."\t"..desc.."\r\n"
				end
			end
			return reply.."\n\t"..string.rep("¯",40).."\r\n\r\n"
		else
			return "RegMe Help","",""
		end
	end,
}
#55
Conversion Requests / Re: ChatBot Px
Last post by Massi - 29 June, 2021, 13:45:04
Very good! Thanks for your support, assistance and testing :) and excuse me  ;)

Best Regards,
Massimiliano
#56
Conversion Requests / Re: ChatBot Px
Last post by Cêñoßy†ê - 28 June, 2021, 14:52:13
Did works just fine with PtokaX 0.5.2.2 [556] Lua 5.3

[15:49:35 | 127.0.0.1 | ] <Cêñoßy†ê> good morning
[15:49:46] <[Verbosity]> Did you sleep well Cêñoßy†ê?



--[[

	ChatBot 1.0g LUA 5.11 [Strict][API 2]
	
	By Mutor		11/22/07
	Requested by sphinx
	
	Yet another trigger bot, this one for the new API
	
	-Allows for multiple repsonses to a common trigger
	-Allows for (adjustable) random delay for response
	-Allows for regular expression in trigger 'patterns'
	-Uses all repsonses before repeating a response
	-Provides 'debug' reporting for pattern testing

	+Changes from 1.0	11/23/07
		+Added support for API 1 [old API] Requested by sphinx

	+Changes from 1.0b	03/18/08
		-Removed support for API 1, now API 2 strict again :P
		+Added option to register bot. Requested by Annie

	+Changes from 1.0c	03/20/08
		+Added start/stop toggle command for operators. Requested by P_pan
		+Added option to enable chatbot at script start
		+Added status message for connecting operators.

	+Changes from 1.0d	03/27/08
		+Added random messages option, if chat idle for 'x 'mins.	Requested by uffetjur
		+Added sample idle chat strings.

	+Changes from 1.0e	03/28/08
		+Addded replaceable parameters in 'IdleChat' for various hub/custom strings
		+Added a few more IdleChat strings
		~Changed idle chat functional only when there are online users

	+Changes from 1.0f	09/15/08
		+Added responses to statements to bot
		+Added a few more Wds strings
		~Minor code changes otherwise
]]

--[[ Start Settings]]--

-- Set the name for the Bot [Hub Bot = SetMan.GetString(SetMan.tStrings.HubBotNick)]
local Bot = "[Verbosity]"
-- Register the Bot? [ie show in user list] true/false
local RegBot = true
-- Description for bot, used if RegBot = true
local Desc = "Yet another trigger bot"
-- Set the min/max delay time [in seconds]for repsonse
local DelayRange = {3,10}
-- Your nick for debugging patterns ["" = disabled / "YourNick" = Send To You / "Ops" = Send To Ops]
local DebugNick = "" --"Mutor"
-- Command to turn chatbot on/off
local ChatCmd = "chatbot"
-- Chat responses enabled at script start?
local ChatOn = true
-- Add your trigger words/repsonses. Maintain table format [(user) will be replaced with user's nick]
local Wds = {
	["^h[i^.]$"] = {"Hello (user)","Hey There","Welcome back (user)","Wow look what the cat dragged in...."},
	[" *who[%?| |^%a]+"] = {"I don't know who (user)","Who? Beats me (user)?"},
	[" *hello "] = {"Hi (user)!","Greetings","When did you get out (user)?"},
	["cya.*"] = {"See you later (user)","So long"},
	["g[o|d]- *morning *.*$"] = {"Morning (user)","Did you sleep well (user)?"},
	["g[o|d]- *bye *.*$"] = {"Later (user)","Goodbye","Peace out playa","Bye for now (user)"},
	["g[o|d]- *night *.*$"] = {"Sleep well (user)","Goodnight (user)","G'night then"},
	["g[o|d]- *evening *.*$"] = {"Evening (user)","Is it evening (user)?"},
	["^back$"] = {"Welcome back (user)","(user), while you were afk your parole officer stopped by."},
	["later"] = {"Later (user)","Goodbye","Cya","peace out playa","You outtie (user)? ...Ahhiiite"},
	["%a+%?[ %|^%a]*"] = {"I dunno (user)","Good question (user)...","Are you asking me?","Sorry (user), I don't know.","I have no idea (user)"},
	["b[b|r][b|s|l]"] = {"See you (user)","See you in a while (user)","Ok hamma, later."},
	["wb"] = {"Welcome back","You have returned, now we can start the party"},
	["peace -"] = {"Peace to you (user)","Be well (user)","Give my regards to your parole officer (user)"},
	["^l[o]+l.*"] = {"haha",":D",":D","That's funny (user)"},
	["rofl"] = {"OK (user), you can get off the floor now.","It wasnt that funny :D"},
	["lmao"] = {"Great (user), now what will you use for an ass?.","hehe :D","I don't get it"},
	["lag[g|y|]*[i|n|g]*"] = {"Sorry, (user), the ISP sucks.","What|do|you|mean|lag|(user)?|There's no |...lag."},
	["%:[d|)]$"] = {"What are you smiling about (user)?","Smile (user), everyone loves a moron."},
	["%:[p|b]$"] = {"You are one cheeky fucker (user)","If you stick out your tongue (user), be prepared to use it!","Nyaaahhh :P"},
	["%;[d|p|b]$"] = {"Got someting in your eye (user)?","(user), are you coming on to me?"},
	["anyone [g|o|t]-%s*[h|a|v|e]*"] = {"Although it becomes you, don't beg (user)","Try searching (user)"},
	["got slot"] = {"No slot begging (user)","Just queue it up (user)"},
	["need sleep"] = {"Ahh to sleep, per chance to dream","Get some rest (user) you look like shit.","Sleep well"},
	["typo"] = {"Nice typing skills (user)","Care to type that again?"},
	["y[n]*hub"] = {"Oooh YnHub, do they make that for adults now?","I like PtokaX much better!"},
	["[.]lua[.]*"] = {"Luaistheshit (user)","mmmmmmm ....looahh"},
	["regme"] = {"Yooohoo operators, (user) wants to register!","Sorry (user), I'm just a bot!"},
	["kk"] = {"Agreed (user)","Ahhiiite"},
	["shut up"] = {"Bite me (user)","I can't shut up (user), I'm female"},
	--[""] = {"",""}
	}
-- Enable random messages after x minutes of idle main chat [0 = disable] 
-- ***Note: This feature only functions if there are online users.
local Idle = 30
-- If 'Idle' above is enabled, set messages below.
-- *** Certain strings will be replaced as follows:
-- [Desc] = Hub Description,[Admin] = Admins Nick, [Hub] = Hub Name, [List] = Hub list,
-- [Bot] = Hub Bot, [OpChat] = OpChat name, [Lang] Hub language, [Addr] = Hub address, 
-- [Email] = Owner Email, [Topic] = current hub topic, [User] = random online user nick
-- Don't use any such tags [-- comment lines] unless they are set in the PtokaX GUI
local IdleChat = {
	"Dammit! [User] killed the chat again.","Roll over [User], you're snoring again.",
	"Yawn...","ZZZZZZZZZzzzzzz.......","Shut up! All of you.",
	"Where did everyone go?","Parlez-vous Anglais?","Okay the bar is now open, who needs a drink?",
	"Okay [User], I'm here now, you can start the party!","Help I've fallen and I...   ...hey nice carpet.",
	"[User] isn't around? Thank God!","Has anyone seen [User]",
	"Welcome to [Hub] where you can get a good snooze.",
	"Hehe, it's dead in here, the real party is in [OpChat]",
	"Is this [Hub] or the city morgue?","One tequila, two tequila, three tequila,   ...floor.",
	"Man alive [Admin], this is boring.","Next mood swing......six minutes",
	"Welcome to [Hub], where the dead come to sleep.",
	"With a description like [Desc], I expected more chatter.",
	"You're right [User], [Admin] IS dead sexy...",
	"ECHO! ECho! Echo' echo ....",
	"...Changing hub topic from '[Topic]' to 'Snoozefest "..os.date("%Y").."'",
	"Hello!? This IS an [Lang] speaking hub isn't it?",
	"Uh-oh am I alone here again?",
	"Wow, you can here a pin drop in here. Well at least [User] is quiet for a change.",
	"It's true [User], I DO like the sound of my own voice",
	"Does anyone mind if I eat this last cookie?",
	"I'll tell ya [User], it's lonely at the top    ....of the user list :P",
	"Don't worry about me, I'll just sit here and look beautiful in contrast to [User].",
	"Ok fine [User], I'll just take these naked women and all this beer someplace else!",
	"[User] are you ignoring me?",
	"[Bot]'s mom was a Commodore 64",
	"I have seen more activity watching the grass grow.",
	"ZZZZZZZZZZzzzzzz........",
	}
local BotStrings = {
	{{"shut the fuck","shut up","stfu"},{"I can't shut up (user), I'm female","Wait (user) I'm trying to imagine you with a personality.","you shut up (user)","I will speak if I want","You're not the boss of me (user)"}},
	{{"fuck[^%a]","go fuck"},{"No fuck you (user)","Talk to the hand (user)","500,000 sperm and you were the fastest (user)?"}},
	{{"dick","tool","penis"},{"Then suck me","bite me (user)","Don't piss me off (user) I'm running out of places to hide the bodies.",}},
	{{"stupid","dumb","retard"},{"I'm damn smarter than you (user)","If I throw a stick, will you leave (user)?","I'm trying to imagine you with a personality.","Sorry (user), I can be no smater than my author"}},
	{{"bot","robot","script"},{"Bot? I am as real as you are (user)","The village called for ya (user), ...they want their idiot back."}},
	{{" *script *"},{"I am what happens when letters have sex","I am, therefore I Lua"}},
	{{"hate","suck","fag","jerk","gay"},{"Don't hate the playa (user), hate the game","Don't be a hater (user)","Okay, okay! I take it back. Unfuck you!!!","I don't have an attitude problem. You have a perception problem.",}},
}
--[[ End Settings]]--

ChkBotStr = function(str)
	local bot,s = Bot:gsub("%p%c",""),""
	for wrd in str:lower():gmatch("([^%p ]+)") do
		if bot:lower():find(wrd:gsub("%p%c","%%%1")) then
			for i,v in ipairs(BotStrings) do
				for a,b in ipairs(v[1]) do
					if str:lower():find(b:lower()) then
						local reply = v[2][math.random(#v[2])]
						return reply
					end
				end
			end
		end
	end
end

local Trigs,Used,Tmr,IdleTime,IdleUsed,Clean,LastNick = {},{},0,os.time(),{},os.time() + 30000,""
OnStartup = function()
	local HubChat = {}
	if Bot == "" then Bot = SetMan.GetString(SetMan.tStrings.HubBotNick) end
	if RegBot and Bot ~= SetMan.GetString(SetMan.tStrings.HubBotNick) then Core.RegBot(Bot,Desc,"",true) end	
	if not SetMan.GetString(34) then SetMan.SetString(34,"English") SetMan.Save() end
	Tmr = TmrMan.AddTimer(1000)
	for i,v in pairs(Wds) do Used[i] = {"",#v} end
	collectgarbage("collect")
end

OnTimer = function(Id)
	if Id == Tmr then
		if next(Trigs) then
			local i,r = ChkTrigs()
			if i and r then Core.SendToAll("<"..Bot.."> "..r.."|") table.remove(Trigs,i) end
		end
		if Idle > 0 and next(IdleChat) and ((os.time() - IdleTime)/60) > Idle then
			IdleTime = os.time()-1
			if #IdleUsed >= #IdleChat then IdleUsed = {} end
			local Chk = function(int)
				for i,v in ipairs(IdleUsed) do if int == v then return true end end
			end
			math.randomseed(os.time())
			local x = math.random(#IdleChat)
			while Chk(x) do x = math.random(#IdleChat) end
			table.insert(IdleUsed,x)
			local chat,nick = IdleChat[x]
			local t = Core.GetOnlineUsers()
			if next(t) then
				nick = t[math.random(#t)].sNick
				while nick:lower() == LastNick:lower() do nick = t[math.random(#t)].sNick end
				LastNick = nick
				local tab = {
				{"%[Hub%]",0},{"%[Admin%]",1},{"%[Addr%]",2},{"%[Desc%]",5},{"%[Redir%]",6},
				{"%[List%]",7},{"%[Topic%]",10},{"%[Bot%]",21},{"%[OpChat%]",24},{"%[Email%]",30},
				{"%[Lang%]",34},{"%[User%]",nick},
				}
				for i,v in ipairs(tab) do
					if type(v[2]) == "number" then
						chat = chat:gsub(v[1],SetMan.GetString(v[2]) or "%1: Not Set In GUI!")
					else
						chat = chat:gsub(v[1],v[2])
					end
				end
				Core.SendToAll("<"..Bot.."> "..chat.."|")
			end
		end
		if os.time() > Clean then Clean = os.time() + 30000 collectgarbage("collect") end
	end
end

ChkTrigs = function(t)
	local n = os.time()
	for i,v in ipairs(Trigs) do if n > v[1] then return i,v[2] end end
end

OpConnected = function(user)
	local x,t,p = ChatOn,{["true"]= "enabled",["false"] = "disabled"},SetMan.GetString(29):sub(1,1)
	Core.SendToUser(user,"<"..Bot.."> ChatBot is currently "..t[tostring(x)]..
	", type "..p..ChatCmd:lower().." to change it's status.|")
end

ChatArrival = function(user, data)
	if Core.GetUserValue(user,11) then
		local _,_,cmd = data:lower():find("^%b<> ["..SetMan.GetString(29).."]("..ChatCmd:lower()..")|$")
		if cmd then
			local x,t = ChatOn,{["true"]= "enabled",["false"] = "disabled"}
			if x then x = false else x = true end ChatOn = x
			return Core.SendToUser(user,"<"..Bot.."> ChatBot is now "..t[tostring(x)].."|"),true
		end
	end
	if ChatOn and not data:lower():find("^%b<> ["..SetMan.GetString(29).."][%a]+") then
		IdleTime = os.time()-1
		local dat = data:sub(1,-2):gsub("^%b<> ","")
		local ret = ChkBotStr(dat)
		if ret then
			local delay = os.time() + math.random(math.max(2,DelayRange[1]),math.min(15,DelayRange[2]))
			table.insert(Trigs,{delay,ret:gsub("%(user%)",user.sNick)})
		else
			for i,v in pairs(Wds) do
				if dat:lower():find(i:lower()) then
					if DebugNick ~= "" then
						local x,r = i:gsub("|","&#124;"),"\t"
						r = r:rep(12).." is kicking because:"
						local msg = "<"..Bot.."> Trigger: '"..x.."' found in: "
						if DebugNick:lower() == "ops" then
							Core.SendToOps(msg..data.."|"..msg..r)
						else
							local op = Core.GetUser(DebugNick)
							if op then Core.SendToUser(op,msg..data.."|"..msg..r) end
						end
					end
					if Used[i][2] <= 0 then Used[i] = {"",#v} end
					local x = math.random(#v)
					while Used[i][1]:find(x) do x = math.random(#v) end
					Used[i][1] = Used[i][1]..tostring(x)
					Used[i][2] = Used[i][2] - 1
					local reply = v[x]
					math.randomseed(os.time())
					local delay = os.time() + math.random(math.max(2,DelayRange[1]),math.min(15,DelayRange[2]))
					table.insert(Trigs,{delay,reply:gsub("%(user%)",user.sNick)})
					break
				end
			end
		end
	end
end
#57
Finished Scripts / Re: Timed hub time/date
Last post by Cêñoßy†ê - 28 June, 2021, 12:57:37
Code  above updated with small fix

v2.1.2 by Cêñoßy†ê 28.06.2021
   -- fixed correct date and time (got stucked to script start time)
#58
Feature Proposals / Command PX
Last post by Massi - 11 June, 2021, 12:58:13
Hello  :)

If possible, in the next release of the Ptokax Hubsoft, that can integrate hub commands on the right button (of the mouse)

Best Regards,
Massimiliano.
#59
Conversion Requests / ChatBot Px
Last post by Massi - 11 June, 2021, 10:35:32
Please, convert in Lua 5.3.4 for Ptokax 0.5.2.2 Thanks  :)

--[[ ChatBot 1.0g LUA 5.11 [Strict][API 2] By Mutor 11/22/07 Requested by sphinx Yet another trigger bot, this one for the new API -Allows for multiple repsonses to a common trigger -Allows for (adjustable) random delay for response -Allows for regular expression in trigger 'patterns' -Uses all repsonses before repeating a response -Provides 'debug' reporting for pattern testing +Changes from 1.0 11/23/07 +Added support for API 1 [old API] Requested by sphinx +Changes from 1.0b 03/18/08 -Removed support for API 1, now API 2 strict again :P +Added option to register bot. Requested by Annie +Changes from 1.0c 03/20/08 +Added start/stop toggle command for operators. Requested by P_pan +Added option to enable chatbot at script start +Added status message for connecting operators. +Changes from 1.0d 03/27/08 +Added random messages option, if chat idle for 'x 'mins. Requested by uffetjur +Added sample idle chat strings. +Changes from 1.0e 03/28/08 +Addded replaceable parameters in 'IdleChat' for various hub/custom strings +Added a few more IdleChat strings ~Changed idle chat functional only when there are online users +Changes from 1.0f 09/15/08 +Added responses to statements to bot +Added a few more Wds strings ~Minor code changes otherwise ]] --[[ Start Settings]]-- -- Set the name for the Bot [Hub Bot = SetMan.GetString(21)] local Bot = "[Verbosity]" -- Register the Bot? [ie show in user list] true/false local RegBot = true -- Description for bot, used if RegBot = true local Desc = "Yet another trigger bot" -- Set the min/max delay time [in seconds]for repsonse local DelayRange = {3,10} -- Your nick for debugging patterns ["" = disabled / "YourNick" = Send To You / "Ops" = Send To Ops] local DebugNick = "" --"Mutor" -- Command to turn chatbot on/off local ChatCmd = "chatbot" -- Chat responses enabled at script start? local ChatOn = true -- Add your trigger words/repsonses. Maintain table format [(user) will be replaced with user's nick] local Wds = { ["^h[i^.]$"] = {"Hello (user)","Hey There","Welcome back (user)","Wow look what the cat dragged in...."}, [" *who[%?| |^%a]+"] = {"I don't know who (user)","Who? Beats me (user)?"}, [" *hello "] = {"Hi (user)!","Greetings","When did you get out (user)?"}, ["cya.*"] = {"See you later (user)","So long"}, ["g[o|d]- *morning *.*$"] = {"Morning (user)","Did you sleep well (user)?"}, ["g[o|d]- *bye *.*$"] = {"Later (user)","Goodbye","Peace out playa","Bye for now (user)"}, ["g[o|d]- *night *.*$"] = {"Sleep well (user)","Goodnight (user)","G'night then"}, ["g[o|d]- *evening *.*$"] = {"Evening (user)","Is it evening (user)?"}, ["^back$"] = {"Welcome back (user)","(user), while you were afk your parole officer stopped by."}, ["later"] = {"Later (user)","Goodbye","Cya","peace out playa","You outtie (user)? ...Ahhiiite"}, ["%a+%?[ %|^%a]*"] = {"I dunno (user)","Good question (user)...","Are you asking me?","Sorry (user), I don't know.","I have no idea (user)"}, ["b[b|r][b|s|l]"] = {"See you (user)","See you in a while (user)","Ok hamma, later."}, ["wb"] = {"Welcome back","You have returned, now we can start the party"}, ["peace -"] = {"Peace to you (user)","Be well (user)","Give my regards to your parole officer (user)"}, ["^l[o]+l.*"] = {"haha",":D",":D","That's funny (user)"}, ["rofl"] = {"OK (user), you can get off the floor now.","It wasnt that funny :D"}, ["lmao"] = {"Great (user), now what will you use for an ass?.","hehe :D","I don't get it"}, ["lag[g|y|]*[i|n|g]*"] = {"Sorry, (user), the ISP sucks.","What|do|you|mean|lag|(user)?|There's no |...lag."}, ["%:[d|)]$"] = {"What are you smiling about (user)?","Smile (user), everyone loves a moron."}, ["%:[p|b]$"] = {"You are one cheeky fucker (user)","If you stick out your tongue (user), be prepared to use it!","Nyaaahhh :P"}, ["%;[d|p|b]$"] = {"Got someting in your eye (user)?","(user), are you coming on to me?"}, ["anyone [g|o|t]-%s*[h|a|v|e]*"] = {"Although it becomes you, don't beg (user)","Try searching (user)"}, ["got slot"] = {"No slot begging (user)","Just queue it up (user)"}, ["need sleep"] = {"Ahh to sleep, per chance to dream","Get some rest (user) you look like shit.","Sleep well"}, ["typo"] = {"Nice typing skills (user)","Care to type that again?"}, ["y[n]*hub"] = {"Oooh YnHub, do they make that for adults now?","I like PtokaX much better!"}, ["[.]lua[.]*"] = {"Luaistheshit (user)","mmmmmmm ....looahh"}, ["regme"] = {"Yooohoo operators, (user) wants to register!","Sorry (user), I'm just a bot!"}, ["kk"] = {"Agreed (user)","Ahhiiite"}, ["shut up"] = {"Bite me (user)","I can't shut up (user), I'm female"}, --[""] = {"",""} } -- Enable random messages after x minutes of idle main chat [0 = disable] -- ***Note: This feature only functions if there are online users. local Idle = 30 -- If 'Idle' above is enabled, set messages below. -- *** Certain strings will be replaced as follows: -- [Desc] = Hub Description,[Admin] = Admins Nick, [Hub] = Hub Name, [List] = Hub list, -- [Bot] = Hub Bot, [OpChat] = OpChat name, [Lang] Hub language, [Addr] = Hub address, -- [Email] = Owner Email, [Topic] = current hub topic, [User] = random online user nick -- Don't use any such tags [-- comment lines] unless they are set in the PtokaX GUI local IdleChat = { "Dammit! [User] killed the chat again.","Roll over [User], you're snoring again.", "Yawn...","ZZZZZZZZZzzzzzz.......","Shut up! All of you.", "Where did everyone go?","Parlez-vous Anglais?","Okay the bar is now open, who needs a drink?", "Okay [User], I'm here now, you can start the party!","Help I've fallen and I... ...hey nice carpet.", "[User] isn't around? Thank God!","Has anyone seen [User]", "Welcome to [Hub] where you can get a good snooze.", "Hehe, it's dead in here, the real party is in [OpChat]", "Is this [Hub] or the city morgue?","One tequila, two tequila, three tequila, ...floor.", "Man alive [Admin], this is boring.","Next mood swing......six minutes", "Welcome to [Hub], where the dead come to sleep.", "With a description like [Desc], I expected more chatter.", "You're right [User], [Admin] IS dead sexy...", "ECHO! ECho! Echo' echo ....", "...Changing hub topic from '[Topic]' to 'Snoozefest "..os.date("%Y").."'", "Hello!? This IS an [Lang] speaking hub isn't it?", "Uh-oh am I alone here again?", "Wow, you can here a pin drop in here. Well at least [User] is quiet for a change.", "It's true [User], I DO like the sound of my own voice", "Does anyone mind if I eat this last cookie?", "I'll tell ya [User], it's lonely at the top ....of the user list :P", "Don't worry about me, I'll just sit here and look beautiful in contrast to [User].", "Ok fine [User], I'll just take these naked women and all this beer someplace else!", "[User] are you ignoring me?", "[Bot]'s mom was a Commodore 64", "I have seen more activity watching the grass grow.", "ZZZZZZZZZZzzzzzz........", } local BotStrings = { {{"shut the fuck","shut up","stfu"},{"I can't shut up (user), I'm female","Wait (user) I'm trying to imagine you with a personality.","you shut up (user)","I will speak if I want","You're not the boss of me (user)"}}, {{"fuck[^%a]","go fuck"},{"No fuck you (user)","Talk to the hand (user)","500,000 sperm and you were the fastest (user)?"}}, {{"dick","tool","penis"},{"Then suck me","bite me (user)","Don't piss me off (user) I'm running out of places to hide the bodies.",}}, {{"stupid","dumb","retard"},{"I'm damn smarter than you (user)","If I throw a stick, will you leave (user)?","I'm trying to imagine you with a personality.","Sorry (user), I can be no smater than my author"}}, {{"bot","robot","script"},{"Bot? I am as real as you are (user)","The village called for ya (user), ...they want their idiot back."}}, {{" *script *"},{"I am what happens when letters have sex","I am, therefore I Lua"}}, {{"hate","suck","fag","jerk","gay"},{"Don't hate the playa (user), hate the game","Don't be a hater (user)","Okay, okay! I take it back. Unfuck you!!!","I don't have an attitude problem. You have a perception problem.",}}, } --[[ End Settings]]-- ChkBotStr = function(str) local bot,s = Bot:gsub("%p%c",""),"" for wrd in str:lower():gmatch("([^%p ]+)") do if bot:lower():find(wrd:gsub("%p%c","%%%1")) then for i,v in ipairs(BotStrings) do for a,b in ipairs(v[1]) do if str:lower():find(b:lower()) then local reply = v[2][math.random(#v[2])] return reply end end end end end end local Trigs,Used,Tmr,IdleTime,IdleUsed,Clean,LastNick = {},{},0,os.time(),{},os.time() + 30000,"" OnStartup = function() local HubChat = {} if Bot == "" then Bot = SetMan.GetString(21) end if RegBot and Bot ~= SetMan.GetString(21) then Core.RegBot(Bot,Desc,"",true) end if not SetMan.GetString(34) then SetMan.SetString(34,"English") SetMan.Save() end Tmr = TmrMan.AddTimer(1000) for i,v in pairs(Wds) do Used[i] = {"",#v} end collectgarbage("collect") end OnTimer = function(Id) if Id == Tmr then if next(Trigs) then local i,r = ChkTrigs() if i and r then Core.SendToAll("<"..Bot.."> "..r.."|") table.remove(Trigs,i) end end if Idle > 0 and next(IdleChat) and ((os.time() - IdleTime)/60) > Idle then IdleTime = os.time()-1 if #IdleUsed >= #IdleChat then IdleUsed = {} end local Chk = function(int) for i,v in ipairs(IdleUsed) do if int == v then return true end end end math.randomseed(os.time()) local x = math.random(#IdleChat) while Chk(x) do x = math.random(#IdleChat) end table.insert(IdleUsed,x) local chat,nick = IdleChat[x] local t = Core.GetOnlineUsers() if next(t) then nick = t[math.random(#t)].sNick while nick:lower() == LastNick:lower() do nick = t[math.random(#t)].sNick end LastNick = nick local tab = { {"%[Hub%]",0},{"%[Admin%]",1},{"%[Addr%]",2},{"%[Desc%]",5},{"%[Redir%]",6}, {"%[List%]",7},{"%[Topic%]",10},{"%[Bot%]",21},{"%[OpChat%]",24},{"%[Email%]",30}, {"%[Lang%]",34},{"%[User%]",nick}, } for i,v in ipairs(tab) do if type(v[2]) == "number" then chat = chat:gsub(v[1],SetMan.GetString(v[2]) or "%1: Not Set In GUI!") else chat = chat:gsub(v[1],v[2]) end end Core.SendToAll("<"..Bot.."> "..chat.."|") end end if os.time() > Clean then Clean = os.time() + 30000 collectgarbage("collect") end end end ChkTrigs = function(t) local n = os.time() for i,v in ipairs(Trigs) do if n > v[1] then return i,v[2] end end end OpConnected = function(user) local x,t,p = ChatOn,{["true"]= "enabled",["false"] = "disabled"},SetMan.GetString(29):sub(1,1) Core.SendToUser(user,"<"..Bot.."> ChatBot is currently "..t[tostring(x)].. ", type "..p..ChatCmd:lower().." to change it's status.|") end ChatArrival = function(user, data) if Core.GetUserValue(user,11) then local _,_,cmd = data:lower():find("^%b<> ["..SetMan.GetString(29).."]("..ChatCmd:lower()..")|$") if cmd then local x,t = ChatOn,{["true"]= "enabled",["false"] = "disabled"} if x then x = false else x = true end ChatOn = x return Core.SendToUser(user,"<"..Bot.."> ChatBot is now "..t[tostring(x)].."|"),true end end if ChatOn and not data:lower():find("^%b<> ["..SetMan.GetString(29).."][%a]+") then IdleTime = os.time()-1 local dat = data:sub(1,-2):gsub("^%b<> ","") local ret = ChkBotStr(dat) if ret then local delay = os.time() + math.random(math.max(2,DelayRange[1]),math.min(15,DelayRange[2])) table.insert(Trigs,{delay,ret:gsub("%(user%)",user.sNick)}) else for i,v in pairs(Wds) do if dat:lower():find(i:lower()) then if DebugNick ~= "" then local x,r = i:gsub("|","|"),"\t" r = r:rep(12).." is kicking because:" local msg = "<"..Bot.."> Trigger: '"..x.."' found in: " if DebugNick:lower() == "ops" then Core.SendToOps(msg..data.."|"..msg..r) else local op = Core.GetUser(DebugNick) if op then Core.SendToUser(op,msg..data.."|"..msg..r) end end end if Used[i][2] <= 0 then Used[i] = {"",#v} end local x = math.random(#v) while Used[i][1]:find(x) do x = math.random(#v) end Used[i][1] = Used[i][1]..tostring(x) Used[i][2] = Used[i][2] - 1 local reply = v[x] math.randomseed(os.time()) local delay = os.time() + math.random(math.max(2,DelayRange[1]),math.min(15,DelayRange[2])) table.insert(Trigs,{delay,reply:gsub("%(user%)",user.sNick)}) break end end end end end


Best Regards,
Massimiliano
#60
Conversion Requests / Regme Px
Last post by Massi - 11 June, 2021, 10:32:07
Please, convert in Lua 5.3.4 for Ptokax 0.5.2.2 Thanks  :)

--[[ RegMe 1.0g LUA 5.11 [Strict][API 2] By Mutor 04/07/07 Self Registration / Change Password Script -Checks if user is already registered -Checks for invalid characters in nick and password -Context menus [right click] -Responds to user in PM only -Existing password required to changed password -Prompts unregisted user to reg at script start and at user connect +Changes from 1.0 04/07/07 Requested by Yahoo +Added block unregistered user file transfer/search/chat and pm to non ops +Added 'block' message to unregistered user at connect attempt +Added report new self-registered user to online ops. +Changes from 1.0b 04/13/07 +Added report Unregistered User login to OpNick Requested by Yahoo +Changes from 1.0c 10/21/07 ~Converted for the new PtokaX API +Changes from 1.0d 10/21/07 ~Bugfix in user reg, forgot all user data must be requested. Report by DarkElf +Changes from 1.0e 02/16/08 +Added RegOnly/RegChat/RegPms options. Requested by Giorgos +Added Report option ~Changed all SendToNick to SendToUser [faster call] +Changes from 1.0f 10/06/09 +Blocked invalid command syntax, Requested by alcorp. +Filtered help message per profile status. +Added option for command notification to connecting users. RegMe Command Help Command Description ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ !rmhelp RegMe Command Help !regme Register Yourself !passwd Change Your Password ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ]] --//-- -- Disable transfer and search by unregistered users? true/false local RegOnly = true -- Disable chat for unregistered users? true/false local RegChat = true -- Disable private messages for unregistered users? true/false [pm's to ops are never blocked] local RegPms = true -- Report unregistered user logins to OpNick? true/false local Report = true -- Report nick for error messages and unregistered user logins [if Report = true] local OpNick = "Mutor" -- Show command notification to new connections? true/false local Notify = true --//-- local Bot,Scp,Pfx,Menu,SubMenu = "","","","","" local BlockMsg = "\r\n\r\n\tUnregistered users may not chat, pm, search or transfer files in this hub.\r\n".. "\tYou may pm operators for assistance. You may also self-register by typing.\r\n".. "\t!regme  or use context menu commands [right click].\r\n\r\n" OnStartup = function() Bot,Scp,Pfxs = SetMan.GetString(21),"RegMe 1.0g by Mutor",SetMan.GetString(29) Menu,SubMenu,Pfx =SetMan.GetString(0),"Self Registration",Pfxs:sub(1,1) for _,user in ipairs(Core.GetOnlineUsers(-1)) do Core.SendToUser(user,"<"..Bot.."> "..BlockMsg..RegCmds["rmhelp"](user,data,cmd)) end end UserConnected = function(user) if user.iProfile == -1 then SendCmds(user) if Report then OnError("The Unregistered User: "..user.sNick.." has logged in to "..SetMan.GetString(0)) end if RegOnly then Core.SendToUser(user,"<"..Bot.."> "..BlockMsg..RegCmds["rmhelp"](user,data,cmd)) end end end OpConnected,RegConnected = UserConnected,UserConnected ChatArrival = function(user,data) local _,_,pfx,cmd = data:find("%b<> (["..Pfxs.."])(%a+)") if pfx and cmd then cmd = cmd:lower() local i = user.iProfile local p = "Unregistered User",user.iProfile if i ~= -1 then p = ProfMan.GetProfile(i).sProfileName end local msg = "Sorry "..user.sNick..", "..p.."'s may not use the "..pfx..cmd.." command." if RegCmds[cmd] then if i == -1 and cmd == "regme" or i ~= -1 and cmd == "passwd" or cmd == "rmhelp" then return Core.SendPmToUser(user,Bot,RegCmds[cmd](user,data,cmd)), true else return Core.SendPmToUser(user,Bot,msg), true end else return Core.SendToUser(user,"<"..Bot.."> "..msg), Core.SendToUser(user,"<"..Bot.."> "..BlockMsg),true end else local _,_,to,from = string.find(data,"^$To: (%S+) From: (%S+)") if to and from then if RegPms and user.iProfile == -1 then local prof = Core.GetUser(to) if prof then if not Core.GetUserValue(prof,11) then return Core.SendPmToUser(user,to,"<"..Bot.."> "..BlockMsg),true end else return true end end else if RegChat and user.iProfile == -1 then return Core.SendToUser(user,"<"..Bot.."> "..BlockMsg),true end end end end ToArrival = ChatArrival ConnectToMeArrival = function(user, data) if RegOnly and user.iProfile == -1 then local CtmMsg = "\t*Please remove this transfer from your download queue.*" return Core.SendToUser(user,"<"..Bot.."> "..BlockMsg.. CtmMsg:gsub(" ",string.char(160)).."\r\n\r\n|"),true end end RevConnectToMeArrival = ConnectToMeArrival SearchArrival = function (user, data) if RegOnly and user.iProfile == -1 then local _,_,search = string.find(data,"([^?]+)|$") if search then local t = "TTH:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"--hash(t) in lieu of hub(h) local n,h,b,i,u = user.sNick,SetMan.GetString(0),SetMan.GetString(21), SetMan.GetString(3):gsub(";.*",""),SetMan.GetString(4) local res = "Unknown Path"..string.char(92)..n..", search is ".. "disabled for you :P "..string.rep("\t",15)..search return Core.SendToUser(user,"$SR "..b.." "..res.." 0 1/2"..t.." ("..i..":"..u..")|".. "<"..Bot.."> "..n..", search is disabled for you. Please close the ".. string.format("%q",search:gsub("%$"," ")).." search window. Thank you.|"),true end end end OnError = function(msg) local user = Core.GetUser(OpNick) if user then Core.SendToUser(user,"<"..Bot.."> "..msg) end end SendCmds = function(user) local n,b = user.iProfile for i,v in pairs(RegCmds) do local c = i:lower() if n == -1 and c == "regme" or n ~= -1 and c == "passwd" or c == "rmhelp" then local desc,arg1,arg2 = RegCmds[i]() Core.SendToUser(user,"$UserCommand 1 1 "..Menu.."\\"..SubMenu.."\\".. desc.."$<%[mynick]> "..Pfx..i..arg1.."|") Core.SendToUser(user,"$UserCommand 1 2 "..Menu.."\\"..SubMenu.."\\".. desc.."$<%[mynick]> "..Pfx..i..arg2.."|") if not b then b = true end end end if b and Notify then local Prof = "Unregistered User" if user.iProfile > -1 then Prof = ProfMan.GetProfile(user.iProfile).sProfileName end Core.SendToUser(user,"<"..Bot.."> "..Prof.."'s "..Scp.." commands ".. "enabled. See hub tab or user list for a menu.") end end FormatSize = function(int) local i,u,x = tonumber(int) or 0,{"","K","M","G","T","P"},1 while i > 1024 do i,x = i/1024,x+1 end return string.format("%.2f %sB.",i,u[x]) end RegCmds = { regme = function(user,data,cmd) if user then local nick = user.sNick if user.iProfile ~= -1 then return "Don't be silly "..nick.." you're already registered here." elseif Core.GetUserAllData(user) then local _,_,pwd = data:find("%b<> %p%w+ (%S+)|$") if pwd then if nick:find("[%c\$\|\<\>\:\?\*\"\/\\]") then return "Your nickname contains invalid characters. ".. "Please choose a new one." end if pwd:find("[%c\$\|\<\>\:\?\*\"\/\\]") then return "Your password contains invalid characters. ".. "Please choose a new one." end local hub = SetMan.GetString(0) local addy = SetMan.GetString(2)..":"..SetMan.GetString(3) local share,ip = FormatSize(user.iShareSize),user.sIP local slots = user.iSlots or 0 local mode = "Passive" if user.bActive then mode = "Active" end if user.sMode and user.sMode == "5" then mode = "Socks5" end local opmsg = "\r\n\r\n\tA user has self-registered\r\n".. "\twith the the following details:\r\n".. "\t"..string.rep("¯",22).."\r\n".. "\tNick:\t"..nick.."\r\n".. "\tPass:\t"..pwd:gsub(".","x").."\r\n".. "\tShare:\t"..share.."\r\n".. "\tI.P.:\t"..ip.."\r\n".. "\tMode:\t"..mode.."\r\n".. "\tSlots:\t"..slots.."\r\n" RegMan.AddReg(nick, pwd, 3) Core.SendToOps("<"..Bot.."> "..opmsg) return "\r\n\r\n\tWelcome. You have successfully ".. "registered yourself.\r\n\t"..string.rep("¯",40).."\r\n".. "\tHub Name:\t"..hub.."\r\n".. "\tHub Address:\t"..addy.."\r\n".. "\tUser Name:\t"..nick.."\r\n".. "\tPassword:\t"..pwd.."\r\n\r\n".. "\t"..string.rep("¯",40).."\r\n".. "\tPlease make a note of this information.\r\n".. "\tPlease reconnect to activate your status.\r\n" else return "Error! Usage: "..Pfx..cmd.." " end end else return "Register Yourself "," %[line:Password]"," %[line:Password]"," >" end end, passwd = function(user,data,cmd) if user then if user.iProfile == -1 then return "Don't be silly "..user.sNick.." you're not registered here." elseif Core.GetUserAllData(user) then local _,_,oldpass,newpass = data:find("%b<> %p%w+ (%S+) (.+)|$") if oldpass and newpass then local pwd,prof = RegMan.GetReg(user.sNick).sPassword,user.iProfile if pwd and prof then if oldpass:lower() ~= pwd:lower() then return "That is not your correct password. ".. "Please try again. [case insensitive]" end if newpass:find("[%c\$\|\<\>\:\?\*\"\/\\]") then return "Your new password contains invalid characters. ".. "Please choose a new one." end if newpass:lower() == oldpass:lower() then return "Your cannot change to the same password. ".. "Please choose a new one." end RegMan.ChangeReg(user.sNick, newpass, prof) return "You have successfully changed your password from ".. oldpass.." to "..newpass end else return "Error! Usage: ."..Pfx..cmd.." " end end else return "Change Your Password"," %[line:Old Password] %[line:New Password]", " %[line:Old Password] %[line:New Password]"," " end end, rmhelp = function(user,data,cmd,reg) if user then local n,b = user.iProfile local reply = "\r\n\r\n\t"..Scp.." Help\r\n\r\n\tCommand\t\tDescription\r\n".. "\t"..string.rep("¯",40).."\r\n" for i,v in pairs(RegCmds) do local c = i:lower() if n == -1 and c == "regme" or n ~= -1 and c == "passwd" or c == "rmhelp" then local desc = RegCmds[i]() reply = reply.."\t"..Pfx..string.format("%-15s",i).."\t"..desc.."\r\n" end end return reply.."\n\t"..string.rep("¯",40).."\r\n\r\n" else return "RegMe Help","","" end end, } ]


Best Regards,
Massimiliano
SMF spam blocked by CleanTalk