Sign in to follow this  
Followers 0
bigcanuck

For Hungarista

17 posts in this topic

I will do it as soon as possible, but as I see I have to completly rewrite it, it wasn't made by a LUA scripter :) If I will finish it, I will inform you here.

Share this post


Link to post
Share on other sites

As far as I remember, you may attach files to PM too.

Share this post


Link to post
Share on other sites

As far as I remember, you may attach files to PM too.

I had thought so too but I honestly couldn't see the option...

Share this post


Link to post
Share on other sites

Ohh, men :) This script is the strangest one what I've ever seen... Half of the script is out of use. Try to use 2-3 different scripts instead of this. Check this page

Share this post


Link to post
Share on other sites

--OFF

Ohh, men :) This script is the strangest one what I've ever seen... Half of the script is out of use. Try to use 2-3 different scripts instead of this. Check this page

Your avatar agrees with you! :D

--OFF

Share this post


Link to post
Share on other sites

Ohh, men :) This script is the strangest one what I've ever seen... Half of the script is out of use. Try to use 2-3 different scripts instead of this. Check this page

Hehe ya... it was kinda weird when I 1st got to look at it, truely the only things we *need* from that script are the regpending commands, which broke when we went from Lua4 to Lua5.1, and The show commands (which is just a way of showing everyone the recently added files :D ) I think I found a few scripts that should work, is there any you recommend though?

Edit:: I assume this means too it's not worth rewriting?

edit Two I no longer need teh show command (the add file system).. but if you could tell me how to get the regpending and show regpending commands going only even if it's in a whole new file but basically its a web reg system and we'd really like to have it... umm I know those two broke for sure with the upgrade to 5.1

Share this post


Link to post
Share on other sites

edit Two I no longer need teh show command (the add file system).. but if you could tell me how to get the regpending and show regpending commands going only even if it's in a whole new file but basically its a web reg system and we'd really like to have it... umm I know those two broke for sure with the upgrade to 5.1

Please explain me more the regpending stuff. What is it doing exactly? There is no impossible, if I know what should I do :) The web-based register system... :) Maybe. PtokaX has inbuild webserver, somebody just have to wrote the php or html page - I will try it, maybe, but I never did any kind of webpage :D

Share this post


Link to post
Share on other sites

Please explain me more the regpending stuff. What is it doing exactly? There is no impossible, if I know what should I do :) The web-based register system... :) Maybe. PtokaX has inbuild webserver, somebody just have to wrote the php or html page - I will try it, maybe, but I never did any kind of webpage :D

ok so in the rukus folder there is a list.dat file this file takes input from the website (you don't have to worry about that that part works and is seperate) now in rukus.lua there is the command showpending which looks in list.dat to see if anyone needs to be registered.

so a registered user looks like this in list.dat::

:!:[uvic]username:!:password:!:email@somedomain.com:!:1:!:

while unregistered look like this::

:!:[uvic]username:!:password:!:email@somedomain.com:!:0:!:

*the 1 signifies registered 0 not registered*

then when an op user the command !showrepending it list all unregistered users in the file

if there are unregistered users the op then uses the command ::

!regpending # (if they only want to reg a specific person)

or

!regpending 411 (to reg all unregistered users)

so regpending must loop through using the !addreguser username password reg command with fields completed as nessary

and then save to list.dat so that it shows as registered.

I think that's all you need to know if you need more let me know :)

Share this post


Link to post
Share on other sites

The script is almost ready, just a question. Registered and unregistered users are in the file, why? It's a webserver-made file, somebody want to register himself/herself on the hub. So it's sure, he isn't registered on the hub. Maybe his/her nickname is already registered by an another user, but the webpage have to inform the user about it. I think many unregistered users in the file, and if an operator use !regpending # or 411 then that line will be removed from the file, thats all. This is what the script is doing now :D

Ps. Could you send me the web-page which generate this file? I wanna upgrade it.

Share this post


Link to post
Share on other sites

The script is almost ready, just a question. Registered and unregistered users are in the file, why? It's a webserver-made file, somebody want to register himself/herself on the hub. So it's sure, he isn't registered on the hub. Maybe his/her nickname is already registered by an another user, but the webpage have to inform the user about it. I think many unregistered users in the file, and if an operator use !regpending # or 411 then that line will be removed from the file, thats all. This is what the script is doing now :)

Ps. Could you send me the web-page which generate this file? I wanna upgrade it.

Here you go :)

AutoReg.rar

Share this post


Link to post
Share on other sites

Firstly, sorry for my great lag :) I had two exams on Monday, and today I had to do the PtokaX translation. Now I am ready with it, but you didn't anser to my questions posted above... So I did it as I thought, you have to try and debug it. It do all things you explained, maybe bugless :)

sBot = frmHub:GetHubBotName()

iClass = 3 -- In which class you want to register users? In base settings 3 is the registered users.

function Main()

	local file = io.open(string.gsub(frmHub:GetPtokaXLocation(),"/","\\").."scripts\\rukus\\list.dat","r")

	if file then

		file:close()

		LoadDatabase()

	else

		tPendingUsers = {}

	end

end


function ChatArrival(curUser,data)

	if curUser.bOperator then

		local _,_,cmd,param = string.find(data,"%b<>%s*%p*(%S+)%s*(.*)|")

		if cmd then

			if cmd == "showpending" then

				LoadDatabase()

				if #tPendingUsers > 0 then

					local msg = "\n\t----------------   Pending: "..#tPendingUsers.." \t----------------\r\n\r\n"..

					"\tNumber:\tNickname:\t\tPassword:\tEmail:\r\n"

					for i,v in ipairs(tPendingUsers) do

						msg = msg.."\t["..i.."] \t"..v["sNick"].."\t\t"..v["sPass"].."\t\t"..v["sEmail"].."\r\n"

					end

					curUser:SendPM(sBot,msg)

				else

					curUser:SendPM(sBot,"The list is empty.")

				end

				return 1

			elseif cmd == "regpending" then

				if type(tonumber(param)) == "number" then

					param = tonumber(param)

					if param <= #tPendingUsers then

						if not frmHub:isNickRegged(tPendingUsers[param]["sNick"]) then

							AddRegUser(tPendingUsers[param]["sNick"],tPendingUsers[param]["sPass"],iClass)

							curUser:SendData(sBot,tPendingUsers[param]["sNick"].." has been succesfully registered as "..GetProfileName(iClass))

							tPendingUsers[param] = nil

							SaveDatabase()

						else

							curUser:SendData(sBot,tPendingUsers[param]["sNick"].." is already registered user.")

						end

					elseif param == 411 then

						local tReggedUsers = {}

						for i,v in ipairs(tPendingUsers) do

							if not frmHub:isNickRegged(v["sNick"]) then

								AddRegUser(v["sNick"],v["sPass"],iClass)

							else

								table.insert(tReggedUsers,v["sNick"])

							end

						end

						if (#tPendingUsers - #tReggedUsers) == 0 then

							curUser:SendData(sBot,"No users have been registered. (Maybe they are all still registered?)")

						elseif (#tPendingUsers - #tReggedUsers) ~= #tPendingUsers then

							curUser:SendData(sBot,(#tPendingUsers - #tReggedUsers).." users have been registered as "..GetProfileName(iClass))

						else

							curUser:SendData(sBot,"All users have been registered as "..GetProfileName(iClass))

						end

						tPendingUsers = {}

						io.open(string.gsub(frmHub:GetPtokaXLocation(),"/","\\").."scripts\\rukus\\list.dat","w+")

					else

						curUser:SendData(sBot,"There is no index "..param..". Check your syntax.")

					end

				else

					curUser:SendData(sBot,"Use just numbers! Use 411 to register all pending users.")

				end

				return 1

			elseif cmd == "delpending" then

				if type(tonumber(param)) == "number" then

					param = tonumber(param)

					if param <= #tPendingUsers then

						table.remove(tPendingUsers,param)

						SaveDatabase()

						LoadDatabase()

						curUser:SendData(sBot,"User with index "..param.." has been successfully deleted.")

					else

						curUser:SendData(sBot,"There is no index "..param..". Check your syntax.")

					end

				else

					curUser:SendData(sBot,"Use just numbers! Use 411 to register all pending users.")

				end

				return 1

			end

		end

	end

end


function ToArrival(curUser,sData)

	if curUser.bOperator then

		local _,_, nickto = string.find(sData, "^%$To:%s(%S+)%s")

		if nickto == sBot then

			ChatArrival(curUser,sData)

		end

	end

end


function LoadDatabase()

	tPendingUsers = {}

	for line in io.lines(string.gsub(frmHub:GetPtokaXLocation(),"/","\\").."\\scripts\\rukus\\list.dat") do

		local _,_,sNick,sPass,sEmail,bIsReg = string.find(line, "^:!:(.*):!:(.*):!:(.*):!:(.*):!:$")

		local sName = {["sNick"] = sNick, ["sPass"] = sPass, ["sEmail"] = sEmail, ["bIsReg"] = bIsReg,}

		table.insert(tPendingUsers,sName)

	end

end


function SaveDatabase()

	local file = io.open(string.gsub(frmHub:GetPtokaXLocation(),"/","\\").."\\scripts\\rukus\\list.dat","w+")

	for i,v in ipairs(tPendingUsers) do

		file:write(":!:"..v["sNick"]..":!:"..v["sPass"]..":!:"..v["sEmail"]..":!:0:!:\r\n")

	end

	file:close()

end

If something isn't in it, or works another way as you except, please tell it me.

Commands works in main and private too, commands are what you requested.

Share this post


Link to post
Share on other sites

If something isn't in it, or works another way as you except, please tell it me.

Commands works in main and private too, commands are what you requested.

Thanks so much. The only thing that doesn't quite work as expected is when I do -show regpending it shows that the whole file. instead of the ones whom haven't been processed yet. I think... I'll be able to figure that out.... I dunno so but I'll tell you what it should be doing when showpending is run. Showpending takes all the user entires that have a 0 in them and shows only them. Then when we go to reg them it saves them to the file with a 1 instead (to signify they have registered) other then that it works great, so thank you very much and don't worry about the lag I understand :) I have my own exams apporaching as well. Thanks again and I think I'll be able to fix it from what you have to what we need it to do :). Thanks

Share this post


Link to post
Share on other sites

So, in that file there are the all registered and unregistered users? Then I have to pout just an another array into it, when an operator register a user, put one user to another array, and save & load the two array. I hope now I understand well :)

Share this post


Link to post
Share on other sites

So, in that file there are the all registered and unregistered users? Then I have to pout just an another array into it, when an operator register a user, put one user to another array, and save & load the two array. I hope now I understand well :)

Yes all registered and unregistered

Share this post


Link to post
Share on other sites

Next version

sBot = frmHub:GetHubBotName()

iClass = 3

function Main()

	local file = io.open(string.gsub(frmHub:GetPtokaXLocation(),"/","\\").."scripts\\rukus\\list.dat","r")

	if file then

		file:close()

		LoadDatabase()

	else

		tPendingUsers = {}

	end

end


function ChatArrival(curUser,data)

	if curUser.bOperator then

		local _,_,cmd,param = string.find(data,"%b<>%s*%p*(%S+)%s*(.*)|")

		if cmd then

			if cmd == "showpending" then

				LoadDatabase()

				if #tPendingUsers > 0 then

					local msg = "\n\t----------------   Pending: "..#tPendingUsers.." \t----------------\r\n\r\n"..

					"\tNumber:\tNickname:\t\tPassword:\tEmail:\r\n"

					for i,v in ipairs(tPendingUsers) do

						msg = msg.."\t["..i.."] \t"..v["sNick"].."\t\t"..v["sPass"].."\t\t"..v["sEmail"].."\r\n"

					end

					curUser:SendPM(sBot,msg)

				else

					curUser:SendPM(sBot,"The list is empty.")

				end

				return 1

			elseif cmd == "regpending" then

				if type(tonumber(param)) == "number" then

					param = tonumber(param)

					if param <= #tPendingUsers then

						if not frmHub:isNickRegged(tPendingUsers[param]["sNick"]) then

							AddRegUser(tPendingUsers[param]["sNick"],tPendingUsers[param]["sPass"],iClass)

							curUser:SendData(sBot,tPendingUsers[param]["sNick"].." has been succesfully registered as "..GetProfileName(iClass))

							table.insert(tRegisteredUsers,tPendingUsers[param])

							table.remove(tPendingUsers,param)

							SaveDatabase()

						else

							curUser:SendData(sBot,tPendingUsers[param]["sNick"].." is already registered user.")

						end

					elseif param == 411 then

						local tReggedUsers = {}

						for i,v in ipairs(tPendingUsers) do

							table.insert(tRegisteredUsers,tPendingUsers[i])

							if not frmHub:isNickRegged(v["sNick"]) then

								AddRegUser(v["sNick"],v["sPass"],iClass)

							else

								table.insert(tReggedUsers,v["sNick"])

							end

						end

						if (#tPendingUsers - #tReggedUsers) == 0 then

							curUser:SendData(sBot,"No users have been registered. (Maybe they are all still registered?)")

						elseif (#tPendingUsers - #tReggedUsers) ~= #tPendingUsers then

							curUser:SendData(sBot,(#tPendingUsers - #tReggedUsers).." users have been registered as "..GetProfileName(iClass))

						else

							curUser:SendData(sBot,"All users have been registered as "..GetProfileName(iClass))

						end

						tPendingUsers = {}

						SaveDatabase()

						LoadDatabase()

					else

						curUser:SendData(sBot,"There is no index "..param..". Check your syntax.")

					end

				else

					curUser:SendData(sBot,"Use just numbers! Use 411 to register all pending users.")

				end

				return 1

			elseif cmd == "delpending" then

				if type(tonumber(param)) == "number" then

					param = tonumber(param)

					if param <= #tPendingUsers then

						table.remove(tPendingUsers,param)

						SaveDatabase()

						LoadDatabase()

						curUser:SendData(sBot,"User with index "..param.." has been successfully deleted.")

					else

						curUser:SendData(sBot,"There is no index "..param..". Check your syntax.")

					end

				else

					curUser:SendData(sBot,"Use just numbers! Use 411 to register all pending users.")

				end

				return 1

			end

		end

	end

end


function ToArrival(curUser,sData)

	if curUser.bOperator then

		local _,_, nickto = string.find(sData, "^%$To:%s(%S+)%s")

		if nickto == sBot then

			ChatArrival(curUser,sData)

		end

	end

end


function LoadDatabase()

	tPendingUsers = {}

	tRegisteredUsers = {}

	for line in io.lines(string.gsub(frmHub:GetPtokaXLocation(),"/","\\").."\\scripts\\rukus\\list.dat") do

		local _,_,sNick,sPass,sEmail,bIsReg = string.find(line, "^:!:(.*):!:(.*):!:(.*):!:(.*):!:$")

		local sName = {["sNick"] = sNick, ["sPass"] = sPass, ["sEmail"] = sEmail,}

		if tonumber(bIsReg) == 0 then

			table.insert(tPendingUsers,sName)

		else

			table.insert(tRegisteredUsers,sName)

		end

	end

end


function SaveDatabase()

	local file = io.open(string.gsub(frmHub:GetPtokaXLocation(),"/","\\").."\\scripts\\rukus\\list.dat","w+")

	for i,v in ipairs(tPendingUsers) do

		file:write(":!:"..v["sNick"]..":!:"..v["sPass"]..":!:"..v["sEmail"]..":!:0:!:\r\n")

	end

	for i,v in ipairs(tRegisteredUsers) do

		file:write(":!:"..v["sNick"]..":!:"..v["sPass"]..":!:"..v["sEmail"]..":!:1:!:\r\n")

	end

	file:close()

end

Share this post


Link to post
Share on other sites

Next version

:) Works perfectly. Thanks ever so much I owe you one :)

Share this post


Link to post
Share on other sites
Sign in to follow this  
Followers 0