How to change Settings through cmd?
 

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

How to change Settings through cmd?

Started by BottledHate, 28 September, 2004, 03:25:29

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

BottledHate

requested by: Psycho_Chihuahua http://board.univ-angers.fr/thread.php?threadid=1735&boardid=4&styleid=1&page=1#9

here's how i set up commands in a scipt....

rUserDefined = {
cmd1 = "!cmd1", 
cmd2 = "!cmd2",
cmd3 = "!cmd3", 
}

function DataArrival(user, data) 
   if (strsub(data, 1, 1) == "<" ) then 
      data= strsub(data,1,strlen(data)-1)
      ------------
      local _,_,c =strfind(data, "%b<> (%S*)") --//find the first word.
      if CommandsTable[c] and user.bOperator then --//is the first word a command? ops only... 
      local _,_,c,parms1=strfind(data, "%b<>%s+(%S+)%s*(.*)") --//fing the stuff after the word (parms1)
      CommandsTable[c](user,parms1)--//call the funciton forthe command with the arguments required.. (user and parm1)
      end
      ------------
   end
end

---------------------------------------
CommandsTable = {
   [rUserDefined.cmd1] = function(u,p1)--// (u,p1)user and parm1 sent from data arival
      --//do stuff!
      if p1 ~= "" then
         u:SendData("Command 1 triggered with parms: "..p1)
      else
         u:SendData("Command 1 triggered...")
      end
   end,
-------------------------    
  [rUserDefined.cmd2] = function(u)
      --//executecrap!
      SendToMain=1
      u:SendData("Command 2 triggered...")
   end,
-------------------------    
  [rUserDefined.cmd3] = function(u)
      --//...
      SendToMain=0
      u:SendData("Command 3 triggered...")
   end,
-------------------------    
}


there are pleny of other ways to do it.. i've foung this is fast... keeps the data arrival clean from too much command stuff, and it's easy to go back and edit the functions for each command later down the line...

hope this helps!

-BH


Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

Psycho_Chihuahua

thnx m8, i hope so to

gonna check it out right away
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

BottledHate

made a couple little changes to make it easier dor u to see where to put your stuff at... ;)

-BH
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

Psycho_Chihuahua

yeah, thnx  :D  a lot clearer now  :P

but i'll check it out tomorrow morning, gotta go to bed now.....my eyes are opened with toothpicks already
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

Psycho_Chihuahua

Tryed doing a bit of Code shuffling to get further with my former request...just doesnt work sofar..

--AdTimer 1.0
--
--by Mutor
--Yet another Hub Advert script
--Addon by Psycho-Chihuahua
--Sends hub Advert on timer or by command
--in Main or by PM
--
assert(dofile("Ad/Settings.cfg"),"error, settings file not present")
HubMsg1 = "Auf Deutsch	-->	[URL]http://www.dc-stammtisch.de[/URL]"
HubMsg2 = "In English	-->	[URL]http://board.univ-angers.fr[/URL]"
--

function Main() 
SetTimer(mins*60000) 
StartTimer() 
end 

function DataArrival(user, data)
	s,e,cmd = strfind(data, "%b<>%s+(%S+)(%S+)")
		if (cmd==Prefix..AdComm) and user.bOperator then
			OnTimer()  
		end
end




function TimerMsg() 
		local tmp
		tmp = "\r\n\r\n\t---<>-------------------------------------------------------------------------------------<>---\r\n"  
		tmp = tmp.."\t\t[ "..frmHub:GetHubName().." ]\r\n" 
		tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n" 
		tmp = tmp.."\tHub Name: \t"..frmHub:GetHubName().."\r\n"	-- add/remove tabs ' \t '  ...to center hub name 
		tmp = tmp.."\tHub Owner: \t"..HubOwner.."\r\n" 
		tmp = tmp.."\tHub Addy: \t"..Hubaddy.."\r\n" 
		tmp = tmp.."\tHub Zeit: \t( "..date("%H:%M").." ) -- "..TZone .."\r\n"
		tmp = tmp.."\tHub Desc: \t"..frmHub:GetHubDescr().."\r\n" 
		tmp = tmp.."\tUmleitungs Addy: \t"..frmHub:GetRedirectAddress().."\r\n"
		tmp = tmp.."\tReg Server: \t"..frmHub:GetRegServer().."\r\n"  
		tmp = tmp.."\tRedirect Alle: \t"..RedirAll().."\r\n" 
		tmp = tmp.."\tRedirect Voll: \t"..RedirFull().."\r\n" 
		tmp = tmp.."\tMax Users: \t"..frmHub:GetMaxUsers().."\r\n" 
		tmp = tmp.."\tMin Share: \t"..frmHub:GetMinShare().."\r\n"
		tmp = tmp.."\tHub Share: \t"..frmHub:GetCurrentShareAmount().."\r\n"
		tmp = tmp.."\tMasters Online: \t\t"..CountMaster().."\r\n" 
		tmp = tmp.."\tOps Online: \t\t"..CountOPs().."\r\n" 
		tmp = tmp.."\tVips Online: \t\t"..CountVIPs().."\r\n"
		tmp = tmp.."\tRegs Online: \t\t"..CountRegUsers().."\r\n"
		tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n" 
		tmp = tmp.."\tTotal Online: \t\t"..frmHub:GetUsersCount().."\r\n" 
		tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n" 
		tmp = tmp.."\tHilfe zu DC++, Hubsoft und Scripts gibts in diesen Foren:\r\n"
		tmp = tmp.."\t-- "..HubMsg1.."\r\n"
		tmp = tmp.."\t-- "..HubMsg2.."\r\n"
		tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n" 
		tmp = tmp.."\tMitteilung(en):\r\n"
		tmp = tmp.."\t-- "..InfoMsg1.."\r\n"
		tmp = tmp.."\t-- "..InfoMsg2.."\r\n"
		tmp = tmp.."\t-- "..InfoMsg3.."\r\n"
		tmp = tmp.."\t-- "..InfoMsg4.."\r\n"
		tmp = tmp.."\t-- "..InfoMsg5.."\r\n"
		tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n" 
end

function OnTimer()
	    if SendAs=="PM" then
	SendPmToAll(TimerMsg(), tmp)
    elseif SendAs=="MAIN" then
	SendData(TimerMsg(), tmp)
    end
end

function RedirAll() 
	rdstatusall = frmHub:GetRedirectAll()
	rastatus = ""
	if rdstatusall == 1 then
		rastatus = "on"
	else
		rastatus = "off"
	end
	return rastatus
end 

function RedirFull()
	rdstatusfull = frmHub:GetRedirectFull() 
	--local tmp, rdstatusfull = frmHub:GetRedirectFull(),0;
	rfstatus = ""
	if rdstatusfull == 1 then
		rfstatus = "on"
	else
		rfstatus = "off"
	end
	return rfstatus
end 

function CountMaster() 
	local tmp, count = GetUsersByProfile(GetProfileName(0)), 0;
	if tmp then
		for id = 0, getn(tmp) do
			if GetItemByName(tmp[id]) then
				count = count + 1;
			end
		end 
	end
	return count
end 

function CountOPs() 
	local tmp, count = GetUsersByProfile(GetProfileName(1)), 0;
	if tmp then
		for id = 0, getn(tmp) do
			if GetItemByName(tmp[id]) then
				count = count + 1;
			end
		end 
	end
	return count
end 
function CountVIPs() 
	local tmp, count = GetUsersByProfile(GetProfileName(2)), 0;
	if tmp then
		for id = 0, getn(tmp) do
			if GetItemByName(tmp[id]) then
				count = count + 1;
			end
		end 
	end
	return count
end 
function CountRegUsers() 
	local tmp, count = GetUsersByProfile(GetProfileName(3)), 0;
	if tmp then
		for id = 0, getn(tmp) do
			if GetItemByName(tmp[id]) then
				count = count + 1;
			end
		end 
	end
	return count
end

well Botname shows correctly  :D  but thats it lol i hope someone sees what i'm trying to do here.
I woul like these parts of (AD/Settings.cfg) to be customizable by using cmd's.

mins = 180
SendAs = "MAIN" -- or PM
and the amount of InfoMsgx lines



here the settings.cfg atm
--User Settings-------------------------------------------------------------------------------------
-- bot = "HubInfo"	-- wenn der bot einen eigenen Namen tragen soll dann l?sche die n?chste Zeile
bot = frmHub:GetHubBotName()						-- Name des bots
mins = 180 						-- Interval [in minuten] zwischen Ads
Hubaddy = "helvetia.ath.cx" 				-- Doh?
HubOwner = "Johnnie"					-- Doh?
Prefix = "+"					-- Prefix f?r den Befehl
AdComm = "werbung"						-- Befehl um Ad direkt zu senden
TZone = " +1 GMT [EST]"					-- Zeit Zone des hubs
SendAs = "MAIN"			-- Wie soll der Ad angezeigt werden [MAIN oder PM]
--Eigene Meldungen---------------------------------------------------------------------------------
InfoMsg1 = "Hier kannste"				-- Diese Meldungen
InfoMsg2 = "eigene Meldungen"				-- kommen unterhalb der
InfoMsg3 = "reinschreiben"				-- Werbung f?r die Foren
InfoMsg4 = ""
InfoMsg5 = "oder leer lassen"
--Ende User Settings--------------------------------------------------------------------------------
Never mind the German Lines *g there just for the one i got working so far (settable to MAIN or PM Ad)
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

BottledHate

here ya go... not tested... if there are errors, i'm sure you can fix them from here... ;)


--AdTimer 1.0
--
--by Mutor
--Yet another Hub Advert script
--Addon by Psycho-Chihuahua
--Sends hub Advert on timer or by command
--in Main or by PM
--Addon by BottledHate 09/29/05
----added user defined commands.

assert(dofile("Ad/Settings.cfg"),"error, settings file not present")
HubMsg1 = "Auf Deutsch	-->	[URL]http://www.dc-stammtisch.de[/URL]"
HubMsg2 = "In English	-->	[URL]http://board.univ-angers.fr[/URL]"

----------------------------------------//no save function.. so setting revert to 'Ad/Settomgs.cfg' on script restart.
AdUserDefined = {
cmd1 = "adsendas",   --//toggle main or pm. (don't add prefix here. user prefix from setings.)
cmd2 = "admins",   --//set interval in minutes (... prefix blah blag...)
}
----------------------------------------
function Main() 
SetTimer(mins*60000) 
StartTimer() 
end 

function DataArrival(user, data)
	local s,e,cmd,parm1 = strfind(data, "%b<>%s+(%S*)%s*(%S*)")
		if AdUserDefined[Prefix..cmd] and user.bOperator then
         AdCommandsTable[cmd](user,parm1)
         return 1
      end
end

function TimerMsg() 
		local tmp
		tmp = "\r\n\r\n\t---<>-------------------------------------------------------------------------------------<>---\r\n"  
		tmp = tmp.."\t\t[ "..frmHub:GetHubName().." ]\r\n" 
		tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n" 
		tmp = tmp.."\tHub Name: \t"..frmHub:GetHubName().."\r\n"	-- add/remove tabs ' \t '  ...to center hub name 
		tmp = tmp.."\tHub Owner: \t"..HubOwner.."\r\n" 
		tmp = tmp.."\tHub Addy: \t"..Hubaddy.."\r\n" 
		tmp = tmp.."\tHub Zeit: \t( "..date("%H:%M").." ) -- "..TZone .."\r\n"
		tmp = tmp.."\tHub Desc: \t"..frmHub:GetHubDescr().."\r\n" 
		tmp = tmp.."\tUmleitungs Addy: \t"..frmHub:GetRedirectAddress().."\r\n"
		tmp = tmp.."\tReg Server: \t"..frmHub:GetRegServer().."\r\n"  
		tmp = tmp.."\tRedirect Alle: \t"..RedirAll().."\r\n" 
		tmp = tmp.."\tRedirect Voll: \t"..RedirFull().."\r\n" 
		tmp = tmp.."\tMax Users: \t"..frmHub:GetMaxUsers().."\r\n" 
		tmp = tmp.."\tMin Share: \t"..frmHub:GetMinShare().."\r\n"
		tmp = tmp.."\tHub Share: \t"..frmHub:GetCurrentShareAmount().."\r\n"
		tmp = tmp.."\tMasters Online: \t\t"..CountMaster().."\r\n" 
		tmp = tmp.."\tOps Online: \t\t"..CountOPs().."\r\n" 
		tmp = tmp.."\tVips Online: \t\t"..CountVIPs().."\r\n"
		tmp = tmp.."\tRegs Online: \t\t"..CountRegUsers().."\r\n"
		tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n" 
		tmp = tmp.."\tTotal Online: \t\t"..frmHub:GetUsersCount().."\r\n" 
		tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n" 
		tmp = tmp.."\tHilfe zu DC++, Hubsoft und Scripts gibts in diesen Foren:\r\n"
		tmp = tmp.."\t-- "..HubMsg1.."\r\n"
		tmp = tmp.."\t-- "..HubMsg2.."\r\n"
		tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n" 
		tmp = tmp.."\tMitteilung(en):\r\n"
		tmp = tmp.."\t-- "..InfoMsg1.."\r\n"
		tmp = tmp.."\t-- "..InfoMsg2.."\r\n"
		tmp = tmp.."\t-- "..InfoMsg3.."\r\n"
		tmp = tmp.."\t-- "..InfoMsg4.."\r\n"
		tmp = tmp.."\t-- "..InfoMsg5.."\r\n"
		tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n" 
end

function OnTimer()
	    if SendAs=="PM" then
	SendPmToAll(TimerMsg(), tmp)
    elseif SendAs=="MAIN" then
	SendData(TimerMsg(), tmp)
    end
end

function RedirAll() 
	rdstatusall = frmHub:GetRedirectAll()
	rastatus = ""
	if rdstatusall == 1 then
		rastatus = "on"
	else
		rastatus = "off"
	end
	return rastatus
end 

function RedirFull()
	rdstatusfull = frmHub:GetRedirectFull() 
	--local tmp, rdstatusfull = frmHub:GetRedirectFull(),0;
	rfstatus = ""
	if rdstatusfull == 1 then
		rfstatus = "on"
	else
		rfstatus = "off"
	end
	return rfstatus
end 

function CountMaster() 
	local tmp, count = GetUsersByProfile(GetProfileName(0)), 0;
	if tmp then
		for id = 0, getn(tmp) do
			if GetItemByName(tmp[id]) then
				count = count + 1;
			end
		end 
	end
	return count
end 

function CountOPs() 
	local tmp, count = GetUsersByProfile(GetProfileName(1)), 0;
	if tmp then
		for id = 0, getn(tmp) do
			if GetItemByName(tmp[id]) then
				count = count + 1;
			end
		end 
	end
	return count
end 
function CountVIPs() 
	local tmp, count = GetUsersByProfile(GetProfileName(2)), 0;
	if tmp then
		for id = 0, getn(tmp) do
			if GetItemByName(tmp[id]) then
				count = count + 1;
			end
		end 
	end
	return count
end 
function CountRegUsers() 
	local tmp, count = GetUsersByProfile(GetProfileName(3)), 0;
	if tmp then
		for id = 0, getn(tmp) do
			if GetItemByName(tmp[id]) then
				count = count + 1;
			end
		end 
	end
	return count
end
----------------------------------------
AdCommandsTable = {
   [AdUserDefined.cmd1] = function(u)--//toggle main or pm
      if SendAs == "MAIN"	 then
         SendAs = "PM"
         u:SendData("***AdTimer 1.0: Messages will be sent to PM***")
      else
         SendAs = "MAIN"
         u:SendData("***AdTimer 1.0: Messages will be sent to MAIN***")
      end
   end,
-------------------------    
  [AdUserDefined.cmd2] = function(u,p1) --//set minutes.
      p1 = tonumber(p1)
      if type(p1) == "number" then --//make sure the parm for minutes is a number.
         mins = p1
         StopTimer()
         Main()
         u:SendData("***AdTimer 1.0: mins set to: "..p1.."***")
      else --// parm not a number...
         u:SendData("***AdTimer 1.0: Error: Syntax: "..Prfefix..AdUserDefined.cmd2.."    -where  = minutes.***"
      end
   end,
}
----------------------------------------


hope this helps!

-BH
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

Psycho_Chihuahua

#6
hmmm tried fiddling round with it but couldnt get it to work (guess i didnt get the drift of it)

What i need on this is

1. a pre set timer value i.e. "mins = 180"  (and a cmd to change its value while running)
and
2. To be able to switch from showing in PM and Main while running.


but i need to be able to use the old cmd's as well

like in this case +werbung to show ad immediatley....and i couldnt get that to work


this is what im using atm
--AdTimer 1.0
--
--by Mutor
--modded by Psycho-Chihuahua
--Yet another Hub Advert script
--Sends hub Advert on timer or by command
--in Main or by PM
--
--User Settings-------------------------------------------------------------------------------------
bot = "HubInfo"						-- Name des bots
mins = 180 						-- Interval [in minuten] zwischen Ads
Hubaddy = "helvetia.ath.cx" 				-- Doh?
HubOwner = "Johnnie"				-- Doh?
Prefix = "+"						-- Prefix f?r den Befehl
AdComm = "werbung"				-- Befehl um Ad direkt zu senden
TZone = " +1 GMT [EST]"				-- Zeit Zone des hubs
SendAs = "MAIN"		-- Wie soll die Werbung angezeigt werden [MAIN oder PM]
--End User Settings----------------------------------------------------------------------------------

--End of Settings File
--Beginning of script
HubMsg1 = "Auf Deutsch	-->	[URL]http://www.dc-stammtisch.de[/URL]"
HubMsg2 = "In English	-->	[URL]http://board.univ-angers.fr[/URL]"
--

function Main() 
SetTimer(mins*60000) 
StartTimer() 
end 

function DataArrival(user, data)
	s,e,cmd = strfind(data, "%b<>%s+(%S+)(%S+)")
		if (cmd==Prefix..AdComm) and user.bOperator then
			OnTimer()  
		end
end




function OnTimer() 
		local tmp
		tmp = "\r\n\r\n\t---<>-------------------------------------------------------------------------------------<>---\r\n"  
		tmp = tmp.."\t\t[ "..frmHub:GetHubName().." ]\r\n" 
		tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n" 
		tmp = tmp.."\tHub Name: \t"..frmHub:GetHubName().."\r\n"	-- add/remove tabs ' \t '  ...to center hub name 
		tmp = tmp.."\tHub Owner: \t"..HubOwner.."\r\n" 
		tmp = tmp.."\tHub Addy: \t"..Hubaddy.."\r\n" 
		tmp = tmp.."\tHub Zeit: \t( "..date("%H:%M").." ) -- "..TZone .."\r\n"
		tmp = tmp.."\tHub Desc: \t"..frmHub:GetHubDescr().."\r\n" 
		tmp = tmp.."\tRedirect Addy: \t"..frmHub:GetRedirectAddress().."\r\n"
		tmp = tmp.."\tReg Server: \t"..frmHub:GetRegServer().."\r\n"  
		tmp = tmp.."\tRedirect Alle: \t"..RedirAll().."\r\n" 
		tmp = tmp.."\tRedirect Voll: \t"..RedirFull().."\r\n" 
		tmp = tmp.."\tMax Users: \t"..frmHub:GetMaxUsers().."\r\n" 
		tmp = tmp.."\tMin Share: \t"..frmHub:GetMinShare().."\r\n"
		tmp = tmp.."\tHub Share: \t"..frmHub:GetCurrentShareAmount().."\r\n"
		tmp = tmp.."\tMasters Online: \t\t"..CountMaster().."\r\n" 
		tmp = tmp.."\tOps Online: \t\t"..CountOPs().."\r\n" 
		tmp = tmp.."\tVips Online: \t\t"..CountVIPs().."\r\n"
		tmp = tmp.."\tRegs Online: \t\t"..CountRegUsers().."\r\n"
		tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n" 
		tmp = tmp.."\tTotal Online: \t\t"..frmHub:GetUsersCount().."\r\n" 
		tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n" 
		tmp = tmp.."\tOpen Hubs die f?r uns werben:\r\n"
		tmp = tmp.."\t-- Biba`s-World	-	bibabu.homeip.net\r\n"
		tmp = tmp.."\t-- Chiller German Hub	-	chillers.no-ip.com\r\n"
		tmp = tmp.."\t--  ??????Garden of HELVETIA Hub??????	-	gardenofhelvetia.ath.cx \r\n"
		tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n" 
		tmp = tmp.."\tHilfe zu DC++, Hubsoft und Scripts gibts in diesen Foren:\r\n"
		tmp = tmp.."\t-- "..HubMsg1.."\r\n"
		tmp = tmp.."\t-- "..HubMsg2.."\r\n"
		tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n" 
    if SendAs=="PM" then
	SendPmToAll(bot,tmp)
    elseif SendAs=="MAIN" then
	SendToAll(bot,tmp)
    end
end

function RedirAll() 
	rdstatusall = frmHub:GetRedirectAll()
	rastatus = ""
	if rdstatusall == 1 then
		rastatus = "Aktiviert"
	else
		rastatus = "Deaktiviert"
	end
	return rastatus
end 

function RedirFull()
	rdstatusfull = frmHub:GetRedirectFull() 
	--local tmp, rdstatusfull = frmHub:GetRedirectFull(),0;
	rfstatus = ""
	if rdstatusfull == 1 then
		rfstatus = "Aktiviert"
	else
		rfstatus = "Deaktiviert"
	end
	return rfstatus
end 

function CountMaster() 
	local tmp, count = GetUsersByProfile(GetProfileName(0)), 0;
	if tmp then
		for id = 0, getn(tmp) do
			if GetItemByName(tmp[id]) then
				count = count + 1;
			end
		end 
	end
	return count
end 

function CountOPs() 
	local tmp, count = GetUsersByProfile(GetProfileName(1)), 0;
	if tmp then
		for id = 0, getn(tmp) do
			if GetItemByName(tmp[id]) then
				count = count + 1;
			end
		end 
	end
	return count
end 
function CountVIPs() 
	local tmp, count = GetUsersByProfile(GetProfileName(2)), 0;
	if tmp then
		for id = 0, getn(tmp) do
			if GetItemByName(tmp[id]) then
				count = count + 1;
			end
		end 
	end
	return count
end 
function CountRegUsers() 
	local tmp, count = GetUsersByProfile(GetProfileName(3)), 0;
	if tmp then
		for id = 0, getn(tmp) do
			if GetItemByName(tmp[id]) then
				count = count + 1;
			end
		end 
	end
	return count
end
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

BottledHate

#7
--AdTimer 1.0
--
--by Mutor
--modded by Psycho-Chihuahua
--Yet another Hub Advert script
--Sends hub Advert on timer or by command
--in Main or by PM
--
--User Settings-------------------------------------------------------------------------------------

AdUserDefined = {
cmd1 = "adsendas",   --//toggle main or pm. (don't add prefix here. user prefix from setings.)
cmd2 = "admins",   --//set interval in minutes (... prefix blah blag...)
}



bot = "HubInfo"						-- Name des bots
mins = 180 						-- Interval [in minuten] zwischen Ads
Hubaddy = "helvetia.ath.cx" 				-- Doh?
HubOwner = "Johnnie"				-- Doh?
Prefix = "+"						-- Prefix f?r den Befehl
AdComm = "werbung"				-- Befehl um Ad direkt zu senden
TZone = " +1 GMT [EST]"				-- Zeit Zone des hubs
SendAs = "MAIN"		-- Wie soll die Werbung angezeigt werden [MAIN oder PM]
--End User Settings----------------------------------------------------------------------------------

--End of Settings File
--Beginning of script
HubMsg1 = "Auf Deutsch	-->	[URL]http://www.dc-stammtisch.de[/URL]"
HubMsg2 = "In English	-->	[URL]http://board.univ-angers.fr[/URL]"
--

function Main() 
SetTimer(mins*60000) 
StartTimer() 
end 



function DataArrival(user, data)
	s,e,cmd = strfind(data, "%b<>%s+(%S+)(%S+)")
		if (cmd==Prefix..AdComm) and user.bOperator then
			OnTimer()  
		end
	local s,e,cmd,parm1 = strfind(data, "%b<>%s+(%S*)%s*(%S*)")
		if AdUserDefined[strsub(cmd,2)] and user.bOperator then
         AdCommandsTable[cmd](user,parm1)
         return 1
      end
      
end




function OnTimer() 
		local tmp
		tmp = "\r\n\r\n\t---<>-------------------------------------------------------------------------------------<>---\r\n"  
		tmp = tmp.."\t\t[ "..frmHub:GetHubName().." ]\r\n" 
		tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n" 
		tmp = tmp.."\tHub Name: \t"..frmHub:GetHubName().."\r\n"	-- add/remove tabs ' \t '  ...to center hub name 
		tmp = tmp.."\tHub Owner: \t"..HubOwner.."\r\n" 
		tmp = tmp.."\tHub Addy: \t"..Hubaddy.."\r\n" 
		tmp = tmp.."\tHub Zeit: \t( "..date("%H:%M").." ) -- "..TZone .."\r\n"
		tmp = tmp.."\tHub Desc: \t"..frmHub:GetHubDescr().."\r\n" 
		tmp = tmp.."\tRedirect Addy: \t"..frmHub:GetRedirectAddress().."\r\n"
		tmp = tmp.."\tReg Server: \t"..frmHub:GetRegServer().."\r\n"  
		tmp = tmp.."\tRedirect Alle: \t"..RedirAll().."\r\n" 
		tmp = tmp.."\tRedirect Voll: \t"..RedirFull().."\r\n" 
		tmp = tmp.."\tMax Users: \t"..frmHub:GetMaxUsers().."\r\n" 
		tmp = tmp.."\tMin Share: \t"..frmHub:GetMinShare().."\r\n"
		tmp = tmp.."\tHub Share: \t"..frmHub:GetCurrentShareAmount().."\r\n"
		tmp = tmp.."\tMasters Online: \t\t"..CountMaster().."\r\n" 
		tmp = tmp.."\tOps Online: \t\t"..CountOPs().."\r\n" 
		tmp = tmp.."\tVips Online: \t\t"..CountVIPs().."\r\n"
		tmp = tmp.."\tRegs Online: \t\t"..CountRegUsers().."\r\n"
		tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n" 
		tmp = tmp.."\tTotal Online: \t\t"..frmHub:GetUsersCount().."\r\n" 
		tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n" 
		tmp = tmp.."\tOpen Hubs die f?r uns werben:\r\n"
		tmp = tmp.."\t-- Biba`s-World	-	bibabu.homeip.net\r\n"
		tmp = tmp.."\t-- Chiller German Hub	-	chillers.no-ip.com\r\n"
		tmp = tmp.."\t--  ??????Garden of HELVETIA Hub??????	-	gardenofhelvetia.ath.cx \r\n"
		tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n" 
		tmp = tmp.."\tHilfe zu DC++, Hubsoft und Scripts gibts in diesen Foren:\r\n"
		tmp = tmp.."\t-- "..HubMsg1.."\r\n"
		tmp = tmp.."\t-- "..HubMsg2.."\r\n"
		tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n" 
    if SendAs=="PM" then
	SendPmToAll(bot,tmp)
    elseif SendAs=="MAIN" then
	SendToAll(bot,tmp)
    end
end

function RedirAll() 
	rdstatusall = frmHub:GetRedirectAll()
	rastatus = ""
	if rdstatusall == 1 then
		rastatus = "Aktiviert"
	else
		rastatus = "Deaktiviert"
	end
	return rastatus
end 

function RedirFull()
	rdstatusfull = frmHub:GetRedirectFull() 
	--local tmp, rdstatusfull = frmHub:GetRedirectFull(),0;
	rfstatus = ""
	if rdstatusfull == 1 then
		rfstatus = "Aktiviert"
	else
		rfstatus = "Deaktiviert"
	end
	return rfstatus
end 

function CountMaster() 
	local tmp, count = GetUsersByProfile(GetProfileName(0)), 0;
	if tmp then
		for id = 0, getn(tmp) do
			if GetItemByName(tmp[id]) then
				count = count + 1;
			end
		end 
	end
	return count
end 

function CountOPs() 
	local tmp, count = GetUsersByProfile(GetProfileName(1)), 0;
	if tmp then
		for id = 0, getn(tmp) do
			if GetItemByName(tmp[id]) then
				count = count + 1;
			end
		end 
	end
	return count
end 
function CountVIPs() 
	local tmp, count = GetUsersByProfile(GetProfileName(2)), 0;
	if tmp then
		for id = 0, getn(tmp) do
			if GetItemByName(tmp[id]) then
				count = count + 1;
			end
		end 
	end
	return count
end 
function CountRegUsers() 
	local tmp, count = GetUsersByProfile(GetProfileName(3)), 0;
	if tmp then
		for id = 0, getn(tmp) do
			if GetItemByName(tmp[id]) then
				count = count + 1;
			end
		end 
	end
	return count
end 
AdCommandsTable = {
   [AdUserDefined.cmd1] = function(u)--//toggle main or pm
      if SendAs == "MAIN"	 then
         SendAs = "PM"
         u:SendData("***AdTimer 1.0: Messages will be sent to PM***")
      else
         SendAs = "MAIN"
         u:SendData("***AdTimer 1.0: Messages will be sent to MAIN***")
      end
   end,
-------------------------    
  [AdUserDefined.cmd2] = function(u,p1) --//set minutes.
      p1 = tonumber(p1)
      if type(p1) == "number" then --//make sure the parm for minutes is a number.
         mins = p1
         StopTimer()
         Main()
         u:SendData("***AdTimer 1.0: mins set to: "..p1.."***")
      else --// parm not a number...
         u:SendData("***AdTimer 1.0: Error: Syntax: "..Prfefix..AdUserDefined.cmd2.."    -where  = minutes.***"
      end
   end,
}
----------------------------------------
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

Psycho_Chihuahua

gr8t work there BH but this one of Mutor's is a little easier for me to understand :D and all i had to change was the Language and the Hub Share from GB to TB

here's the english one adapted to TB for Current Hub Shareand corrected so PM is correctly PM'd  :D

--AdTimer 1.2
--
--by Mutor
--Optimized by Optimus, thx
--
--Yet another Hub Advert script
--Sends hub Advert on timer or by command
--
--
--User Settings-------------------------------------------------------------------------------------
bot = "HubAd"						-- Name for bot
mins = 180 						-- Interval [in minutes] between Ads
Hubaddy = "hubaddy.no-ip.com" 					-- Duh?
HubOwner = "Your_Nick"					-- Duh?
Prefix = "+"						-- Set Command Prefix
AdComm = "ad"						-- Command to send Ad immediately
PmComm = "adpm"						-- Toggle ad, send to  main or PM
Ad2Pm = "no"						-- send ad as pm? may be toggled
TZone = " -5 GMT [EST]"					-- Time Zone hub resides in
HubMsg1 = ""						-- Additional notices/info to be sent with ad
HubMsg2 = ""						-- Additional notices/info to be sent with ad
HubMsg3 = ""						-- Additional notices/info to be sent with ad
--End User Settings----------------------------------------------------------------------------------

frmHub:RegBot(bot)

function Main() 
	SetTimer(mins*60000) 
	StartTimer() 
end 

function DataArrival(user, data)
	s,e,cmd = strfind(data, "%b<>%s+(%S+)(%S+)")
	if (cmd==Prefix..AdComm) and user.bOperator then
		OnTimer()
	elseif (cmd==Prefix..PmComm) and user.bOperator then  
		if Ad2Pm == "yes" then Ad2Pm = "no"
			user:SendData("Hub advert will now be sent to the main chat")
		elseif Ad2Pm == "no" then Ad2Pm = "yes"
			user:SendData("Hub advert will now be sent as a private message")
		end
	return 1
	end
end

function OnTimer()
	local tmp
	tmp = "\r\n\r\n\t---<>-------------------------------------------------------------------------------------<>---\r\n"  
	tmp = tmp.."\t[ "..frmHub:GetHubName().." ]\r\n" 
	tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n" 
	tmp = tmp.."\tHub Name: \t"..frmHub:GetHubName().."\r\n"
	tmp = tmp.."\tHub Owner: \t"..HubOwner.."\r\n" 
	tmp = tmp.."\tHub Addy: \t"..Hubaddy.."\r\n" 
	tmp = tmp.."\tHub Time: \t( "..date("%B %d %Y %X ").." ) - "..TZone .."\r\n"
	tmp = tmp.."\tHub Desc: \t"..frmHub:GetHubDescr().."\r\n" 
	tmp = tmp.."\tRedirect To: \t"..frmHub:GetRedirectAddress().."\r\n"
	tmp = tmp.."\tReg Server: \t"..frmHub:GetRegServer().."\r\n"  
	tmp = tmp.."\tRedirect All: \t"..RedirAll().."\r\n" 
	tmp = tmp.."\tRedirect Full: \t"..RedirFull().."\r\n" 
	tmp = tmp.."\tMax Users: \t"..frmHub:GetMaxUsers().."\r\n" 
	tmp = tmp.."\tMin Share: \t"..format("%.2f GigaBytes",frmHub:GetMinShare()/1024).."\r\n"
	tmp = tmp.."\tHub Share: \t"..format("%.2f TeraBytes",frmHub:GetCurrentShareAmount()/(1024 * 1024 * 1024 * 1024)).."\r\n"
	tmp = tmp.."\tMasters Online: \t"..cProfile("Master").."\r\n" 
	tmp = tmp.."\tOps Online: \t"..cProfile("Operator").."\r\n" 
	tmp = tmp.."\tVips Online: \t"..cProfile("VIP").."\r\n"
	tmp = tmp.."\tRegs Online: \t"..cProfile("REG").."\r\n"
	tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n" 
	tmp = tmp.."\tTotal Online:\t\t"..frmHub:GetUsersCount().."\r\n" 
	tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n" 
	tmp = tmp.."\tNotice(s):\r\n"
	tmp = tmp.."\t-- "..HubMsg1.."\r\n"
	tmp = tmp.."\t-- "..HubMsg2.."\r\n"
	tmp = tmp.."\t-- "..HubMsg3.."\r\n"
	tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n" 
	if Ad2Pm == "yes" then
		SendPmToAll(bot,tmp)
	else
		SendToAll(bot,tmp)
	end 
end

function RedirAll() 
	local rdstatusall = frmHub:GetRedirectAll()
	local rastatus = ""
	if rdstatusall == 1 then
		rastatus = "on"
	else
		rastatus = "off"
	end
	return rastatus
end 

function RedirFull()
	local rdstatusfull = frmHub:GetRedirectFull()
	local rfstatus = 0
	if rdstatusfull == 1 then
		rfstatus = "on"
	else
		rfstatus = "off"
	end
	return rfstatus
end 

--// Profile Counter
function cProfile(what)
	local disp = ""
	local table,online,offline = GetUsersByProfile(what),0,0
	for i, User in table do 
		if GetItemByName(User) then
			online = online + 1
		else
			offline = offline + 1
		end
	end
	disp = disp.."Online: "..online.."\t\tOffline: "..offline
	return disp
end
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

BottledHate

Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

Psycho_Chihuahua

#10
funny thing is it crashes the hub when i start it - but if i take it out of scripts when i start the hub and then put them back into script then restart thescripts it works fine.

same affect on TD 4/4.99 and on 0.330 builds 15.25 and 15.8

but like i say if i add it after the hub is running the script works fine
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

SMF spam blocked by CleanTalk