User/Profile Account manager v1.1
 

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

User/Profile Account manager v1.1

Started by Dessamator, 21 May, 2005, 16:22:30

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dessamator

--User/Profile Account manager v1.1
--By Dessamator
--Request By 6Marilyn6Manson6(or something like it)
--Commands :	!regenable	-- to enable an account
--		!regdisable	-- to disable an account	
--		!regstatus	-- to see disabled account
--		!disableprofile	-- to disable a profile
--		!enableprofile	-- to enable a profile	
--		!dprofiles	-- to see disabled profiles

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 user.bOperator then
		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
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
Ignorance is Bliss.

6Marilyn6Manson6

Change:
--Request By Marylin Manson(or something like it)

to:

--Request By 6Marilyn6Manson6(or something like it)

hihihi now comment is correct :P LooooooooL

Dessamator

Ignorance is Bliss.

6Marilyn6Manson6


TommyGun

Works perfect! Thanks
My computer specifications :: http://tweakers.net/gallery/sys/9478

Dessamator

QuoteOriginally posted by TommyGun
Works perfect! Thanks
ur welcome !
Ignorance is Bliss.

XPMAN

I have tried this script ( which is very kool  :)  ) . But it seems that ANY profile has the ability to do this instead of just MASTERS  and Ops. I tested it several times before posting, Reg members can use the commands as well as MASTERS. Is there something maybe I can change in the script so as only MASTERS and Ops have these rights?

Dessamator

QuoteOriginally posted by XPMAN
I have tried this script ( which is very kool  :)  ) . But it seems that ANY profile has the ability to do this instead of just MASTERS  and Ops. I tested it several times before posting, Reg members can use the commands as well as MASTERS. Is there something maybe I can change in the script so as only MASTERS and Ops have these rights?
lol, i did it intentionally , to help others learn, well to add that
just edit the code like this ::

function ChatArrival(user,data)
data=string.sub(data, 1,-2)
s,e,cmd,usr=string.find(data,"%b<>%s+(%S+)%s+(%S+)")
[COLOR=blue]if user.bOperator the[/COLOR] n
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)
[COLOR=blue]end[/COLOR] 
end
end


and add those lines in blue !
Ignorance is Bliss.

XPMAN

Meanie...............  :D

Dessamator

QuoteOriginally posted by XPMAN
Meanie...............  :D
indeed,  ;)
Ignorance is Bliss.

sneaky

works fine! nice script it possible to make right click menu for this script with this commands???

--Commands :   !regenable   -- to enable an account

--      !regdisable   -- to disable an account   

--      !regstatus   -- to see disabled account

--      !disableprofile   -- to disable a profile

--      !enableprofile   -- to enable a profile   

--      !dprofiles   -- to see disabled profiles


thx anyway :)

Dessamator

well, u can do it urself , check the lua5 right click howto, if u still cant after trying that, some1 will make it for u
Ignorance is Bliss.

sneaky

Done! works fine for me :))  

--User/Profile Account manager v1.1

--By Dessamator

--Add Right Click Menu By Sneaky

--Request By 6Marilyn6Manson6(or something like it)

--Commands :   !regenable   -- to enable an account

--      !regdisable   -- to disable an account   

--      !regstatus   -- to see disabled account

--      !disableprofile   -- to disable a profile

--      !enableprofile   -- to enable a profile   

--      !dprofiles   -- to see disabled profiles



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 user.bOperator then

      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

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

function OpConnected(curUser)
if curUser.bUserCommand then
 curUser:SendData("$UserCommand 1 3 Profile Account\\Enable An Account$<%[mynick]> !regenable %[line:Account]|")
 curUser:SendData("$UserCommand 1 3 Profile Account\\Disable An Account$<%[mynick]> !regdisable %[line:Account]|")
 curUser:SendData("$UserCommand 1 3 Profile Account\\See Disabled Account$<%[mynick]> !regstatus|")
 curUser:SendData("$UserCommand 1 3 Profile Account\\Disable A Profile$<%[mynick]> !disableprofile %[line:Profile]|")
 curUser:SendData("$UserCommand 1 3 Profile Account\\Enable A Profile$<%[mynick]> !enableprofile %[line:Profile]|")
 curUser:SendData("$UserCommand 1 3 Profile Account\\See Disabled Profiles$<%[mynick]> !dprofiles|")
 
     end
end

Dessamator

Ignorance is Bliss.

SMF spam blocked by CleanTalk