Reg Only Main-Chat?
 

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

Reg Only Main-Chat?

Started by D-J Valhala, 26 February, 2005, 20:28:57

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

D-J Valhala

if can be done...
+mainchatreg - ONLY Reg's / ViP's etc... can talk n the main chat
+mainchatpublic - all users can talk in the main chat
;)
My PsyIsrael Network
==================
--=[PsyIsrael DC Hub]=--
--=[PsyIsrael Website]=--
==================

Quattro

I know it's possible in dch++ through a plugin. but for ptokax it should be done with a script dunno how, i'll leave that to the experienced scripters, i'm still learning :P
quattro-place.no-ip.com:1418
PtokaX DC Hub 0.3.3.0 build 17.09 Not Running :(
wdp10.no-ip.info:1412
DCH++ v1.0-Release (Plugin API v1.0) Special Quattro? Build
For DCH scripting and plugins

D-J Valhala

i need a script *.lua hehe no plugins :P
btw i need this bot asap!!! :D
My PsyIsrael Network
==================
--=[PsyIsrael DC Hub]=--
--=[PsyIsrael Website]=--
==================

nErBoS

Hi,

Here you have...

--## MAINCHAT CONTROLER BOT (LUA 4)
--## Requested by D-J Valhala
--## Made by nErBoS
--## Commands:
--##	+mainchatreg 	- Only Regged users can talk in the Main-Chat 
--##	+mainchatpublic	- All users can talk in the MainChat

sBot = "MC-Bot"

arrMC = {["ALL"] = 1}
fMC = "mc.dat"

--## Configuration ##--

uLaterPtokax = 0	-- Choose 0 if you are using a Ptokax version 0.3.3.0 or higher
			-- Choose 1 if you are using a Ptokax version lower then 0.3.3.0

--## END ##--

function Main()
	frmHub:RegBot(sBot)
	LoadFromFile(fMC)
end

function OnExit()
	SaveToFile(fMC,arrMC,"arrMC")
end

function DataArrival(user, data)
	if (user.bOperator and (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot)) then
		data = strsub(data,1,strlen(data)-1)
		local s,e,cmd = strfind(data, "%b<>%s+(%S+)")
		if (cmd == "+mainchatreg") then
			if (arrMC["ALL"] == 0) then
				user:SendPM(sBot, "The Main-Chat is already limited to regged users only.")
			else
				user:SendPM(sBot, "The Main-Chat is now limited only to regged users.")
				SendPmToOps(sBot, "The Main-Chat has been limited only to regged users by: "..user.sName)
				arrMC["ALL"] = 0
				if (uLaterPtokax == 1) then
					OnExit()
				end
			end
			return 1
		elseif (cmd == "+mainchatpublic") then
			if (arrMC["ALL"] == 1) then
				user:SendPM(sBot, "The Main-Chat is already allowed to every user.")
			else
				user:SendPM(sBot, "The Main-Chat is now allowed to every user.")
				SendPmToOps(sBot, "The Main-Chat has been allowed to every user by: "..user.sName)
				arrMC["ALL"] = 1
				if (uLaterPtokax == 1) then
					OnExit()
				end
			end
			return 1
		end
	end
	if (strsub(data,1,1) == "<" and arrMC["ALL"] == 0 and user.Profile == -1) then
		user:SendData(sBot, "You are not allowed to talk in the Main-Chat.")
		return 1
	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 format("[%q]",key) or format("[%d]",key);

                if(type(value) == "table") then
                        sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
                else
                        local sValue = (type(value) == "string") and 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)
        writeto(file)
        write(Serialize(table, tablename))
        writeto()
end

function LoadFromFile(file)
        if (readfrom(file) ~= nil) then
                readfrom(file)
                dostring(read("*all"))
                readfrom()
        end
end

Best regards, nErBoS
--## nErBoS Spot ##--

D-J Valhala

hehehe 10x alot my HubScripter :D:D:D
My PsyIsrael Network
==================
--=[PsyIsrael DC Hub]=--
--=[PsyIsrael Website]=--
==================

D-J Valhala

--## MAINCHAT CONTROLER BOT (LUA 4)
--## Requested by D-J Valhala
--## Made by nErBoS
--## Commands:
--##	+mainchatreg 	- Only Regged users can talk in the Main-Chat 
--##	+mainchatpublic	- All users can talk in the MainChat

sBot = "-PsYiBot-"

arrMC = {["ALL"] = 1}
fMC = "mc.dat"

--## Configuration ##--

uLaterPtokax = 0	-- Choose 0 if you are using a Ptokax version 0.3.3.0 or higher
			-- Choose 1 if you are using a Ptokax version lower then 0.3.3.0

--## END ##--

function Main()
	frmHub:RegBot(sBot)
	LoadFromFile(fMC)
end

function OnExit()
	SaveToFile(fMC,arrMC,"arrMC")
end

function DataArrival(user, data)
	if (user.iProfile == 0 and (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot)) then
		data = strsub(data,1,strlen(data)-1)
		local s,e,cmd = strfind(data, "%b<>%s+(%S+)")
		if (cmd == "+privatemain") then
			if (arrMC["ALL"] == 0) then
				user:SendData(sBot, "The Main-Chat is already limited to regged users only.")
			else
				user:SendData(sBot, "The Main-Chat is now limited only to regged users.")
				SendPmToOps(sBot, "The Main-Chat has been limited only to regged users by: "..user.sName)
				arrMC["ALL"] = 0
				if (uLaterPtokax == 1) then
					OnExit()
				end
			end
			return 0
		elseif (cmd == "+publicmain") then
			if (arrMC["ALL"] == 1) then
				user:SendData(sBot, "The Main-Chat is already allowed to every user.")
			else
				user:SendData(sBot, "The Main-Chat is now allowed to every user.")
				SendPmToOps(sBot, "The Main-Chat has been allowed to every user by: "..user.sName)
				arrMC["ALL"] = 1
				if (uLaterPtokax == 1) then
					OnExit()
				end
			end
			return 0
		end
	end
	if (strsub(data,1,1) == "<" and arrMC["ALL"] == 0 and user.Profile == -1) then
		user:SendData(sBot, "You are not allowed to talk in the Main-Chat.")
		return 1
	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 format("[%q]",key) or format("[%d]",key);

                if(type(value) == "table") then
                        sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
                else
                        local sValue = (type(value) == "string") and 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)
        writeto(file)
        write(Serialize(table, tablename))
        writeto()
end

function LoadFromFile(file)
        if (readfrom(file) ~= nil) then
                readfrom(file)
                dostring(read("*all"))
                readfrom()
        end
end

don't work :|
My PsyIsrael Network
==================
--=[PsyIsrael DC Hub]=--
--=[PsyIsrael Website]=--
==================

nErBoS

Hi,

Sorry forgot the "i" in "user.iProfile", here you have...

--## MAINCHAT CONTROLER BOT (LUA 4)
--## Requested by D-J Valhala
--## Made by nErBoS
--## Commands:
--##	+privatemain 	- Only Regged users can talk in the Main-Chat 
--##	+publicmain	- All users can talk in the MainChat

sBot = "-PsYiBot-"

arrMC = {["ALL"] = 1}
fMC = "mc.dat"

--## Configuration ##--

uLaterPtokax = 0	-- Choose 0 if you are using a Ptokax version 0.3.3.0 or higher
			-- Choose 1 if you are using a Ptokax version lower then 0.3.3.0

--## END ##--

function Main()
	frmHub:RegBot(sBot)
	LoadFromFile(fMC)
end

function OnExit()
	SaveToFile(fMC,arrMC,"arrMC")
end

function DataArrival(user, data)
	if (user.iProfile == 0 and (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot)) then
		data = strsub(data,1,strlen(data)-1)
		local s,e,cmd = strfind(data, "%b<>%s+(%S+)")
		if (cmd == "+privatemain") then
			if (arrMC["ALL"] == 0) then
				user:SendData(sBot, "The Main-Chat is already limited to regged users only.")
			else
				user:SendData(sBot, "The Main-Chat is now limited only to regged users.")
				SendPmToOps(sBot, "The Main-Chat has been limited only to regged users by: "..user.sName)
				arrMC["ALL"] = 0
				if (uLaterPtokax == 1) then
					OnExit()
				end
			end
			return 0
		elseif (cmd == "+publicmain") then
			if (arrMC["ALL"] == 1) then
				user:SendData(sBot, "The Main-Chat is already allowed to every user.")
			else
				user:SendData(sBot, "The Main-Chat is now allowed to every user.")
				SendPmToOps(sBot, "The Main-Chat has been allowed to every user by: "..user.sName)
				arrMC["ALL"] = 1
				if (uLaterPtokax == 1) then
					OnExit()
				end
			end
			return 0
		end
	end
	if (strsub(data,1,1) == "<" and arrMC["ALL"] == 0 and user.iProfile == -1) then
		user:SendData(sBot, "You are not allowed to talk in the Main-Chat.")
		return 1
	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 format("[%q]",key) or format("[%d]",key);

                if(type(value) == "table") then
                        sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
                else
                        local sValue = (type(value) == "string") and 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)
        writeto(file)
        write(Serialize(table, tablename))
        writeto()
end

function LoadFromFile(file)
        if (readfrom(file) ~= nil) then
                readfrom(file)
                dostring(read("*all"))
                readfrom()
        end
end

Best regards, nErBoS
--## nErBoS Spot ##--

D-J Valhala

script don't work m8
My PsyIsrael Network
==================
--=[PsyIsrael DC Hub]=--
--=[PsyIsrael Website]=--
==================

SMF spam blocked by CleanTalk