SetRedirect ON/OFF
 

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

SetRedirect ON/OFF

Started by 6Marilyn6Manson6, 13 September, 2004, 20:24:17

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

6Marilyn6Manson6

Ehy hallo. I need a bot with these two commands: !setredirect
where i can set the redirect hub for full or limits,  and  !redirect where i can set on or off the redirect for hub full, thanks at all [only for MASTER]!!! BYE BYE

bastya_elvtars

#1
-- Redirect Bot by bastya_elvtars (the rock n' roll doctor)
-- written for 6Marilyn6Manson6
-- usual: cmds can be main or in PM
-- set if u want the bot in userlist or not
-- cmds can be customised
-- only MASTER profile can use it
-- based on channelbot 0.9h by Nathanos

cmd1="!chred" -- changing default redir addy

cmd2="!setredirectall" -- setting redirect all newly coming users (on/off)

cmd3="!setredirectfull" -- setting redirect all when hub full (on/off)

Bot="RedirectBot" -- no need 2 explain

BotInUserList=1 -- set to 1 if u wanna see bot in userlist

function Main()
	if BotInUserList==1 then
		frmHub:RegBot(Bot)
	end
end

-- dont edit below

function ChRed(user, data,env)
	if user.iProfile==0 then
		local _,_,newaddy=strfind(data,"%b<>%s+%S+%s+(%S+)")
		if newaddy then
			frmHub:SetRedirectAddress(newaddy) 
			SendToOps(Bot, user.sName.." changed the hub redirect address to: "..newaddy.." |")
			user:SendData(parseenv(user,env,Bot).."You changed the hub redirect address to: "..newaddy.." |")
		else
			user:SendData(parseenv(user,env,Bot).. "It would be so nice to type the redirect address, don't  you think? |")
		end
	else
		user:SendData(parseenv(user,env,Bot).."You do not have sufficient rights to run that command! |")
	end
end 

function SetRedirectAll(user, data,env)
if user.iProfile==0 then
	local _,_,arg=strfind(data,"%b<>%s+%S+%s+(%S+)")
	if arg ~= nil then
		if (arg=="on") then 
			frmHub:SetRedirectFull(0)
			frmHub:SetRedirectAll(1) 
			SendToOps(Bot, user.sName.." changed the redirect all new connections to: "..arg.." |")
			user:SendData(parseenv(user,env,Bot).."You changed the redirect all new connections to: "..arg.." |")
			elseif (arg=="off") then 
				frmHub:SetRedirectAll(0) 
				SendToOps(Bot, user.sName.." changed the redirect all new connections to: "..arg.." |")
				user:SendData(parseenv(user,env,Bot).."You changed the redirect all new connections to: "..arg.." |")
			else
				user:SendData(parseenv(user,env,Bot).."The value can only be: on or off.  It cannot be "..arg.." |")
			end
		else
			user:SendData(parseenv(user,env,Bot).. "Damn, don't be so lazy, type the switch after the comand too! |")
		end
	else
		user:SendData(parseenv(user,env,Bot).."You do not have sufficient rights to run that command! |")
	end
end 

function SetRedirectFull(user, data,env)
	if user.iProfile==0 then
		local _,_,arg=strfind(data,"%b<>%s+%S+%s+(%S+)")
		if arg ~= nil then
			if (arg=="on") then 
				frmHub:SetRedirectAll(0)
				frmHub:SetRedirectFull(1) 
				SendToOps(Bot, user.sName.." has enabled the redirect all new connections when maximum connections reached feature. |")
				user:SendData(parseenv(user,env,Bot).."You have enabled the redirect all new connections when maximum connections reached feature.|")
			elseif (arg=="off") then
				frmHub:SetRedirectFull(0) 
				SendToOps(Bot, user.sName.." has disabled the redirect all new connections when maximum connections reached feature. |")
				user:SendData(parseenv(user,env,Bot).."You have disabled the redirect all new connections when maximum connections reached feature.|")
			else
				user:SendData(parseenv(user,env,Bot).."The value can only be: on or off.  It cannot be "..arg.." |")
			end 
		else
			user:SendData(parseenv(user,env,Bot).. "Damn, don't be so lazy, type the switch after the comand too! |")
		end
	else
		user:SendData(parseenv(user,env,Bot).."You do not have sufficient rights to run that command! |")
	end
end 


function DataArrival(user,data)
	returndata=0
	if strsub(data, 1, 1) == "<" then 
		data=strsub(data,1,strlen(data)-1)
		local _,_,cmd = strfind(data,"%b<>%s+(%S+)")
		if cmd then
			returndata=parsecmds(user,data,strlower(cmd),"MAIN")
		end
	elseif strsub(data, 1, 4) == "$To:" then
		data=strsub(data,1,strlen(data)-1)
			local _,_,whoTo = strfind(data,"$To:%s+(%S+)")
		if (whoTo == Bot) then
			local _,_,cmd = strfind(data,"$To:%s+%S+%s+From:%s+%S+%s+$%b<>%s+(%S+)")
			cmd=strlower(cmd)
			returndata=parsecmds(user,data,cmd,"PM")
		end
	end return returndata
end

function parsecmds(user,data,cmd,env)
	if cmd==cmd1 then
		ChRed(user,data,env) returndata=1
	elseif cmd==cmd2 then
		SetRedirectAll(user,data,env) returndata=1
	elseif cmd==cmd3 then
		SetRedirectFull(user,data,env) returndata=1
	end
	return returndata
end

function parseenv(user,env,bot)
	if env=="PM" then
		return "$To: "..user.sName.." From: "..bot.." $<"..bot.."> "
	elseif env=="MAIN" then
		return "<"..bot.."> "
	end
end
Everything could have been anything else and it would have just as much meaning.

bastya_elvtars

above post edited, there was a little error. Next time request scripts in the request scripts thread! ;)
Everything could have been anything else and it would have just as much meaning.

6Marilyn6Manson6

#3
Hello. The script doesn't work. I am master but: [09:41] You do not have sufficient rights to run that command! . Besides I asked as I command  !setredirect
 that is a command to change the hub of redirect and not  !setredirect . Thanks a lot. ^__^


MY HUB: planetarium.no-ip.org


This is my profile:
0|Master|11111111111111111111111000000001
1|Operator|11111100011001111111111000000001
2|VIP|10000000000001111100000000000000
3|Reg|10000000000000000100000000000000
4|Moderator|11111110011101111111110000000001


I forgot... this command has to work that is only with the Master with the profile 0 .  Thanksssssssssssssss

bastya_elvtars

i was an idiot. i set it that only regular ops can use it :D

edited of course
Everything could have been anything else and it would have just as much meaning.

SMF spam blocked by CleanTalk