Enable.Disable Registered User
 

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

Enable.Disable Registered User

Started by 6Marilyn6Manson6, 21 May, 2005, 09:17:27

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

6Marilyn6Manson6

Hello.. i request script with 2 commands:


!regdisable            Disable a user's registration, but he can be re-enabled later. You should use this if you only want to punish a user for example.
!regenable              Enable a user's registration, when he was previously disabled with !regdisable


ps: i want it in LUA 4 and LUA 5.. double script :P .. thanks bye bye

[NL]Pur

why not just nickban the registered user, you whould get the same without the all the overhead caused by   tracking of disabled users.

Dessamator

--Reg Account manager v1
--By Dessamator
--Request By Marylin Manson(or something like it)
--Commands :	!regenable	-- to enable an account
--		!regdisable	-- to disable an account	
--		!regstatus	-- to see disabled account

tReg = {}
file ="accounts.dat"

--Config
bot =frmHub:GetHubBotName()	-- Bot name
--

function Main()
	LoadFromFile(file)
end


function ChatArrival(user,data)
data=string.sub(data, 1,-2)
s,e,cmd,usr=string.find(data,"%b<>%s+(%S+)%s+(%S+)")
	if cmd=="!regdisable" and not(tReg[usr]) then
		tReg[usr] = 1
		user:SendData(bot,usr.." has been disabled!")
		return 1	
	elseif cmd=="!regenable" and (tReg[usr]) then
		tReg[usr] =nil
		user:SendData(bot,usr.." has been enabled!")
		return 1
	end
	s,e,cmd,usr=string.find(data,"%b<>%s+(%S+)")
	if cmd=="!regstatus" then
		temp="\r\n\These are the disabled accounts :\r\n"
		for usr,pos in tReg do
			temp=temp.."\t\Nick :"..usr.."\r\n"
		end
		user:SendData(bot,temp)
	end
end 

function OnExit()
	SaveToFile(file, tReg,"tReg")
end


function ValidateNickArrival(User, Data)
	for usr,pos in tReg do
		if User.sName == usr then
			User:SendData(bot,"Your account has been disabled!")
			DisconnectByName(User.sName)
		return 1
		end
	end
end

function Serialize(tTable, sTableName, sTab)
        assert(tTable, "tTable equals nil");
        assert(sTableName, "sTableName equals nil");

        assert(type(tTable) == "table", "tTable must be a table!");
        assert(type(sTableName) == "string", "sTableName must be a string!");

        sTab = sTab or "";
        sTmp = ""

        sTmp = sTmp..sTab..sTableName.." = {\n"

        for key, value in tTable do
                local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key);

                if(type(value) == "table") then
                        sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
                else
                        local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value);
                        sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
                end

                sTmp = sTmp..",\n"
        end

        sTmp = sTmp..sTab.."}"
        return sTmp
end

function SaveToFile(file , table , tablename)
	local handle = io.open(file,"w+")
        handle:write(Serialize(table, tablename))
	handle:flush()
        handle:close()
end

function LoadFromFile(file)
local handle = io.open(file,"r")
        if (handle ~= nil) then
                dofile(file)
handle:flush()
handle:close()
        end

end


or use pur's idea :)
Ignorance is Bliss.

6Marilyn6Manson6

Thanks [NL]Pur ... thanks Dessemator... but i want a small upgrade :P ... Can you add command:

!disableprofile X   -- For disability all registered user of single level

example:

!disableprofile 0 -- disability all master registration
!disableprofile 1 -- disability all operator registration




and command:

!enableprofile X   -- For enable all registered user of single level

example:

!enableprofile 0 -- enable all master registration
!enableprofile 1 -- enable all operator registration

thanks a lot :)

Dessamator

--Account manager v1.1
--By Dessamator
--Request By Marylin Manson(or something like it)
--Commands :	!regenable	-- to enable an account
--		!regdisable	-- to disable an account	
--		!regstatus	-- to see disabled account
--		!disableprofile	-- to disable an account
--		!enableprofile	-- to enable an account	
--		!dprofiles	-- to see disabled account

tReg = {}
tProfiles = {}
file ="accounts.dat"
file1="profiles.dat"

--Config
bot =frmHub:GetHubBotName()	-- Bot name
--

function Main()
	LoadFromFile(file)
	LoadFromFile(file1)
end


function ChatArrival(user,data)
data=string.sub(data, 1,-2)
s,e,cmd,usr=string.find(data,"%b<>%s+(%S+)%s+(%S+)")
	if cmd=="!regdisable" and not(tReg[usr]) then
		tReg[usr] = 1
		user:SendData(bot,usr.." has been disabled!")
		return 1	
	elseif cmd=="!regenable" and (tReg[usr]) then
		tReg[usr] =nil
		user:SendData(bot,usr.." has been enabled!")
		return 1
	elseif cmd=="!disableprofile" and tonumber(usr) then
		tProfiles[usr] = 1
		user:SendData(bot,GetProfileName(usr).." Profile has been disabled!")
		return 1
	elseif cmd=="!enableprofile" and tonumber(usr) then 
		tProfiles[usr] = nil 
		user:SendData(bot,GetProfileName(usr).." Profile has been enabled!")
		return 1
	
	end
	s,e,cmd,usr=string.find(data,"%b<>%s+(%S+)")
	if cmd=="!regstatus" then
		local temp="\r\n\These are the disabled accounts :\r\n"
		for tUser,pos in tReg do
			temp=temp.."\t\Nick :"..tUser.."\r\n"
		end
		user:SendData(bot,temp)
	elseif cmd=="!dprofiles" then
		local temp="\r\n\These are the disabled Profiles :\r\n"
		for profile,pos in tProfiles do
			temp=temp.."\t\Profile : "..GetProfileName(profile).."\r\n"
		end
		user:SendData(bot,temp)
	end
end 

function OnExit()
	SaveToFile(file, tReg,"tReg")
	SaveToFile(file1, tProfiles,"tProfiles")
end


function ValidateNickArrival(User, Data)
	for usr,pos in tReg do
		if User.sName == usr then
			User:SendData(bot,"Your account has been disabled!")
			DisconnectByName(User.sName)
		return 1
		end
	end
	for profile,pos in tProfiles do 
		if User.iProfile == tonumber(profile) then
			User:SendData(bot,"Your Profile has been disabled!")
			DisconnectByName(User.sName)
		end
	end
end


function Serialize(tTable, sTableName, sTab)
        assert(tTable, "tTable equals nil");
        assert(sTableName, "sTableName equals nil");

        assert(type(tTable) == "table", "tTable must be a table!");
        assert(type(sTableName) == "string", "sTableName must be a string!");

        sTab = sTab or "";
        sTmp = ""

        sTmp = sTmp..sTab..sTableName.." = {\n"

        for key, value in tTable do
                local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key);

                if(type(value) == "table") then
                        sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
                else
                        local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value);
                        sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
                end

                sTmp = sTmp..",\n"
        end

        sTmp = sTmp..sTab.."}"
        return sTmp
end

function SaveToFile(file , table , tablename)
	local handle = io.open(file,"w+")
        handle:write(Serialize(table, tablename))
	handle:flush()
        handle:close()
end

function LoadFromFile(file)
local handle = io.open(file,"r")
        if (handle ~= nil) then
                dofile(file)
handle:flush()
handle:close()
        end

end


Done !
Ignorance is Bliss.

6Marilyn6Manson6


Dessamator

QuoteOriginally posted by 6Marilyn6Manson6
Very THANKS

ur welcome  :))
Ignorance is Bliss.

SMF spam blocked by CleanTalk