Please need warrning share bot!!! - Page 2
 

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

Please need warrning share bot!!!

Started by juda, 10 August, 2004, 15:09:41

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Herodes

Shit I think Nightlitch went off just in time ... this is a hard one ... Nightlitch or anyone else is this possible in any way ?

I will trying thinking of how that would be possible Exnet ...

In the meantime try to make it follow a pattern of some sort ...
 mabey if u say Modems have 24 hours and T1 have 4 ? would that help ?

EXNET OWNER

yeah sure but!

wot if the user lies about their connection?

Hmmm maybe i shouldnt have bothrd but its good to try and improve scripts.

by the way i need a GUI specialist to make me a gui for my Bot Description Script, which is currently unnamed
any help anyone?

[G-T-E]Gate?

Been reading this thread and think the idea is good,
 I have a question,
If I have my min users share set to 15Gb and I set this section to the following>>

limitshare = 2 * gb    --- this sets the share limit that needs to be reached by the user so that he doesnt get the action .. :) keep format ex: 5 *gb is 5GB ... and so on ..

will the script check to see if the user has added 2Gb to his share when he returns?

Excuse My ignorinse

G8

juda

HAY !!!
Another great idea EXNET OWNER,will see how it works....

Herodes !? sorry,but another error display again...
                   It is just like on v.3  - script wont start. Shown:

Syntax error: `=' expected;
                          last token read: `v4' at line 1 in file `C:\Program Files\PtokaX ver 330\scripts\ShaveShare v4.1.lua'


First reactions on script !!!
From yesterday I run version [ShaveShare v3.lua];[time:12 hour];[min.share 1 GB]
When I today get back from work,I check limit list "!noshare"...and suprise ?!?!
I have already 37 users in the limit list.....very good
Than I go check to my hub and I be suprised again....now is connected 6 users who fill his share after warning [all 6 users have 0 gb share when connected]....great
And more of this users will come back,but tonight.True the day I have on the hub cca.100-120 users,but after 18.00 hours peak groves to 150-180 users.....
SCRIPT DO JOB VERY WELL !!!
    If you want to see my time list,just tell me in the next post and I`ll send the list....[you see how is shown and check for any mistake...]
Want to send,but the time list is very big......or send anyway......[you say]
[P.S.]
I`m very happy how script working and growes....Already using this script my friend for his hub.....He say all the best !!!!!!!!

This is from me.......for now !!!! I`be watching you all !!! ha,ha,ha.....just joke

[All script I test on second hub - get quick look how script work !!!]    ciao  -   juda
juda

6Marilyn6Manson6

This is the ShaveShare v4.1 correct:

--- ShaveShare v4.1 request by judas ( 10/08 - 2004 )
--- by Herodes ( early hours of 11/08 - 2004 )
-------- -------- -------- -------- -------- -------- -------- --------
--- offers a way to handle under-the-share-limit users to enter your hub
--- it can disconnect/redirect/kick/tempban/ban after a certain configurable time...
--- Warns halfway to the timelimit ...
--- --- ^ fixed in v 2 ... now it has a variable to say how many times to warn before disconnect
--- Informs about time left on each entry if the share limit isnt satisfied ...
--- adjustable required limit for the share.. (kb , mb , gb )
--- ---  v3 changes --- ---
--- Now there is a nick-to-send variable in place ... ( v 3 )
--- If you have that nick then use the command ' !noshare '
--- --- ^ ( Note : can change it to what you wish ...) to show a list of the ppl that are in the bots list ...
--- --- v4 changes --- ---
--- Now the users can enter again but the bot will remember them and act differently ( edit ' The2Action ' variable to change the behaviour ...)
--- You can also adjust the time for those ppl to be different than the ones that come for the first time. ... ( edit the ' w2time ' variable for that ...)
--- Edit the ' secfrequency ' variable to choose how many warnings these ppl will receive...
--- Made the messages of that the users receive aware of the action that is going to be taken if the requirments fail in the predifined time ....
--- I think it is fairly complete now ... if not give me a post ....
--- --- v4.1 --- ---
--- displays both types of users in the list generated on the command
--- ShaveShare v4.1 request by judas ( 10/08 - 2004 ) correct by 6Marilyn6Manson6
-------- -------- -------- -------- -------- -------- -------- --------
--- do not edit ... or if you do dont blame me ---
tUsers = {}
tMoreUsers = {}
tAgain = {}
kb = 1024
mb = 1024 ^ 2
gb = 1024 ^ 3
minutes = 60
hours = 60 ^2
-------- -------- -------- -------- -------- -------- -------- --------
--- edit the following 7 variables as you wish ---
-------- -------- -------- -------- -------- -------- -------- --------
wsBot = "ShaveShare"    --- The name of the bot ... it is necessary ... don't include    s  p a c e s ...
TheCmd = "!noshare"    --- The command for displaying the actual list of the ppl under the share limit ....
TheNick = "Herodes"    --- Who is allowed to use the command above ...
wtime = 24 * hours       --- this is the time in seconds. .. Feel free to use the #*hours to say in # hours ... and  #*minutes to say in # minutes .. :)
frequency = 4          --- this is the number of warnings the user is going to receive within the predifined time limit...
w2time = 3 * hours      --- this is the time that a user entering with below share limit for the second time while have to fill up the requirement...
secfrequency = 2      --- this is how many times a user entering with below share limit for the second time is going to be warned in the time set by ' w2time ' variable...
limitshare = 500 * mb    --- this sets the share limit that needs to be reached by the user so that he doesnt get the action .. :) keep format ex: 5 *gb is 5GB ... and so on ..
TheAction = 1          --- this sets the action to take against these ppl .... ? 1 = disconnect , 2 = redirect , 3 = kick , 4 = tempban , 5 = ban ?
The2Action = 5          --- this sets the action to take against the ppl that come back after they were given a first chance.... ? 1 = disconnect , 2 = redirect , 3 = kick , 4 = tempban , 5 = ban ?
-------- -------- -------- -------- -------- -------- -------- --------
         --- script starts ---
-------- -------- -------- -------- -------- -------- -------- --------
function Main()
   frmHub:UnregBot(wsBot)
   frmHub:RegBot(wsBot)
   SetTimer(1000)
   StartTimer()
   bal = floor(wtime/frequency)
   bal2 = floor(w2time/secfrequency)
end

--- // --- Actions to do if a new user is connected ... inform him about the time he has left to fill up his share if it is below the limit defined by ' limitshare ' variable
function NewUserConnected(user)
   if user.sMyInfoString then
      _,_,share = strfind(user.sMyInfoString, "%$(%d+)%$")
      if tonumber(share) < limitshare then
         if tUsers[user.sName] == nil then
            if tAgain[user.sName] == 1 then
               tAgain[user.sName] = nil
               tMoreUsers[user.sName] = {}
               tMoreUsers[user.sName][1] = 0
               tMoreUsers[user.sName][2] = 1
               user:SendPM(wsBot, "You come without having the required share of "..DoShareUnits(limitshare).." Again ?.Presently you are sharing "..DoShareUnits(tonumber(share))..".")
               user:SendPM(wsBot, "You now have just "..DoTimeUnits(w2time).." left to fill it up. If you dont you are getting "..DoStringActions(The2Action)..".")
            else
            tUsers[user.sName] = {}
            tUsers[user.sName][1] = 0
            tUsers[user.sName][2] = 1
            user:SendPM(wsBot, "Please fill up your share to reach "..DoShareUnits(limitshare)..". Presently you are sharing "..DoShareUnits(tonumber(share))..".")
            user:SendPM(wsBot, " - You have another "..DoTimeUnits(wtime).." left.")
            end
         else
            if tMoreUsers[user.sName] then
               user:SendPM(wsBot, "Fill up your share to reach "..DoShareUnits(limitshare)..". Presently you are sharing "..DoShareUnits(tonumber(share))..".")
               user:SendPM(wsBot, " - You have another "..DoTimeUnits(w2time - tMoreUsers[user.sName][1]).." left.")
            else   
               user:SendPM(wsBot, "Please fill up your share to reach "..DoShareUnits(limitshare)..". Presently you are sharing "..DoShareUnits(tonumber(share))..".")
               user:SendPM(wsBot, " - You have another "..DoTimeUnits(wtime - tUsers[user.sName][1]).." left.")
            end
         end
      end
   end
end

--- // --- Doing stuff on Timer ... that is every second ... under certain conditions the users are going to be warned or have actions casted on them ...
function OnTimer()
   for user, time in tUsers do
      local usr = GetItemByName(user)
      tUsers[user][1] = tUsers[user][1] + 1
      if usr and usr.sMyInfoString then
         _,_,share = strfind(usr.sMyInfoString, "%$(%d+)%$")
         if tonumber(share) < limitshare then
            if tUsers[user][1] >= (wtime) then
                  usr:SendPM(wsBot, "You didnt fill up your share to fulfill hub requirements.")
                  return Act(usr, TheAction)
            elseif ( tUsers[user][1] == bal*tUsers[user][2] ) then
               tUsers[user][2] = tUsers[user][2] + 1
               usr:SendPM(wsBot, "Please fill up ur share ... "..(tUsers[user][2]-1).."/ "..frequency.." warnings ... on the last warning you will get "..DoStringActions(TheAction)..".")
               usr:SendPM(wsBot, "- You have another "..DoTimeUnits(wtime - tUsers[user][1]).." left.")
            end
         else tUsers[usr.sName] = nil
         end
      end
   end
   for user, time in tMoreUsers do
      local usr = GetItemByName(user)
      tMoreUsers[user][1] = tMoreUsers[user][1] + 1
      if usr and usr.sMyInfoString then
         _,_,share = strfind(usr.sMyInfoString, "%$(%d+)%$")
         if tonumber(share) < limitshare then
            if tMoreUsers[user][1] >= (w2time) then
                  usr:SendPM(wsBot, "You didnt fill up your share to fulfill hub requirements.")
                  return Act(usr, The2Action)
            elseif ( tMoreUsers[user][1] == bal2 * tMoreUsers[user][2] ) then
               tMoreUsers[user][2] = tMoreUsers[user][2] + 1
               usr:SendPM(wsBot, "Please fill up ur share ... "..(tMoreUsers[user][2]-1).."/ "..secfrequency.." warnings ... on the last warning you will get "..DoStringActions(The2Action)..".")
               usr:SendPM(wsBot, "- You have another "..DoTimeUnits(w2time - tMoreUsers[user][1]).." left.")
            end
         else tMoreUsers[usr.sName] = nil
         end
      end
   end
   collectgarbage()
   flush()
end

function DoStringActions(act)
   local ret = ""
   local tActionStr = {
         [1] = "Disconnected",
         [2] = "Redirected",
         [3] = "Kicked",
         [4] = "Temporalily Banned",
         [5] = "Banned",
      };
   return tActionStr[act]
end


function DataArrival(user, data)
   if ( (user.sName == TheNick) and user.bOperator ) then
      data = strsub(data,1,strlen(data)-1)
      local s,e,cmd = strfind( data, "%b<>%s+(%S+)" )
      if cmd == TheCmd then
         local msg = "\r\n\t\t\t\t - ---==Users that are under the limit==--- -\r\n"
         msg = msg..strrep(" -", 110).."\r\n"
         msg = msg.."\t The following users are going to be "..DoStringActions(TheAction).." after their period of grace is over( initialy set to"..DoTimeUnits(wtime)..")\r\n"
         msg = msg..strrep(" -", 110).."\r\n"
         for nick , time in tUsers do
               if GetItemByName(nick) then
               status = "online"
               else status = "offline"
               end
               msg = msg.."\t - Nick : "..nick.."\t\t Time Left : "..DoTimeUnits(wtime - tUsers[nick][1]).."\t\t Warnings : "..(tUsers[nick][2]-1).."/ "..frequency.."\t\t Status : "..status.."\r\n"
         end
         msg = msg..strrep(" -", 110).."\r\n\r\n"
         msg = msg..strrep(" -", 110).."\r\n"
         msg = msg.."\t The following users are going to be "..DoStringActions(The2Action).." after their period of grace is over ( initialy set to"..DoTimeUnits(w2time)..")\r\n"
         msg = msg..strrep(" -", 110).."\r\n"
         for nick , time in tMoreUsers do
            if GetItemByName(nick) then
               status = "online"
            else status = "offline"
            end
            msg = msg.."\t - Nick : "..nick.."\t\t Time Left : "..DoTimeUnits(w2time - tMoreUsers[nick][1]).."\t\t Warnings : "..(tMoreUsers[nick][2]-1).."/ "..secfrequency.."\t\t Status : "..status.."\r\n"
         end
         msg = msg..strrep(" -", 110)
         SendPmToNick(TheNick, wsBot, msg)
      end
   end
end

--- // --- Transforming bytes Into KB, MB, GB, TB, PT and Returning the ideal (highest possible) Unit --- // ---
function DoShareUnits(intSize)            --- Thanks to kepp and NotRambitWombat
if intSize ~= 0 then
   local tUnits = { "Bytes", "KB", "MB", "GB", "TB" }
   intSize = tonumber(intSize);
   local sUnits;
   for index = 1, getn(tUnits) do
      if(intSize < 1024) then
         sUnits = tUnits[index];
         break;
      else
         intSize = intSize / 1024;
      end
   end
   return format("%0.1f %s",intSize, sUnits);
else return "nothing"
end
end

--- // --- Performing action and also informing the user about it ... It is handled from the ' TheAction ' variable ....
function Act(user, var)
   local tActions = {
      [1] = function(user) user:SendPM(wsBot, "You will now be Disconnected") user:Disconnect() end,
      [2] = function(user) user:SendPM(wsBot, "You will now be Redirected to "..frmHub:GetRedirectAddress()) user:SendData("$OpForceMove "..frmHub:GetRedirectAddress()) end,
      [3] = function(user) user:SendPM(wsBot, "You will now be Kicked") user:Kick() end,
      [4] = function(user) user:SendPM(wsBot, "You are temporalily Banned") user:TempBan() end,
      [5] = function(user) user:SendPM(wsBot, "You are permenantly Banned") user:Ban() end,
      };
   for i,v in tActions do
      if i == var then
         tUsers[user.sName] = nil
         if i ~=3 or i ~= 4 or i ~= 5 then
            tAgain[user.sName] = 1
         end
         return tActions(user)
      end
   end
   tActions = nil
end


function DoTimeUnits(time)
   local tTimes = {}
   local time = time * 1000
   if ( time >= 86400000 ) then
   repeat
      if tTimes[4] then
         tTimes[4] = tTimes[4] + 1
      else tTimes[4] = 1
      end
      time = time - 86400000
   until time < 86400000
   end

   if ( time >= 3600000 ) then
   repeat
      if tTimes[3] then
         tTimes[3] = tTimes[3] + 1
      else tTimes[3] = 1
      end
      time = time - 3600000
   until time < 3600000
   end

   if ( time >= 60000 ) then
   repeat
      if tTimes[2] then
         tTimes[2] = tTimes[2] + 1
      else tTimes[2] = 1
      end
      time = time - 60000
   until time < 60000
   end
   
   if ( time >= 1000 ) then
   repeat
      if tTimes[1] then
         tTimes[1] = tTimes[1] + 1
      else tTimes[1] = 1
      end
      time = time - 1000
   until time < 1000
   end
local msg = ""
local tTimeUns = { "seconds", "minutes", "hours", "days"}
for i,v in tTimes do
   msg = v.." "..tTimeUns.." "..msg
end
return msg
end
-------- -------- -------- -------- -------- -------- -------- --------
         --- script ends ---
-------- -------- -------- -------- -------- -------- -------- --------

juda

Syntax error: `=' expected;
                       
  last token read: `is' at line 1 in file `C:\Program Files\PtokaX ver 330\scripts\ShaveShare v4.1 correct.lua'
juda

Herodes

#31
QuoteOriginally posted by [G-T-E]Gate?
I have a question,
If I have my min users share set to 15Gb and I set this section to the following>>

limitshare = 2 * gb    --- this sets the share limit that needs to be reached by the user so that he doesnt get the action .. :) keep format ex: 5 *gb is 5GB ... and so on ..

will the script check to see if the user has added 2Gb to his share when he returns?
If you mean that the user has to have a share of 15GB(ur min) + 2gb (from that setting) = 17GB then the answer is no ...
if not then, yeah if he has the required share(2gb as set in that setting ...)  he will be taken out of the list of those users under_the_limt. . :)

Herodes

#32
QuoteOriginally posted by juda
Syntax error: `=' expected;
                       
  last token read: `is' at line 1 in file `C:\Program Files\PtokaX ver 330\scripts\ShaveShare v4.1 correct.lua'

Manson had pointed the mistake and fixed it in his post ...
I edited the code in the last post that contained one (last one on prev page of this thread..)
It should be working without errors now .. pls grab it again...

The error was caused by an uncommented line ( without the "--" in front)  in the begging of the script ...

To Manson : can you please [ code ] the script ... because it looks a bit too much like that :)) lol

Herodes

Another update ....
--- ShaveShare v4.5 request by judas ( 10/08 - 2004 )
--- by Herodes ( early hours of 11/08 - 2004 )
-------- -------- -------- -------- -------- -------- -------- -------- 
--- offers a way to handle under-the-share-limit users to enter your hub
--- it can disconnect/redirect/kick/tempban/ban after a certain configurable time...
--- it has a variable to say how many times to warn before disconnect
-- v3 changes 
--- Now there is a nick-to-send variable in place ... ( v 3 )
--- If you have that nick then use the command ' !noshare '  to show a list of the ppl that are in the bots list ...
-- v4 changes 
--- Now the users can enter again but the bot will remember them and act differently ( edit ' The2Action ' variable to change the behaviour ...)
--- You can also adjust the time for those ppl to be different than the ones that come for the first time. ( edit the ' w2time ' variable for that ...)
--- Edit the ' secfrequency ' variable to choose how many warnings these ppl will receive...
--- Made the messages of that the users receive aware of the action that is going to be taken if the requirments fail in the predifined time ....
--- I think it is fairly complete now ... if not give me a post 
--- --- v4.5 changes --- ---
--- now the list of users has a acsending count number infront of each user ...
--- and new command ' !disnoshare ' can only be used by the nick in the ' TheNick ' variable 
--- --- ^disconnects all users in the list and clears the scripts memory ... from both fresh users and second-time user lists 
-------- -------- -------- -------- -------- -------- -------- -------- 
--- do not edit ... or if you do dont blame me ---
tUsers = {}
tMoreUsers = {}
tAgain = {}
kb = 1024 
mb = 1024 ^ 2
gb = 1024 ^ 3
minutes = 60
hours = 60 ^2 
-------- -------- -------- -------- -------- -------- -------- -------- 
--- edit the values of the 11 following variables as you wish ---
-------- -------- -------- -------- -------- -------- -------- -------- 
wsBot = "ShaveShare" 	--- The name of the bot ... it is necessary ... don't include    s  p a c e s ...
TheCmd = "!noshare" 	--- The command for displaying the actual list of the ppl under the share limit ....
DisCmd = "!disnoshare" 	--- This drops all users that are below the share limit and clears the memory of the script ... 
TheNick = "Herodes" 	--- Who is allowed to use the command above ...
wtime = 24 * hours 		--- this is the time in seconds. .. Feel free to use the #*hours to say in # hours ... and  #*minutes to say in # minutes .. :)
frequency = 4 			--- this is the number of warnings the user is going to receive within the predifined time limit... 
w2time = 3 * hours		--- this is the time that a user entering with below share limit for the second time while have to fill up the requirement...
secfrequency = 2		--- this is how many times a user entering with below share limit for the second time is going to be warned in the time set by ' w2time ' variable...
limitshare = 500 * mb 	--- this sets the share limit that needs to be reached by the user so that he doesnt get the action .. :) keep format ex: 5 *gb is 5GB ... and so on ..
TheAction = 1 			--- this sets the action to take against these ppl .... ? 1 = disconnect , 2 = redirect , 3 = kick , 4 = tempban , 5 = ban ?
The2Action = 5 			--- this sets the action to take against the ppl that come back after they were given a first chance.... ? 1 = disconnect , 2 = redirect , 3 = kick , 4 = tempban , 5 = ban ?
-------- -------- -------- -------- -------- -------- -------- -------- 
			--- script starts ---
-------- -------- -------- -------- -------- -------- -------- -------- 
function Main()
	frmHub:UnregBot(wsBot)
	frmHub:RegBot(wsBot)
	SetTimer(1000)
	StartTimer()
	bal = floor(wtime/frequency)
	bal2 = floor(w2time/secfrequency)
end

--- // --- Actions to do if a new user is connected ... inform him about the time he has left to fill up his share if it is below the limit defined by ' limitshare ' variable
function NewUserConnected(user)
	if user.sMyInfoString then
		_,_,share = strfind(user.sMyInfoString, "%$(%d+)%$")
		if tonumber(share) < limitshare then
			if tUsers[user.sName] == nil then
				if tAgain[user.sName] == 1 then
					tAgain[user.sName] = nil
					tMoreUsers[user.sName] = {}
					tMoreUsers[user.sName][1] = 0
					tMoreUsers[user.sName][2] = 1
					user:SendPM(wsBot, "You come without having the required share of "..DoShareUnits(limitshare).." Again ?.Presently you are sharing "..DoShareUnits(tonumber(share))..".")
					user:SendPM(wsBot, "You now have just "..DoTimeUnits(w2time).." left to fill it up. If you dont you are getting "..DoStringActions(The2Action)..".")
				else
				tUsers[user.sName] = {} 
				tUsers[user.sName][1] = 0
				tUsers[user.sName][2] = 1
				user:SendPM(wsBot, "Please fill up your share to reach "..DoShareUnits(limitshare)..". Presently you are sharing "..DoShareUnits(tonumber(share))..".")
				user:SendPM(wsBot, " - You have another "..DoTimeUnits(wtime).." left.")
				end
			else 
				if tMoreUsers[user.sName] then
					user:SendPM(wsBot, "Fill up your share to reach "..DoShareUnits(limitshare)..". Presently you are sharing "..DoShareUnits(tonumber(share))..".")
					user:SendPM(wsBot, " - You have another "..DoTimeUnits(w2time - tMoreUsers[user.sName][1]).." left.")
				else	
					user:SendPM(wsBot, "Please fill up your share to reach "..DoShareUnits(limitshare)..". Presently you are sharing "..DoShareUnits(tonumber(share))..".")
					user:SendPM(wsBot, " - You have another "..DoTimeUnits(wtime - tUsers[user.sName][1]).." left.")
				end
			end
		end
	end
end

--- // --- Doing stuff on Timer ... that is every second ... under certain conditions the users are going to be warned or have actions casted on them ...
function OnTimer()
	for user, time in tUsers do
		local usr = GetItemByName(user)
		tUsers[user][1] = tUsers[user][1] + 1
		if usr and usr.sMyInfoString then
			_,_,share = strfind(usr.sMyInfoString, "%$(%d+)%$")
			if tonumber(share) < limitshare then
				if tUsers[user][1] >= (wtime) then
						usr:SendPM(wsBot, "You didnt fill up your share to fulfill hub requirements.")
						return Act(usr, TheAction)
				elseif ( tUsers[user][1] == bal*tUsers[user][2] ) then
					tUsers[user][2] = tUsers[user][2] + 1
					usr:SendPM(wsBot, "Please fill up ur share ... "..(tUsers[user][2]-1).."/ "..frequency.." warnings ... on the last warning you will get "..DoStringActions(TheAction)..".")
					usr:SendPM(wsBot, "- You have another "..DoTimeUnits(wtime - tUsers[user][1]).." left.")
				end
			else tUsers[usr.sName] = nil
			end
		end
	end
	for user, time in tMoreUsers do
		local usr = GetItemByName(user)
		tMoreUsers[user][1] = tMoreUsers[user][1] + 1
		if usr and usr.sMyInfoString then
			_,_,share = strfind(usr.sMyInfoString, "%$(%d+)%$")
			if tonumber(share) < limitshare then
				if tMoreUsers[user][1] >= (w2time) then
						usr:SendPM(wsBot, "You didnt fill up your share to fulfill hub requirements.")
						return Act(usr, The2Action)
				elseif ( tMoreUsers[user][1] == bal2 * tMoreUsers[user][2] ) then
					tMoreUsers[user][2] = tMoreUsers[user][2] + 1
					usr:SendPM(wsBot, "Please fill up ur share ... "..(tMoreUsers[user][2]-1).."/ "..secfrequency.." warnings ... on the last warning you will get "..DoStringActions(The2Action)..".")
					usr:SendPM(wsBot, "- You have another "..DoTimeUnits(w2time - tMoreUsers[user][1]).." left.")
				end
			else tMoreUsers[usr.sName] = nil
			end
		end
	end
	collectgarbage()
	flush()
end

function DoStringActions(act)
	local ret = ""
	local tActionStr = {
			[1] = "Disconnected",
			[2] = "Redirected",
			[3] = "Kicked",
			[4] = "Temporalily Banned",
			[5] = "Banned",
		};
	return tActionStr[act]
end


function DataArrival(user, data)
	if ( (user.sName == TheNick) and user.bOperator ) then
		data = strsub(data,1,strlen(data)-1)
		local s,e,cmd = strfind( data, "%b<>%s+(%S+)" )
		if cmd == TheCmd then
			local cnt = 0
			local seccnt = 0
			local msg = "\r\n\t\t\t\t - ---==Users that are under the limit==--- -\r\n"
			msg = msg..strrep(" -", 110).."\r\n"
			msg = msg.."\t The following users are going to be "..DoStringActions(TheAction).." after their period of grace is over( initialy set to"..DoTimeUnits(wtime)..")\r\n"
			msg = msg..strrep(" -", 110).."\r\n"
			for nick , time in tUsers do
					if GetItemByName(nick) then
					status = "online"
					else status = "offline"
					end
					cnt = cnt + 1
					msg = msg..cnt..".\t - Nick : "..nick.."\t Time Left : "..DoTimeUnits(wtime - tUsers[nick][1]).."\t Warnings : "..(tUsers[nick][2]-1).."/ "..frequency.."\t Status : "..status.."\r\n"
			end
			msg = msg..strrep(" -", 110).."\r\n\r\n"
			msg = msg..strrep(" -", 110).."\r\n"
			msg = msg.."\t The following users are going to be "..DoStringActions(The2Action).." after their period of grace is over ( initialy set to"..DoTimeUnits(w2time)..")\r\n"
			msg = msg..strrep(" -", 110).."\r\n"
			for nick , time in tMoreUsers do
				if GetItemByName(nick) then
					status = "online"
				else status = "offline"
				end
				seccnt = seccnt + 1
				msg = msg..seccnt..".\t - Nick : "..nick.."\t Time Left : "..DoTimeUnits(w2time - tMoreUsers[nick][1]).."\t Warnings : "..(tMoreUsers[nick][2]-1).."/ "..secfrequency.."\t Status : "..status.."\r\n"
			end
			msg = msg..strrep(" -", 110)
			SendPmToNick(TheNick, wsBot, msg)
		elseif cmd == DisCmd then
			for nick, v in tUsers do
			local usr = GetItemByName(nick)
				if usr then
					usr:SendPM(wsBot, user.sName.." said you have to leave because your share was not enough for this hub ...")
					usr:Disconnect()
				end
			end
			for nick, v in tMoreUsers do 
			local usr = GetItemByName(nick)
				if usr then
					usr:SendPM(wsBot, user.sName.." said you have to leave because your share was not enough for this hub ...")
					usr:Disconnect()
				end
			end
			tUsers = {}
			tMoreUsers= {}
		end
	end
end

--- // --- Transforming bytes Into KB, MB, GB, TB, PT and Returning the ideal (highest possible) Unit --- // ---
function DoShareUnits(intSize)				--- Thanks to kepp and NotRambitWombat
if intSize ~= 0 then
	local tUnits = { "Bytes", "KB", "MB", "GB", "TB" }
	intSize = tonumber(intSize);
	local sUnits;
	for index = 1, getn(tUnits) do
		if(intSize < 1024) then
			sUnits = tUnits[index];
			break;
		else 
			intSize = intSize / 1024;
		end
	end
	return format("%0.1f %s",intSize, sUnits);
else return "nothing"
end
end

--- // --- Performing action and also informing the user about it ... It is handled from the ' TheAction ' variable ....
function Act(user, var)
	local tActions = {
		[1] = function(user) user:SendPM(wsBot, "You will now be Disconnected") user:Disconnect() end,
		[2] = function(user) user:SendPM(wsBot, "You will now be Redirected to "..frmHub:GetRedirectAddress()) user:SendData("$OpForceMove "..frmHub:GetRedirectAddress()) end,
		[3] = function(user) user:SendPM(wsBot, "You will now be Kicked") user:Kick() end,
		[4] = function(user) user:SendPM(wsBot, "You are temporalily Banned") user:TempBan() end,
		[5] = function(user) user:SendPM(wsBot, "You are permenantly Banned") user:Ban() end,
		};
	for i,v in tActions do
		if i == var then
			tUsers[user.sName] = nil
			if i ~=3 or i ~= 4 or i ~= 5 then
				tAgain[user.sName] = 1
			end
			return tActions[i](user)
		end
	end
	tActions = nil
end


function DoTimeUnits(time)
	local tTimes = {}
	local time = time * 1000
	if ( time >= 86400000 ) then
	repeat 
		if tTimes[4] then
			tTimes[4] = tTimes[4] + 1
		else tTimes[4] = 1
		end
		time = time - 86400000 
	until time < 86400000
	end

	if ( time >= 3600000 ) then
	repeat 
		if tTimes[3] then
			tTimes[3] = tTimes[3] + 1
		else tTimes[3] = 1
		end
		time = time - 3600000 
	until time < 3600000
	end

	if ( time >= 60000 ) then
	repeat
		if tTimes[2] then
			tTimes[2] = tTimes[2] + 1
		else tTimes[2] = 1
		end
		time = time - 60000
	until time < 60000
	end
	
	if ( time >= 1000 ) then
	repeat 
		if tTimes[1] then
			tTimes[1] = tTimes[1] + 1
		else tTimes[1] = 1
		end
		time = time - 1000
	until time < 1000
	end
local msg = ""
local tTimeUns = { "seconds", "minutes", "hours", "days"}
for i,v in tTimes do 
	msg = v.." "..tTimeUns[i].." "..msg
end
return msg
end


Keep posting guys the previous posts are the cause of this update

Herodes

The post above had the changelog cut because it wouldnt fit in the maximum characters per post ... i dont know how to give this script out if it gets bigger ... any ideas are welcome.
ty

juda

B ?! I`m stupid,ya !!!
Now copy v4 and v4.1 as you say and work great....
I already tested v4 & 4.1.....I think I stick today on v4.1
I`ll will restart my hub around 20.00 and then I put v4.1 to run 12 hours....and will see
In that time will check your updates and tested new versions like mad on my testing hub !!!!
                                                                         
UUUU,just 1 little update:
Please in the next version,if you can,put text into bot "ShaveShare" description......
Show in description: [All you guys who work on this script....nicknames or names,you know who work on this script] please don`t forgett to put your name in......
It will be nice to see who are doing good stuff !!!

     Until next time........bay
juda

Herodes

QuoteOriginally posted by juda
B ?! I`m stupid,ya !!!
Now copy v4 and v4.1 as you say and work great....
I already tested v4 & 4.1.....I think I stick today on v4.1
I`ll will restart my hub around 20.00 and then I put v4.1 to run 12 hours....and will see
In that time will check your updates and tested new versions like mad on my testing hub !!!!
                                                                         
UUUU,just 1 little update:
Please in the next version,if you can,put text into bot "ShaveShare" description......
Show in description: [All you guys who work on this script....nicknames or names,you know who work on this script] please don`t forgett to put your name in......
It will be nice to see who are doing good stuff !!!

     Until next time........bay
Thanks for the feedback :)
I will put the description in the bot ... np :)
But I need a way to post it in one post ... I think it will solve many problems for you guys ...  so pls come up with ideas ... maybe I could upload it somewhere ?

NightLitch

Looking good Herodes...

About the Connection Checks u can if u want todo an overkill table make it...

ex:

Table = {
["56Kbps"] = {Time = 24, ShareLimit = 500 * mb},
["LAN(T1)"] = {Time = 18, ShareLimit = 1 * gb},
}

hope it helps some, just an idea... don't now what I where thinkin, but somethin in that direction...

/NL
//NL

Herodes

gracias Nightlitch .. :) I think I know where that goes ... I just need a way for it to fit smoothly ..
:)

PS: Oooh now I am in trouble :D

NightLitch

some updated code on my version, should be better now:

--------------------------------------------------------
-- Share Warning - By: NightLitch - 2004/08/10
-- Request By: Juda
-- NOTE: NoShare Table is erased when Script is Restarted !!
-- Some Modification Done
-- Changed so it send in PM
-- Some Fixes done with help from Herodes =)
--------------------------------------------------------
KB = 1024
MB = KB*KB
GB = KB*KB*KB
TB = KB*KB*KB*KB
Sec  = 1000
Min  = 60*Sec
Hour = 60*Min
TmrFreq = 1000
--------------------------------------------------------
--// Editable Part Start's Here \\--
--------------------------------------------------------
BotName = "-Share-Warning-"		-- Set Botname

MinShareLimit = 500	 -- Set Share Limit
MinShareUnit = MB	 -- Set Share Unit ( KB, MB, GB, TB )

NoShareTimeLimit = 1	 -- Set Time Limit in hours for checking if share is more then 0 MB etc.
ShareUpdateTimeLimit = 1	-- Set Time Limit in hours for checking if share is updated after x hours
NoShareMessage = "You're welcome to stay in this hub, BUT you need to fill your Share with "..MinShareLimit.." MB within "..NoShareTimeLimit.." Hours to stay!"
--------------------------------------------------------
--// Code Starts Here \\--
--------------------------------------------------------
NoShare = {}
tTab = {n=0}

function Main()
	frmHub:RegBot(BotName)
	SetTimer(TmrFreq)
	StartTimer()
	RegTimer(NoShareCheck, 1*Sec)
	RegTimer(ShareUpdatedCheck, 1*Sec)
end

function ShareUpdatedCheck()
	for Nickname, Table in NoShare do
			User = GetItemByName(Nickname)
			if User then
				local _,_,h,m,s = strfind(Table[2], "(%d+):(%d+):(%d+)")
				h = h + ShareUpdateTimeLimit
				if h >= 24 then h = h -24 end
				if h..":"..m..":"..s == date("%T") then
					local _,_,CurrentShare = strfind(User.sMyInfoString, "(%d+)%$%|$")
					if tonumber(CurrentShare) <= tonumber(Table[1]) then
						SendPmToNick(Nickname, BotName, "You haven't raised your share within "..ShareUpdateTimeLimit.." Hours and your share is still "..format("%.2f",Table[1]/1024/1024).." MB !!")
						SendPmToNick(Nickname, BotName, "You are Disconnected!!")
						User:Disconnect()
						NoShare[Nickname] = nil
					end
			end
		end
	end
end

function NoShareCheck()
	for Nickname, Share in NoShare do
		if tonumber(Share) == 0 then
			User = GetItemByName(Nickname)
			if User then
				local _,_,h,m,s = strfind(Table[2], "(%d+):(%d+):(%d+)")
				h = h + NoShareTimeLimit
				if h >= 24 then h = h -24 end
				if h..":"..m..":"..s == date("%T") then
					SendPmToNick(Nickname, BotName, "You have been online for "..NoShareTimeLimit.." Hours and your share is still "..format("%.2f",Share/1024/1024).." MB !!")
					SendPmToNick(Nickname, BotName, "You are Disconnected!!")
					User:Disconnect()
					NoShare[Nickname] = nil
				end
			end
		end
	end
end

function UserDisconnect(sUser)
	NoShare[sUser.sName] = nil
end

function DataArrival(sUser,sData)
	if strsub(sData, 1,7) == "$MyINFO" then
		local s,e,sShare = strfind(sData, "(%d+)%$%|$")
		NoShare[sUser.sName] = {sShare,date("%T")}
		if tonumber(sShare) == 0 then
			SendPmToNick(sUser.sName, BotName, "\r\n\t -------==[ NOTICE !! ]===================================================-------")
			SendPmToNick(sUser.sName, BotName, "\r\n\t "..NoShareMessage)
			SendPmToNick(sUser.sName, BotName, "\r\n\t -------===============================================================-------\r\n\r\n")
		end
	end
end

function OnTimer()
	for i=1, getn(tTab) do
		tTab[i].count = tTab[i].count + 1
		if tTab[i].count > tTab[i].trig then
			tTab[i].count=1
			tTab[i]:func()
		end
	end
end

function RegTimer(f, Interval)
	local tmpTrig = Interval / TmrFreq
	assert(Interval >= TmrFreq , "RegTimer(): Please Adjust TmrFreq")
	local Timer = {n=0}
	Timer.func=f
	Timer.trig=tmpTrig
	Timer.count=1
	tinsert(tTab, Timer)
end


/NL
//NL

juda

I copy your script.....thanks again !!!

Now I have 1 or 2 questions,,,,Please to any replay !!!!
It is possible to do or already  exist any script to make sound like "pip" in the mainchat,when user say "a".....
In DC++ only make sounds when you get PM from user.....
I want to make sound,whan is any word  written in mainchat.....
Also heard that sounds have BCDC++ client ???I`m write or wrong ???
It is happend,that I don`t know,whan any user say something in mainchat !!!
This I need,becouse I`m on the web or looking into my computer,
in the mintime,user ask for help and I even don`t know that someone say something.....
uuu.sorry for my spelling [not very good in english]

Please for help or I must send new thread in forum ???


Please for help.....Thhhhhhhhhaaaaaannnnnnnkkkkkkksssssss
juda

Herodes

#41
update for the my script request added .. :)
--- ShaveShare v4.6 request by judas ( 10/08 - 2004 )
--- by Herodes ( 11/08 - 2004 )
-------- -------- -------- -------- -------- -------- -------- -------- 
--- Offers a way to handle under-the-share-limit users to enter your hub
--- It can disconnect/redirect/kick/tempban/ban (' TheAction ' variable) after a certain configurable time...
--- Warns for defined times ( ' frequency ' variable ) to the timelimit ( ' wtime ' variable ) before the action
--- Remebers where users left off if they disconnect and connect again
--- Adjustable required limit for the share (kb , mb , gb )
--- ---  v3 changes --- --- 
--- Now there is an allowed nick ( ' TheNick ' Variable ) to use the command
--- Command ' !noshare ' ( ' TheCmd ' variable ) shows a list of the ppl that are in the bots list
--- --- v4 changes --- --- 
--- Now the users can enter again but the bot will remember them and act differently ( edit ' The2Action ' variable to change the behaviour )
--- You can also adjust the time for those ppl to be different than the ones that come for the first time. ( ' w2time ' variable )
--- Edit the ' secfrequency ' variable to choose how many warnings these ppl will receive
--- Made the messages of that the users receive aware of the action that is going to be taken
--- --- v4.5 changes --- ---
--- now the list of users has a acsending count number infront of each user ...
--- Command ' !disnoshare ' (' DisCmd ' variable ) disconnects all users in the lists of the bot that are online and clears the scripts memory
--- --- v4.6 changes --- ---
--- optimized the script less lines and less code .. :)
--- installed Bot information
-------- -------- -------- -------- -------- -------- -------- -------- 
--- ( Last Update 12/8 - 2004 )
-------- -------- -------- -------- -------- -------- -------- -------- 
--- do not edit ... or if you do dont blame me ---
tUsers = {}
tMoreUsers = {}
tAgain = {}
kb = 1024 
mb = 1024 ^ 2
gb = 1024 ^ 3
minutes = 60
hours = 60 ^2 
wsBotDesc = "Made by Herodes idea by juda (thnx Nightlitch)"	
wsBotEmail = "http://board.univ-angers.fr"
-------- -------- -------- -------- -------- -------- -------- -------- 
--- edit the values of the 11 following variables as you wish ---
-------- -------- -------- -------- -------- -------- -------- -------- 
wsBot = "ShaveShare" 	--- The name of the bot ... it is necessary ... don't include    s  p a c e s ...
TheCmd = "!noshare" 	--- The command for displaying the actual list of the ppl under the share limit ....
DisCmd = "!disnoshare" 	--- This drops all users that are below the share limit and clears the memory of the script ... 
TheNick = "Herodes" 	--- Who is allowed to use the command above ...
wtime = 24 * hours 		--- this is the time in seconds. .. Feel free to use the #*hours to say in # hours ... and  #*minutes to say in # minutes .. :)
frequency = 4 			--- this is the number of warnings the user is going to receive within the predifined time limit... 
w2time = 12 * hours		--- this is the time that a user entering with below share limit for the second time while have to fill up the requirement...
secfrequency = 2		--- this is how many times a user entering with below share limit for the second time is going to be warned in the time set by ' w2time ' variable...
limitshare = 500 * mb 	--- this sets the share limit that needs to be reached by the user so that he doesnt get the action .. :) keep format ex: 5 *gb is 5GB ... and so on ..
TheAction = 1 			--- this sets the action to take against these ppl .... ? 1 = disconnect , 2 = redirect , 3 = kick , 4 = tempban , 5 = ban ?
The2Action = 5 			--- this sets the action to take against the ppl that come back after they were given a first chance.... ? 1 = disconnect , 2 = redirect , 3 = kick , 4 = tempban , 5 = ban ?

-------- -------- -------- -------- -------- -------- -------- -------- Script Starts
function Main()
	frmHub:UnregBot(wsBot)
	frmHub:RegBot(wsBot)
	SetTimer(1000)
	StartTimer()
	bal = floor(wtime/frequency)
	bal2 = floor(w2time/secfrequency)
	DoBotInfo()
end

function OpConnected(user)
		DoBotInfo(user)
end
--- // --- Actions to do if a new user is connected ... inform him about the time he has left to fill up his share if it is below the limit defined by ' limitshare ' variable
function NewUserConnected(user)
	if user.sMyInfoString then
		_,_,share = strfind(user.sMyInfoString, "%$(%d+)%$")
		if tonumber(share) < limitshare then
			if tUsers[user.sName] == nil then
				if tAgain[user.sName] == 1 then
					tAgain[user.sName] = nil
					tMoreUsers[user.sName] = {}
					tMoreUsers[user.sName][1] = 0
					tMoreUsers[user.sName][2] = 1
					user:SendPM(wsBot, "You come without having the required share of "..DoShareUnits(limitshare).." Again ?.Presently you are sharing "..DoShareUnits(tonumber(share))..".")
					user:SendPM(wsBot, "You now have just "..DoTimeUnits(w2time).." left to fill it up. If you dont you are getting "..DoStringActions(The2Action)..".")
				else
				tUsers[user.sName] = {} 
				tUsers[user.sName][1] = 0
				tUsers[user.sName][2] = 1
				user:SendPM(wsBot, "Please fill up your share to reach "..DoShareUnits(limitshare)..". Presently you are sharing "..DoShareUnits(tonumber(share))..".")
				user:SendPM(wsBot, " - You have another "..DoTimeUnits(wtime).." left.")
				end
			else 
				if tMoreUsers[user.sName] then
					user:SendPM(wsBot, "Fill up your share to reach "..DoShareUnits(limitshare)..". Presently you are sharing "..DoShareUnits(tonumber(share))..".")
					user:SendPM(wsBot, " - You have another "..DoTimeUnits(w2time - tMoreUsers[user.sName][1]).." left.")
				else	
					user:SendPM(wsBot, "Please fill up your share to reach "..DoShareUnits(limitshare)..". Presently you are sharing "..DoShareUnits(tonumber(share))..".")
					user:SendPM(wsBot, " - You have another "..DoTimeUnits(wtime - tUsers[user.sName][1]).." left.")
				end
			end
		end
	end
	DoBotInfo(user)
end

function DoBotInfo(user)
	if user ~= nil then
		user:SendData("$MyINFO $ALL "..wsBot.." "..wsBotDesc.."<++V:0.4.6,M:A,H0/0/1,S:1>$ $LAN(T3)$"..wsBotEmail.."$0$|")
	else SendToAll("$MyINFO $ALL "..wsBot.." "..wsBotDesc.."<++V:0.4.6,M:A,H0/0/1,S:1>$ $LAN(T3)$"..wsBotEmail.."$0$|")
	end
end
--- // --- Doing stuff on Timer ... that is every second ... under certain conditions the users are going to be warned or have actions casted on them ...
function OnTimer()
	TakeCare(tUsers, wtime, bal, frequency, TheAction)
	TakeCare(tMoreUsers, w2time, bal2, secfrequency, The2Action)
	collectgarbage()
	flush()
end

function TakeCare(table, timeallowed, balance, freq, doaction)
	for user, time in table do
		local usr = GetItemByName(user)
		table[user][1] = table[user][1] + 1
		if usr and usr.sMyInfoString then
			_,_,share = strfind(usr.sMyInfoString, "%$(%d+)%$")
			if tonumber(share) < limitshare then
				if ( table[user][1] >= timeallowed ) then
						usr:SendPM(wsBot, "You didnt fill up your share to fulfill hub requirements.")
						return Act(usr, doaction)
				elseif ( table[user][1] == balance * table[user][2] ) then
					table[user][2] = table[user][2] + 1
					usr:SendPM(wsBot, "Please fill up ur share ... "..(table[user][2]-1).."/ "..freq.." warnings ... on the last warning you will get "..DoStringActions(doaction)..".")
					usr:SendPM(wsBot, "- You have another "..DoTimeUnits(timeallowed - table[user][1]).." left.")
				end
			else table[usr.sName] = nil
			end
		end
	end
end


function DoStringActions(act)
	local ret = ""
	local tActionStr = {
			[1] = "Disconnected",
			[2] = "Redirected",
			[3] = "Kicked",
			[4] = "Temporalily Banned",
			[5] = "Banned",
		};
	return tActionStr[act]
end


function DataArrival(user, data)
	if ( (user.sName == TheNick) and user.bOperator ) then
		data = strsub(data,1,strlen(data)-1)
		local s,e,cmd = strfind( data, "%b<>%s+(%S+)" )
		if cmd == TheCmd then
			local msg = "\r\n\t\t\t\t - ---==Users that are under the limit==--- -\r\n"
			msg = msg..strrep(" -", 110).."\r\n"
			msg = msg.."\t The following users are going to be "..DoStringActions(TheAction).." after their period of grace is over( initialy set to "..DoTimeUnits(wtime)..")\r\n"
			msg = msg..strrep(" -", 110).."\r\n"..DoList(tUsers, wtime, frequency)
			msg = msg..strrep(" -", 110).."\r\n\r\n"
			msg = msg..strrep(" -", 110).."\r\n"
			msg = msg.."\t The following users are going to be "..DoStringActions(The2Action).." after their period of grace is over ( initialy set to "..DoTimeUnits(w2time)..")\r\n"
			msg = msg..strrep(" -", 110).."\r\n"..DoList(tMoreUsers, w2time, secfrequency)
			msg = msg..strrep(" -", 110)
			SendPmToNick(TheNick, wsBot, msg)
		elseif cmd == DisCmd then
			TableClear(tUsers)
			TableClear(tMoreUsers)
		end
	end
end

function DoList(table, timeallowed, freq)
	local msg = ""
	local cnt = 0
	for nick , time in table do
		if GetItemByName(nick) then
			status = "online"
		else status = "offline"
		end
		cnt = cnt + 1
		msg = msg..cnt..".\t - Nick : "..nick.."\t Time Left : "..DoTimeUnits(timeallowed - table[nick][1]).."\t Warnings : "..(table[nick][2]-1).."/ "..freq.."\t Status : "..status.."\r\n"
	end
	return msg
end


function TableClear(table)
	for nick, v in table do 
		local usr = GetItemByName(nick)
		if usr then
			usr:SendPM(wsBot, TheNick.." said you have to leave because your share was not enough for this hub ...")
			usr:Disconnect()
		end
	end
	table = {}
end

--- // --- Transforming bytes Into KB, MB, GB, TB, PT and Returning the ideal (highest possible) Unit --- // ---
function DoShareUnits(intSize)				--- Thanks to kepp and NotRambitWombat
if intSize ~= 0 then
	local tUnits = { "Bytes", "KB", "MB", "GB", "TB" }
	intSize = tonumber(intSize);
	local sUnits;
	for index = 1, getn(tUnits) do
		if(intSize < 1024) then
			sUnits = tUnits[index];
			break;
		else 
			intSize = intSize / 1024;
		end
	end
	return format("%0.1f %s",intSize, sUnits);
else return "nothing"
end
end

--- // --- Performing action and also informing the user about it ... It is handled from the ' TheAction ' variable ....
function Act(user, var)
	local tActions = {
		[1] = function(user) user:SendPM(wsBot, "You will now be Disconnected") user:Disconnect() end,
		[2] = function(user) user:SendPM(wsBot, "You will now be Redirected to "..frmHub:GetRedirectAddress()) user:SendData("$OpForceMove "..frmHub:GetRedirectAddress()) end,
		[3] = function(user) user:SendPM(wsBot, "You will now be Kicked") user:Kick() end,
		[4] = function(user) user:SendPM(wsBot, "You are temporalily Banned") user:TempBan() end,
		[5] = function(user) user:SendPM(wsBot, "You are permenantly Banned") user:Ban() end,
		};
	for i,v in tActions do
		if i == var then
			tUsers[user.sName] = nil
			if i ~=3 or i ~= 4 or i ~= 5 then
				tAgain[user.sName] = 1
			end
			return tActions[i](user)
		end
	end
	tActions = nil
end


function DoTimeUnits(time)
	local tTimes = {}
	local time = time * 1000
	if ( time >= 86400000 ) then
	repeat 
		if tTimes[4] then
			tTimes[4] = tTimes[4] + 1
		else tTimes[4] = 1
		end
		time = time - 86400000 
	until time < 86400000
	end

	if ( time >= 3600000 ) then
	repeat 
		if tTimes[3] then
			tTimes[3] = tTimes[3] + 1
		else tTimes[3] = 1
		end
		time = time - 3600000 
	until time < 3600000
	end

	if ( time >= 60000 ) then
	repeat
		if tTimes[2] then
			tTimes[2] = tTimes[2] + 1
		else tTimes[2] = 1
		end
		time = time - 60000
	until time < 60000
	end
	
	if ( time >= 1000 ) then
	repeat 
		if tTimes[1] then
			tTimes[1] = tTimes[1] + 1
		else tTimes[1] = 1
		end
		time = time - 1000
	until time < 1000
	end
local msg = ""
local tTimeUns = { "seconds", "minutes", "hours", "days"}
for i,v in tTimes do 
	msg = v.." "..tTimeUns[i].." "..msg
end
return msg
end
-------- -------- -------- -------- -------- -------- -------- --------  Script Ends

I havent touched the connections issue .... I will but I dont promise anything ...

Herodes

#42
QuoteOriginally posted by juda
I copy your script.....thanks again !!!

Now I have 1 or 2 questions,,,,Please to any replay !!!!
It is possible to do or already  exist any script to make sound like "pip" in the mainchat,when user say "a".....
In DC++ only make sounds when you get PM from user.....
I want to make sound,whan is any word  written in mainchat.....
Also heard that sounds have BCDC++ client ???I`m write or wrong ???
It is happend,that I don`t know,whan any user say something in mainchat !!!
This I need,becouse I`m on the web or looking into my computer,
in the mintime,user ask for help and I even don`t know that someone say something.....
uuu.sorry for my spelling [not very good in english]

Please for help or I must send new thread in forum ???


Please for help.....Thhhhhhhhhaaaaaannnnnnnkkkkkkksssssss

Yeah it can be done for sure .. and you are right about BCDC++ the client side lua script exists here
But if u want it in PtokaX better start another thread .. this one is for this specific script we are making here ... if it is for another script completely better have it on another thread ... :)

juda

Thanks for update and your advice on post.....
I open new thread.....& will see

  Again.....gracie for all
juda

juda

I tested script and get this errors:

Syntax error: attempt to index local `user' (a nil value)
stack traceback:

   1:  function `DoBotInfo' at line 76 [file `...iles\PtokaX ver 330\scripts\ShaveShare v4.6.lua']
   2:  function `Main' at line 34 [file `...iles\PtokaX ver 330\scripts\ShaveShare v4.6.lua']

Or it is me again.....I copy just like others !!!

     Good night
juda

Herodes

QuoteOriginally posted by juda
I tested script and get this errors:

Syntax error: attempt to index local `user' (a nil value)
stack traceback:

   1:  function `DoBotInfo' at line 76 [file `...iles\PtokaX ver 330\scripts\ShaveShare v4.6.lua']
   2:  function `Main' at line 34 [file `...iles\PtokaX ver 330\scripts\ShaveShare v4.6.lua']

Or it is me again.....I copy just like others !!!

     Good night
Above script is fixed ... :) sorry bout that ... grab again ... :)

juda

Yo my man!!!
I tested v4.6 little more and work script ok.....just
 - Options to disconnect;timeban & ban user working good [1 time & 2 time]...ok
 - Problem is if I set to 3"kick" option [1 time] & 3"kick"[2 time]
   Then after time run out,will not kick,but stay connected.....
 - Then I set option 1"disconnected" [1 time] & 3"kick"[2 time]
   When [1 time] run out,disconnect user normaly....good
   But when [2 time]run out,user wont kick [stay online] and in PM displays randomly every 2 sec. - You will now be Kicked.....and on and on...

I think is something wrong with option to "kick" user on [2 time]
Everytime when I set "kick" all goes wrong......help
   
              good day
juda

Herodes

--- ShaveShare v4.8 request by judas ( 10/08 - 2004 )
--- by Herodes ( 11/08 - 2004 )
-------- -------- -------- -------- -------- -------- -------- -------- 
--- Offers a way to handle under-the-share-limit users to enter your hub
--- It can disconnect/redirect/kick/tempban/nickban/ban/flood (' TheAction ' variable) after a certain configurable time...
--- Warns for defined times ( ' frequency ' variable ) to the timelimit ( ' wtime ' variable ) before the action
--- Remebers where users left off if they disconnect and connect again
--- Adjustable required limit for the share (kb , mb , gb )
--v3
--- Now there is an allowed nick ( ' TheNick ' Variable ) to use the command
--- Command ' !noshare ' ( ' TheCmd ' variable ) shows a list of the ppl that are in the bots list
--v4
--- Now the users can enter again but the bot will remember them and act differently ( edit ' The2Action ' variable to change the behaviour )
--- You can also adjust the time for those ppl to be different than the ones that come for the first time. ( ' w2time ' variable )
--- Edit the ' secfrequency ' variable to choose how many warnings these ppl will receive
--- Made the messages of that the users receive aware of the action that is going to be taken
--v4.5
--- now the list of users has a acsending count number infront of each user ...
--- Command ' !disnoshare ' (' DisCmd ' variable ) disconnects all users in the lists of the bot that are online and clears the scripts memory
--v4.6 changes
--- optimized the script less lines and less code .. :)
--- installed Bot information
--v 4.8 changes
--- added NickBan, TimeBan ( 'bantime ' variable ), Flood ( ' floodTimes ' variable ) actions...
--- ( Last Update 13/8 - 2004 )

--- // --- do not edit ... or if you do dont blame me ---
tUsers = {}
tMoreUsers = {}
tAgain = {}
kb = 1024 
mb = 1024 ^ 2
gb = 1024 ^ 3
minutes = 60
hours = 60 ^2 
wsBotDesc = "Made by Herodes idea by juda (thnx Nightlitch)"	
wsBotEmail = "http://board.univers-angers.net"

--- // --- edit the values of the 13 following variables as you wish ---
wsBot = "ShaveShare" 	--- The name of the bot (necessary) don't include    s  p a c e s
TheCmd = "!noshare" 	--- The command for displaying the actual list of the ppl under the share limit
DisCmd = "!disnoshare" 	--- This drops all users that are below the share limit and clears the memory of the script
TheNick = "Herodes" 	--- Who is allowed to use the command above
wtime = 10 		--- this is the time in seconds. .. Feel free to use the #*hours to say in # hours ... and  #*minutes to say in # minutes .. :)
frequency = 4 			--- this is the number of warnings the user is going to receive within the predifined time limit
w2time = 10		--- this is the time that a user entering with below share limit for the second time while have to fill up the requirement
secfrequency = 2		--- this is how many times a user entering with below share limit for the second time is going to be warned in the time set by ' w2time ' variable.
limitshare = 500 * mb 	--- this sets the share limit that needs to be reached by the user so that he doesnt get the action .. :) keep format ex: 5 *gb is 5GB ... and so on
--- for the two variables below ( TheAction & The2Action ) use these ? 1 = disconnect , 2 = redirect , 3 = kick , 4 = tempban , 5 = ban, 6 = nickban, 7 = timeban, 8 = flood&disconnect ?
TheAction = 1 			--- this sets the action to take against these ppl
The2Action = 8 			--- this sets the action to take against the ppl that come back after they were given a first chance
bantime = 20 			--- the time for the Time Ban action in minutes
floodTimes = 100		--- how many times the user may be flooded
floodMsg = "You should have done something about it ..." 		--- the message the user will be flooded with

--- // --- Script Starts
function Main()
	frmHub:UnregBot(wsBot)
	frmHub:RegBot(wsBot)
	SetTimer(1000)
	StartTimer()
	bal = floor(wtime/frequency)
	bal2 = floor(w2time/secfrequency)
	DoBotInfo()
end

function OpConnected(user)
		DoBotInfo(user)
end
--- // --- Actions to do if a new user is connected ... inform him about the time he has left to fill up his share if it is below the limit defined by ' limitshare ' variable
function NewUserConnected(user)
	if user.sMyInfoString then
		_,_,share = strfind(user.sMyInfoString, "%$(%d+)%$")
		if tonumber(share) < limitshare then
			if tUsers[user.sName] == nil then
				if tAgain[user.sName] == 1 then
					tAgain[user.sName] = nil
					tMoreUsers[user.sName] = {}
					tMoreUsers[user.sName][1] = 0
					tMoreUsers[user.sName][2] = 1
					user:SendPM(wsBot, "You come without having the required share of "..DoShareUnits(limitshare).." Again ?.Presently you are sharing "..DoShareUnits(tonumber(share))..".")
					user:SendPM(wsBot, "You now have just "..DoTimeUnits(w2time).." left to fill it up. If you dont you are getting "..DoStringActions(The2Action)..".")
				else
				tUsers[user.sName] = {} 
				tUsers[user.sName][1] = 0
				tUsers[user.sName][2] = 1
				user:SendPM(wsBot, "Please fill up your share to reach "..DoShareUnits(limitshare)..". Presently you are sharing "..DoShareUnits(tonumber(share))..".")
				user:SendPM(wsBot, " - You have another "..DoTimeUnits(wtime).." left.")
				end
			else 
				if tMoreUsers[user.sName] then
					user:SendPM(wsBot, "Fill up your share to reach "..DoShareUnits(limitshare)..". Presently you are sharing "..DoShareUnits(tonumber(share))..".")
					user:SendPM(wsBot, " - You have another "..DoTimeUnits(w2time - tMoreUsers[user.sName][1]).." left.")
				else	
					user:SendPM(wsBot, "Please fill up your share to reach "..DoShareUnits(limitshare)..". Presently you are sharing "..DoShareUnits(tonumber(share))..".")
					user:SendPM(wsBot, " - You have another "..DoTimeUnits(wtime - tUsers[user.sName][1]).." left.")
				end
			end
		end
	end
	DoBotInfo(user)
end

function FloodU(user)
	local cnt = 0
	for i = 1, floodTimes do
		cnt = cnt + 1
		SendPmToNick(user.sName, wsBot, floodMsg.." "..cnt.."/"..floodTimes)
		if (cnt == floodTimes) then
			user:Disconnect()
		end
	end
end

function DoBotInfo(user)
	InfoStr = "$MyINFO $ALL "..wsBot.." "..wsBotDesc.."<++V:0.4.6,M:A,H0/0/1,S:1>$ $LAN(T3)$"..wsBotEmail.."$0$|"
	if user ~= nil then
		user:SendData(InfoStr)
	else SendToAll(InfoStr)
	end
end
--- // --- Doing stuff on Timer ... that is every second ... under certain conditions the users are going to be warned or have actions casted on them ...
function OnTimer()
	TakeCare(tUsers, wtime, bal, frequency, TheAction)
	TakeCare(tMoreUsers, w2time, bal2, secfrequency, The2Action)
	collectgarbage()
	flush()
end

function TakeCare(table, timeallowed, balance, freq, doaction)
	for user, time in table do
		local usr = GetItemByName(user)
		table[user][1] = table[user][1] + 1
		if usr and usr.sMyInfoString then
			_,_,share = strfind(usr.sMyInfoString, "%$(%d+)%$")
			if tonumber(share) < limitshare then
				if ( table[user][1] >= timeallowed ) then
						usr:SendPM(wsBot, "You didnt fill up your share to fulfill hub requirements.")
						return Act(usr, doaction)
				elseif ( table[user][1] == balance * table[user][2] ) then
					table[user][2] = table[user][2] + 1
					usr:SendPM(wsBot, "Please fill up ur share ... "..(table[user][2]-1).."/ "..freq.." warnings ... on the last warning you will get "..DoStringActions(doaction)..".")
					usr:SendPM(wsBot, "- You have another "..DoTimeUnits(timeallowed - table[user][1]).." left.")
				end
			else table[usr.sName] = nil
			end
		end
	end
end


function DoStringActions(act)
	local tActionStr = {
			[1] = "Disconnected",
			[2] = "Redirected",
			[3] = "Kicked",
			[4] = "Temporalily Banned",
			[5] = "Banned",
			[6] = "Banned",
			[7] = "Time Banned",
			[8] = "Flooded "..floodTimes.." times and then Disconnected", 
		};
	return tActionStr[act]
end


function DataArrival(user, data)
	if ( (user.sName == TheNick) and user.bOperator ) then
		data = strsub(data,1,strlen(data)-1)
		local s,e,cmd = strfind( data, "%b<>%s+(%S+)" )
		if cmd == TheCmd then
			local msg = "\r\n\t\t\t\t - ---==Users that are under the limit==--- -\r\n"
			msg = msg..strrep(" -", 110).."\r\n"
			msg = msg.."\t The following users are going to be "..DoStringActions(TheAction).." after their period of grace is over( initialy set to "..DoTimeUnits(wtime)..")\r\n"
			msg = msg..strrep(" -", 110).."\r\n"..DoList(tUsers, wtime, frequency)
			msg = msg..strrep(" -", 110).."\r\n\r\n"
			msg = msg..strrep(" -", 110).."\r\n"
			msg = msg.."\t The following users are going to be "..DoStringActions(The2Action).." after their period of grace is over ( initialy set to "..DoTimeUnits(w2time)..")\r\n"
			msg = msg..strrep(" -", 110).."\r\n"..DoList(tMoreUsers, w2time, secfrequency)
			msg = msg..strrep(" -", 110)
			SendPmToNick(TheNick, wsBot, msg)
		elseif cmd == DisCmd then
			TableClear(tUsers)
			TableClear(tMoreUsers)
		end
	end
end

function DoList(table, timeallowed, freq)
	local msg = ""
	local cnt = 0
	for nick , time in table do
		if GetItemByName(nick) then
			status = "online"
		else status = "offline"
		end
		cnt = cnt + 1
		msg = msg..cnt..".\t - Nick : "..nick.."\t Time Left : "..DoTimeUnits(timeallowed - table[nick][1]).."\t Warnings : "..(table[nick][2]-1).."/ "..freq.."\t Status : "..status.."\r\n"
	end
	return msg
end

function TableClear(table)
	for nick, v in table do 
		local usr = GetItemByName(nick)
		if usr then
			usr:SendPM(wsBot, TheNick.." said you have to leave because your share was not enough for this hub ...")
			usr:Disconnect()
		end
	end
	table = {}
end

--- // --- Transforming bytes Into KB, MB, GB, TB, PT and Returning the ideal (highest possible) Unit --- // ---
function DoShareUnits(intSize)				--- Thanks to kepp and NotRambitWombat
if intSize ~= 0 then
	local tUnits = { "Bytes", "KB", "MB", "GB", "TB" }
	intSize = tonumber(intSize);
	local sUnits;
	for index = 1, getn(tUnits) do
		if(intSize < 1024) then
			sUnits = tUnits[index];
			break;
		else 
			intSize = intSize / 1024;
		end
	end
	return format("%0.1f %s",intSize, sUnits);
else return "nothing"
end
end

--- // --- Performing action and also informing the user about it ... It is handled from the ' TheAction ' variable ....
function Act(user, var)
	local tActions = {
		[1] = function(user) user:SendPM(wsBot, "You will now be Disconnected") user:Disconnect() end,
		[2] = function(user) user:SendPM(wsBot, "You will now be Redirected to "..frmHub:GetRedirectAddress()) user:SendData("$OpForceMove "..frmHub:GetRedirectAddress()) end,
		[3] = function(user) user:SendPM(wsBot, "You will now be Kicked") user:Kick("You didn't meet the Hub's share requirements ...") user:Disconnect() end,
		[4] = function(user) user:SendPM(wsBot, "You are temporalily Banned") user:TempBan() end,
		[5] = function(user) user:SendPM(wsBot, "You are Banned") user:NickBan() end,
		[6] = function(user) user:SendPM(wsBot, "You are permenantly Banned") user:Ban() end,
		[7] = function(user) user:SendPM(wsBot, "You are Banned for "..bantime.." minutes.") user:TimeBan(bantime) end,
		[8] = function(user) FloodU(user) end,
		};
	for i,v in tActions do
		if i == var then
			tUsers[user.sName] = nil
			if ( (i ~= 3) or (i ~= 4) or (i ~= 5) or (i ~= 6) ) then
				tAgain[user.sName] = 1
			end
			return tActions[i](user)
		end
	end
	tActions = nil
end


function DoTimeUnits(time)
	local tTimes = {}
	local time = time * 1000
	if ( time >= 86400000 ) then
	repeat 
		if tTimes[4] then
			tTimes[4] = tTimes[4] + 1
		else tTimes[4] = 1
		end
		time = time - 86400000 
	until time < 86400000
	end

	if ( time >= 3600000 ) then
	repeat 
		if tTimes[3] then
			tTimes[3] = tTimes[3] + 1
		else tTimes[3] = 1
		end
		time = time - 3600000 
	until time < 3600000
	end

	if ( time >= 60000 ) then
	repeat
		if tTimes[2] then
			tTimes[2] = tTimes[2] + 1
		else tTimes[2] = 1
		end
		time = time - 60000
	until time < 60000
	end
	
	if ( time >= 1000 ) then
	repeat 
		if tTimes[1] then
			tTimes[1] = tTimes[1] + 1
		else tTimes[1] = 1
		end
		time = time - 1000
	until time < 1000
	end
local msg = ""
local tTimeUns = { "seconds", "minutes", "hours", "days"}
for i,v in tTimes do 
	msg = v.." "..tTimeUns[i].." "..msg
end
return msg
end
--- // ---  Script Ends

Herodes

The above is yet another update ... grab and test ... please .. :) added some more stuff ...

Herodes

#49
--- Version 5 Changes ---
--- added the ability to make custom limits for a user.
--- --- available limits are time allowed / number of warnings / share to reach / action to happen
--- Use the appropriate command ( ' CusCmd ' variable ) to set them
--- Added the display of custom limited users in the ' !noshare ' cmd ( ' TheCmd ' variable )
--- ( Last Update 14/8 - 2004 )

Grab It from here

SMF spam blocked by CleanTalk