READ THE RULES
0 Members and 1 Guest are viewing this topic.
--[[ Disclaimer 2.0 LUA 5.1x [Strict] [API 2] By Mutor 1/27/08 Requires users to agree to hub policy or be kicked from the hub. -Exemption by profile or nick -Data saved to file(s) for hub/script restart -Option for internal Disclaimer text or external file]]-- Name for Botlocal Bot = SetMan.GetString(21)-- File for validated user nickslocal File = "DisclaimerTable.txt"Exempt = { ["Mutor"] = true, ["YourNick"] = true, }-- File for exempt nickslocal ExFile = "DisclaimerExempt.txt"-- Set your profiles here. [true = Require agreement / false = Exempt]-- [#] = true/falselocal Profiles = { [-1] = true, --Unregistered User [0] = false, --Master [1] = false, --Operator [2] = true, --Vip [3] = true, --Registered User }-- Disclaimer text -OR- Filename [file expected in scripts folder]local Disclaimer = "disclaimer.txt"OnStartup = function() local Path = Core.GetPtokaXPath().."scripts/" if Disclaimer:find("%.%a%a%a$") then if not Disclaimer:find("^"..Path) then Disclaimer = Path..Disclaimer end local f,e = io.open(Disclaimer) if f then Disclaimer = "\n\n"..f:read("*a") end end if not File:find("^"..Path) then File = Path..File end if loadfile(File) then dofile(File) else Pending = {} SaveFile(File,Pending,"Pending") end if not ExFile:find("^"..Path) then ExFile = Path..ExFile end if loadfile(ExFile) then dofile(ExFile) else SaveFile(ExFile,Exempt,"Exempt") endendUserConnected = function(user) if #Disclaimer > 0 and not Exempt[user.sNick] then if Profiles[user.iProfile] and not Pending[user.sNick] then Core.SendToUser(user,"<"..Bot.."> "..Disclaimer.."|") end endendOpConnected,RegConnected = UserConnected,UserConnectedChatArrival = function(user,data) if not Exempt[user.sNick] then if Profiles[user.iProfile] and Core.GetUserValue(user,9) and not Pending[user.sNick]then local _,_,cmd = data:find("^%b<> (["..SetMan.GetString(29).."]agree)|") if cmd then Pending[user.sNick] = {user.sIP,os.date()} SaveFile(File,Pending,"Pending") return Core.SendToUser(user,"<"..Bot.."> Thank you for agreeing to our ".. "policy "..user.sNick..". Welcome to "..SetMan.GetString(0).."|"),true else Core.SendToUser(user,"<"..Bot.."> You indicated that you don't agree with ".. "the hub's policy. Thanks for stopping by "..user.sNick.."|") return Core.Kick(user,Bot,"Disagreement with hub policy.") end end endendToArrival,GetINFOArrival = ChatArrival,ChatArrivalSearchArrival,UnknownArrival = ChatArrival,ChatArrivalConnectToMeArrival,RevConnectToMeArrival,MultiConnectToMeArrival = ChatArrival,ChatArrival,ChatArrivalSaveFile = function(file,table, tablename ) local hFile = io.open (file , "wb") Serialize(table, tablename, hFile) hFile:close() collectgarbage("collect")endSerialize = function(tTable, sTableName, hFile, sTab) sTab = sTab or ""; hFile:write(sTab..sTableName.." = {\n" ) for key, value in pairs(tTable) do local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key) if(type(value) == "table") then Serialize(value, sKey, hFile, sTab.."\t") else local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value) hFile:write( sTab.."\t"..sKey.." = "..sValue) end hFile:write( ",\n") end hFile:write( sTab.."}")end
PxDev == Terms Of EntryWARNING: The owners/admins of this direct connect hub take no responsibility or liability for anything that happens as a result of reading or downloading anything from the users of this hub or anything contained in subsequent message windows.DISCLAIMER: Neither the creators of this Hub nor our Host/ISP are responsible for what you do in this hub or with information recievedwithin. Nothing is illegal the way that it is. This hub is intended to be used for educational and entertainment purposes ONLY! Some of thefiles and links found within may direct you to content that contain questionable material. It is your choice what you do with such content. Your actions may cause you to break the law. If you do decide to download anything through this hub or from it's users make sure that youare the sole owner of a proper license of that software or media and or you have the express written consent of the producers / software company and any related copyright holders.LIABILITY: With respect to files and documents available through this hub, neither Mutor's Archive, nor its creators, make any warranty,express or implied, including the warranties of merchantability and fitness for a particular purpose, or assume any legal liability or responsibilityfor the accuracy, completeness, or usefulness of any information, apparatus, software, media, product, or process disclosed, or representthat its use would not infringe privately owned rights.NOTICE: For controversial reasons, if you are affiliated with any government, ANTI-Piracy group or any other related group, or were formallya worker of one you CANNOT enter this DC hub, cannot access any files via this hub and you cannot view any of content or data. If youenter this site you are not agreeing to these terms and you are violating code 431.322.12 of the Internet Privacy Act and you CANNOTthreaten our ISP(s) or any person(s) or company storing these files, and cannot prosecute any person(s) affiliated with this page which includesfamily,friends or individuals who run or enter this hub.Your actions other than typing ' +agree ' or closing connection to this hub signify, you agree to all terms as stated above, and you affirmthat you are in compliance with all federal, state and local laws concerning the content of this Direct Connect hub..
I have updated the script for the change in path to PtokaX that came after it was written.Do understand that the user must send the agreecommand before they or their client sends anythingelse. This includes Searches or R/CTMS' etc.
--[[ Disclaimer 2.0b LUA 5.1x [Strict] [API 2] By Mutor 1/27/08 Requires users to agree to hub policy or be kicked from the hub. -Exemption by profile or nick -Data saved to file(s) for hub/script restart -Option for internal Disclaimer text or external file +Changes from 2.0 01/26/09 +Added function to stall searches, file xfers etc. for unconfirmed users. +Added 'AgreeCmd' setting, provides custom command option. ->[First command prefix from GUI will be prepended to AgreeCmd]]]-- "Botname" ["" = hub bot]local Bot = ""-- File for validated user nickslocal File = "DisclaimerTable.txt"-- User nick names that are expemt from check, as tableExempt = { ["Mutor"] = true, ["YourNick"] = true, }-- File for exempt nickslocal ExFile = "DisclaimerExempt.txt"-- Set your profiles here. [true = Require agreement / false = Exempt]-- [#] = true/falselocal Profiles = { [-1] = true, --Unregistered User [0] = false, --Master [1] = false, --Operator [2] = true, --Vip [3] = true, --Registered User }-- Disclaimer text -OR- Filename [file expected in scripts folder]local Disclaimer = "disclaimer.txt"-- Required word or phrase that confirms user's agreement with policylocal AgreeCmd = "agree"OnStartup = function() if Bot == "" then Bot = SetMan.GetString(21) end local Path = Core.GetPtokaXPath().."scripts/" if Disclaimer:find("%.%a%a%a$") then if not Disclaimer:find("^"..Path) then Disclaimer = Path..Disclaimer end local f,e = io.open(Disclaimer) if f then Disclaimer = "\n\n"..f:read("*a") end end if not File:find("^"..Path) then File = Path..File end if loadfile(File) then dofile(File) else Pending = {} SaveFile(File,Pending,"Pending") end if not ExFile:find("^"..Path) then ExFile = Path..ExFile end if loadfile(ExFile) then dofile(ExFile) else SaveFile(ExFile,Exempt,"Exempt") endendUserConnected = function(user) if #Disclaimer > 0 and not Exempt[user.sNick] then if Profiles[user.iProfile] and not Pending[user.sNick] then local prompt = "\r\n\r\n\tYou must type "..SetMan.GetString(29):sub(1,1).. AgreeCmd.." to continue using this hub. Typing anything else will cause you".. "to be disconnected from "..SetMan.GetString(0)..".\r\n\r\n" Core.SendToUser(user,"<"..Bot.."> "..Disclaimer..prompt.."|") end endendOpConnected,RegConnected = UserConnected,UserConnectedChatArrival = function(user,data) if not Exempt[user.sNick] then if Profiles[user.iProfile] and Core.GetUserValue(user,9) and not Pending[user.sNick] then local _,_,cmd = data:find("^%b<> (["..SetMan.GetString(29).."]"..AgreeCmd..")|") if cmd then Pending[user.sNick] = {user.sIP,os.date()} SaveFile(File,Pending,"Pending") return Core.SendToUser(user,"<"..Bot.."> Thank you for agreeing to our ".. "policy "..user.sNick..". Welcome to "..SetMan.GetString(0).."|"),true else Core.SendToUser(user,"<"..Bot.."> You indicated that you don't agree with ".. "the hub's policy. Thanks for stopping by "..user.sNick.."|") return Core.Kick(user,Bot,"Disagreement with hub policy.") end end endendStall = function(user,data) if not Pending[user.sNick] then return true endendToArrival,GetINFOArrival,SearchArrival,UnknownArrival,ConnectToMeArrival,RevConnectToMeArrival = Stall,Stall,Stall,Stall,Stall,StallSaveFile = function(file,table, tablename ) local hFile = io.open (file , "wb") Serialize(table, tablename, hFile) hFile:close() collectgarbage("collect")endSerialize = function(tTable, sTableName, hFile, sTab) sTab = sTab or ""; hFile:write(sTab..sTableName.." = {\n" ) for key, value in pairs(tTable) do local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key) if(type(value) == "table") then Serialize(value, sKey, hFile, sTab.."\t") else local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value) hFile:write( sTab.."\t"..sKey.." = "..sValue) end hFile:write( ",\n") end hFile:write( sTab.."}")end
Well what would we do on a no response?I could just ignore the Search & R/CTM requestsuntil that user agrees to policy, if that would help.The intent here [as was originally requested] is thatthe user could not really use any feature of the hubuntil they had physically agreed to the policy. I wouldbe inclined to mod to suit. I see your needs are some-what different than that of the original request.
It was a quick edit.
I assume by your response that it is not possible to put a y/n question to them.
--[[ Disclaimer 2.0c LUA 5.1x [Strict] [API 2] By Mutor 1/27/08 Requires users to agree to hub policy or be kicked from the hub. -Exemption by profile or nick -Data saved to file(s) for hub/script restart -Option for internal Disclaimer text or external file +Changes from 2.0 01/26/09 +Added function to stall searches, file xfers etc. for unconfirmed users. +Added 'AgreeCmd' setting, provides custom command option. ->[First command prefix from GUI will be prepended to AgreeCmd] +Changes from 2.0b 05/23/10 +Added kick on pm -Removed pending table and associated functions.]]-- "Botname" ["" = hub bot]local Bot = ""-- File for validated user nickslocal File = "DisclaimerTable.txt"-- User nick names that are expemt from check, as tableExempt = { ["Mutor"] = true, ["YourNick"] = true, }-- File for exempt nickslocal ExFile = "DisclaimerExempt.txt"-- Set your profiles here. [true = Require agreement / false = Exempt]-- [#] = true/falselocal Profiles = { [-1] = true, --Unregistered User [0] = false, --Master [1] = false, --Operator [2] = true, --Vip [3] = true, --Registered User }-- Disclaimer text -OR- Filename [file expected in scripts folder]local Disclaimer = "disclaimer.txt"-- Required word or phrase that confirms user's agreement with policylocal AgreeCmd = "agree"OnStartup = function() if Bot == "" then Bot = SetMan.GetString(21) end local Path = Core.GetPtokaXPath().."scripts/" if Disclaimer:find("%.%a%a%a$") then if not Disclaimer:find("^"..Path) then Disclaimer = Path..Disclaimer end local f,e = io.open(Disclaimer) if f then Disclaimer = "\n\n"..f:read("*a") end end if not File:find("^"..Path) then File = Path..File end if not ExFile:find("^"..Path) then ExFile = Path..ExFile end if loadfile(ExFile) then dofile(ExFile) else SaveFile(ExFile,Exempt,"Exempt") endendUserConnected = function(user) if Profiles[user.iProfile] and #Disclaimer > 0 and not Exempt[user.sNick] then local prompt = "\r\n\r\n\tYou must type "..SetMan.GetString(29):sub(1,1).. AgreeCmd.." to continue using this hub. Typing anything else will cause you".. "to be disconnected from "..SetMan.GetString(0)..".\r\n\r\n" Core.SendToUser(user,"<"..Bot.."> "..Disclaimer..prompt.."|") endendOpConnected,RegConnected = UserConnected,UserConnectedChatArrival = function(user,data) if not Exempt[user.sNick] and Profiles[user.iProfile] then local _,_,cmd = data:find("%b<> (["..SetMan.GetString(29).."]"..AgreeCmd..")|") if cmd then if not Exempt[user.sNick] then Exempt[user.sNick] = true SaveFile(ExFile,Exempt,"Exempt") end return Core.SendToUser(user,"<"..Bot.."> Thank you for agreeing to our ".. "policy "..user.sNick..". Welcome to "..SetMan.GetString(0).."|"),true else Core.SendToUser(user,"<"..Bot.."> You indicated that you don't agree with ".. "the hub's policy. Thanks for stopping by "..user.sNick.."|") return Core.Kick(user,Bot,"Disagreement with hub policy.") end endendToArrival = ChatArrivalStall = function(user,data) if not Exempt[user.sNick] and Profiles[user.iProfile] then return true endendGetINFOArrival,SearchArrival,UnknownArrival,ConnectToMeArrival,RevConnectToMeArrival = Stall,Stall,Stall,Stall,StallSaveFile = function(file,table, tablename ) local hFile = io.open (file , "wb") Serialize(table, tablename, hFile) hFile:close() collectgarbage("collect")endSerialize = function(tTable, sTableName, hFile, sTab) sTab = sTab or ""; hFile:write(sTab..sTableName.." = {\n" ) for key, value in pairs(tTable) do local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key) if(type(value) == "table") then Serialize(value, sKey, hFile, sTab.."\t") else local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value) hFile:write( sTab.."\t"..sKey.." = "..sValue) end hFile:write( ",\n") end hFile:write( sTab.."}")end
Great script. I have added it in its been over 5 minutes and I still havent got disconnected for not typing !agree