Private hub
 

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

Private hub

Started by TiMeTrAVelleR, 14 August, 2005, 14:21:32

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

TiMeTrAVelleR

Not sure its around  but cant find it

I have a private hub  whit a option when a user connects he can email me   to get regged and join the hub

what i would like is when i reg a new user t(hat i cant check share from ).
a script the tels me that that user commes online

so need message to all ops  new user (nick) has entered hub first time check his share

and option that i can add en delite name


greetzz TT

Madman

#1
--- Reg Online Check
-- Made by Madman
-- Requested by T?M?†r?V?ll?R

-- OBS! Script must be placed above script with the reg command

RegCmd = "regreg" -- Cmd you use to reg with
DelCmd = "delonline" -- Delete user from online check
RegFile = "RegOnline.txt" -- Where to store the Onlinechecks
Bot = frmHub:GetHubBotName() -- Botanme

function Main()
	local file = io.open(RegFile) -- There is a file?
	if file then -- Yes
		file:close() -- Good, close it
	else -- Nope
		local file = io.open(RegFile, "w+") -- Create it
		file:write("tRegged = {\n}") -- Write Table in it
		file:close() -- close it
	end
	frmHub:RegBot(Bot) -- Reg bot
	LoadFromFile(RegFile) -- Load table from file
end

function ChatArrival(curUser, data)
	local data = string.sub(data, 1, -2)
	local s,e,cmd = string.find(data, "%b<>%s+[%!%+%?%#](%S+)")
	if cmd then
		local tCmds = {
		[RegCmd] = function(curUser, data)
			if curUser.bOperator then -- User must be op
				local s,e,Nick = string.find(data, "%b<>%s+%S+%s+(%S+)") -- Get Nick
				if Nick and not frmHub:isNickRegged(Nick) then -- We got Nick and Nick is not regged
					Nick = string.upper(Nick)
					if tRegged[Nick] == nil then -- If Nick not in table
						tRegged[Nick] = {} -- Create
						tRegged[Nick] = curUser.sName -- Add op who regs
						SaveToFile(RegFile, tRegged, "tRegged") -- Save
					else
						tRegged[Nick] = curUser.sName
						SaveToFile(RegFile, tRegged, "tRegged")
					end
				end
			end
		end,
		[DelCmd] = function(curUser, data)
			if curUser.bOperator then
				local s,e,Nick = string.find(data, "%b<>%s+%S+%s+(%S+)") -- Get Nick
				if not Nick then -- No Nick
					curUser:SendData(Bot, "I need a nick to delete from online check") return 1 --- Tell us
				end
				tNick = string.upper(Nick)
				if not tRegged[tNick] then -- Got Nick but Nick was not in table
					curUser:SendData(Bot, Nick.. " was not in online check") return 1
				end
				if tRegged[tNick] then -- Got Nick and was in table
					tRegged[tNick] = nil -- But no more... ;)
					SaveToFile(RegFile, tRegged, "tRegged") -- Save file
					curUser:SendData(Bot, Nick.. " was deleted") return 1 -- Tell us that it was deleted
				end
			end
		end,
		}
		if tCmds[cmd] then
			return tCmds[cmd](curUser, data)
		end
	end
end

function NewUserConnected(curUser)
	Nick = string.upper(curUser.sName)
	if tRegged[Nick] then -- User is in table
		SendPmToOps(Bot, curUser.sName.. " regged by " ..tRegged[Nick].. " just went online for the first time, please check his share") -- Pm Ops
		tRegged[Nick] = nil -- Delte user from table
		SaveToFile(RegFile, tRegged, "tRegged") -- Save to file
	end
end

-- Serialize by nErBoS
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(filename)
	local f = io.open(filename)
	if f then
		local r = f:read("*a")
		f:flush()
		f:close()
		local func,err = loadstring(r)
		if func then x,err = pcall(func) end
	end
end


Not sure... but i think this is what you want...
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

TiMeTrAVelleR

Yes just the way  i wanted it thanks a miljon madman

Greetzzz TT

SMF spam blocked by CleanTalk