PtokaX forum

Archive => Archived 5.1 boards => Finished Scripts => Topic started by: [NL]Daddy-Bear? on 06 April, 2007, 17:35:05

Title: OnShareTimedRedir Version 1.0
Post by: [NL]Daddy-Bear? on 06 April, 2007, 17:35:05
Hello it?s me again.

A little bit of this and a little bit of that has getting me to the:
OnShareTimedRedir Checker on share amount with stay time until auto actions.
You can choose out Timeban, Redict or Disconnect.
Have fun with this one.

--[[

OnShareTimedRedir Version 1.0 for lua 5.xx
with stay time until auto action
by [NL]Daddy-Bear? March 2007


]]
sBot = "??????Share-Please??????" -- Name for bot
bot = frmHub:GetHubBotName()  -- Bot naam 2 voor Ops
klik = 30 -- Interval [in minutes]
minshareReg = 500  -- Min share in mb
redicthub = "Bla bla bla.no-ip.info:1111" -- Redicthub
bantyd = 120 -- Ban Time  [in minutes]
redictstart = 0 -- Yust a counter
Command = "!topinter" -- Command gif Op info about actions etc from lua

-- ****************************** below action you want ******************************
--                to make active just remove the -- in front of the action only one action possible !!!!
-- action = "Time-Ban" act = 1
action = "Redict" act = 2
-- action = "Disconect" act = 3
-- ********************************************************************************

-- ****************************** below profile to check 1 = yes 0 = no  ******************************
-- If      1     You have to put the min share for that account in Robo on 0 Mb
DeKlos = {  
[0] = 0, -- Master 
[1] = 0, -- Operator 
[2] = 0, -- VIP 
[3] = 0, -- Registered 
[4] = 0, -- Moderator 
[5] = 0, -- Netfounder
[6] = 0, -- Owner 
[-1] = 1, -- Unregistered 
}
-- ********************************************************************************************

-- Time Definition
Sec  = 1000
Min  = 60*Sec
Hour = 60*Min
Day  = 24*Hour
function Main()
frmHub:RegBot(bot)
frmHub:RegBot(sBot)
SetTimer(Min*klik)
StartTimer()
opstart = os.date()
end
ChatArrival= function(user, data)
s,e,cmd = string.find(data, "%b<>%s+(%S+)|$")
if (cmd==Command) then
memgebruik = gcinfo()
local msg="\r\n\r\n\t\t\t\t\t*Lua Aktie's*\r\n"
        msg = msg.."\t================================================================================\r\n"
msg = msg.."\t\t\t\tActions from lua after start so far : "..redictstart.."\r\n"
msg = msg.."\t\t\t\t  The lua is started on "..opstart.."\r\n"
msg = msg.."\t\t\t\tMemory use at this moment "..memgebruik.." Kb\r\n"
        msg = msg.."\t================================================================================\r\n"
msg=msg.."\r\n"
SendPmToOps(bot,msg)
return 1
end
end
ToArrival = ChatArrival

function OnTimer()
StopTimer()
for i,v in pairs(frmHub:GetOnlineUsers()) do
local nick = ""
nick = v["sName"]
name = GetItemByName(nick)
user = GetItemByName(nick)
local shareMB = user.iShareSize / (1024^2) or 0
local shareGB = user.iShareSize / (1024^3) or 0
if name and DeKlos[user.iProfile] == 1 and shareMB < minshareReg then
sUser = GetItemByName(nick)
local kunst = "\t"..string.rep("~",80).."\r\n"
local share = string.format(" %.2f MB ",shareMB)
local sharem = string.format(" %.2f GB ",shareGB)
        local Difference = minshareReg - shareMB
local txt = "\r\n\r\n"..kunst..""..
                        "\r\n\tYour current share of "..share.." does not meet our minimum of "..minshareReg.." MB  for Regged Users."..   
"\r\n\r\n\tYou will have to increase your share with "..string.format(" %.2f ", Difference).."MB  to meet de min share of "..minshareReg.." MB  for Users in this Hub."..   
"\r\n\r\n\tPlease increase your share and return to this nice hub.\t\tYou get now a "..action.."."..
                        "\r\n\r\n"..kunst.."\r\n"
user:SendData(sBot,txt)
redictstart = redictstart + 1
memgebruik = gcinfo()
local msg1="\r\n\r\n\t\t\t\t\t*Lua Aktie's*\r\n"
        msg1 = msg1.."\t================================================================================\r\n"
msg1 = msg1.."\t      User   "..user.sName.."\t Wass getting this action:    "..action.."\tTotal actions so far "..redictstart.."\r\n"
msg1 = msg1.."\t\t\t\tThe lua is started on "..opstart.."\r\n"
msg1 = msg1.."\t\t\t\tMemory use at this moment "..memgebruik.." Kb\r\n"
        msg1 = msg1.."\t================================================================================\r\n"
msg1=msg1.."\r\n"
SendPmToOps(bot,msg1)
if act == 1 then sUser:TimeBan(bantyd) end
if act == 2 then sUser:Redirect(redicthub) end
if act == 3 then sUser:Disconnect() end
end
end
collectgarbage()
StartTimer()
end
function NewUserConnected(user)
if DeKlos[user.iProfile] == 1 then
local kunst = "\t"..string.rep("?",90).."\r\n"
local shareMB = user.iShareSize / (1024^2) or 0
local shareGB = user.iShareSize / (1024^3) or 0
if DeKlos[user.iProfile] == 1 and shareMB < minshareReg then
local share = string.format(" %.2f MB ",shareMB)
local sharem = string.format(" %.2f Gb ",shareGB)
        local Difference = minshareReg - shareMB
local txt = "\r\n\r\n"..kunst..""..
                        "\r\n\tYour current share of "..share.." does not meet our minimum of "..minshareReg.." MB  for Users."..   
"\r\n\r\n\tYou will have to increase your share with "..string.format(" %.2f ", Difference).."MB  to meet de min share of "..minshareReg.." MB  for Regged Users in this Hub."..   
"\r\n\r\n\tPlease increase your share.\t    Within "..klik.." minutes you will get a "..action.." !\tUntil then anyone your stay."..
                        "\r\n\r\n"..kunst.."\r\n\r\n"
user:SendData(sBot,txt)
end
end
collectgarbage()
end
OpDisconnected = UserDisconnected



Have fun wit this script.

Respectfully,

[NL]Daddy-Bear?

Title: Re: OnShareTimedRedir Version 1.0
Post by: greenbee on 04 May, 2007, 17:35:01
great script, is it possible to  send the message for redirect to other chat or in a pm to someone insted of only in pm to ops
thx
Title: Re: OnShareTimedRedir Version 1.0
Post by: [NL]Daddy-Bear? on 04 May, 2007, 23:39:14

Hello it?s me again.

Greenbee I think this is what you mend.
See line 18, 66 and 102.
What is done in line 66 you can do also if you want with line 92 etc, however I don?t think this is useful.
There you go.

--[[

OnShareTimedRedir Version 1.1 for lua 5.xx
with stay time until auto action
by [NL]Daddy-Bear? March 2007

Added: on request from greenbee send message to special.
by [NL]Daddy-Bear? May 2007


]]
sBot = "??????Share-Please??????" -- Name for bot
bot = frmHub:GetHubBotName()  -- Bot naam 2 voor Ops
klik = 30 -- Interval [in minutes]
minshareReg = 500  -- Min share in mb
redicthub = "Bla bla bla.no-ip.info:1111" -- Redicthub
bantyd = 120 -- Ban Time  [in minutes]
sNick = "greenbee"  -- Exact name where de message goes to
redictstart = 0 -- Yust a counter
Command = "!topinter" -- Command gif Op info about actions etc from lua

-- ****************************** below action you want ******************************
--                to make active just remove the -- in front of the action only one action possible !!!!
-- action = "Time-Ban" act = 1
action = "Redict" act = 2
-- action = "Disconect" act = 3
-- ********************************************************************************

-- ****************************** below profile to check 1 = yes 0 = no  ******************************
-- If      1     You have to put the min share for that account in Robo on 0 Mb
DeKlos = {  
[0] = 0, -- Master 
[1] = 0, -- Operator 
[2] = 0, -- VIP 
[3] = 0, -- Registered 
[4] = 0, -- Moderator 
[5] = 0, -- Netfounder
[6] = 0, -- Owner 
[-1] = 1, -- Unregistered 
}
-- ********************************************************************************************

-- Time Definition
Sec  = 1000
Min  = 60*Sec
Hour = 60*Min
Day  = 24*Hour
function Main()
frmHub:RegBot(bot)
frmHub:RegBot(sBot)
SetTimer(Min*klik)
StartTimer()
opstart = os.date()
end
ChatArrival= function(user, data)
s,e,cmd = string.find(data, "%b<>%s+(%S+)|$")
if (cmd==Command) then
memgebruik = gcinfo()
local msg="\r\n\r\n\t\t\t\t\t*Lua Aktie's*\r\n"
        msg = msg.."\t================================================================================\r\n"
msg = msg.."\t\t\t\tActions from lua after start so far : "..redictstart.."\r\n"
msg = msg.."\t\t\t\t  The lua is started on "..opstart.."\r\n"
msg = msg.."\t\t\t\tMemory use at this moment "..memgebruik.." Kb\r\n"
        msg = msg.."\t================================================================================\r\n"
msg=msg.."\r\n"
SendPmToNick(sNick,bot,msg)
return 1
end
end
ToArrival = ChatArrival

function OnTimer()
StopTimer()
for i,v in pairs(frmHub:GetOnlineUsers()) do
local nick = ""
nick = v["sName"]
name = GetItemByName(nick)
user = GetItemByName(nick)
local shareMB = user.iShareSize / (1024^2) or 0
local shareGB = user.iShareSize / (1024^3) or 0
if name and DeKlos[user.iProfile] == 1 and shareMB < minshareReg then
sUser = GetItemByName(nick)
local kunst = "\t"..string.rep("~",80).."\r\n"
local share = string.format(" %.2f MB ",shareMB)
local sharem = string.format(" %.2f GB ",shareGB)
        local Difference = minshareReg - shareMB
local txt = "\r\n\r\n"..kunst..""..
                        "\r\n\tYour current share of "..share.." does not meet our minimum of "..minshareReg.." MB  for Regged Users."..   
"\r\n\r\n\tYou will have to increase your share with "..string.format(" %.2f ", Difference).."MB  to meet de min share of "..minshareReg.." MB  for Users in this Hub."..   
"\r\n\r\n\tPlease increase your share and return to this nice hub.\t\tYou get now a "..action.."."..
                        "\r\n\r\n"..kunst.."\r\n"
user:SendData(sBot,txt)
redictstart = redictstart + 1
memgebruik = gcinfo()
local msg1="\r\n\r\n\t\t\t\t\t*Lua Aktie's*\r\n"
        msg1 = msg1.."\t================================================================================\r\n"
msg1 = msg1.."\t      User   "..user.sName.."\t Wass getting this action:    "..action.."\tTotal actions so far "..redictstart.."\r\n"
msg1 = msg1.."\t\t\t\tThe lua is started on "..opstart.."\r\n"
msg1 = msg1.."\t\t\t\tMemory use at this moment "..memgebruik.." Kb\r\n"
        msg1 = msg1.."\t================================================================================\r\n"
msg1=msg1.."\r\n"
SendPmToNick(sNick,bot,msg)
if act == 1 then sUser:TimeBan(bantyd) end
if act == 2 then sUser:Redirect(redicthub) end
if act == 3 then sUser:Disconnect() end
end
end
collectgarbage()
StartTimer()
end
function NewUserConnected(user)
if DeKlos[user.iProfile] == 1 then
local kunst = "\t"..string.rep("?",90).."\r\n"
local shareMB = user.iShareSize / (1024^2) or 0
local shareGB = user.iShareSize / (1024^3) or 0
if DeKlos[user.iProfile] == 1 and shareMB < minshareReg then
local share = string.format(" %.2f MB ",shareMB)
local sharem = string.format(" %.2f Gb ",shareGB)
        local Difference = minshareReg - shareMB
local txt = "\r\n\r\n"..kunst..""..
                        "\r\n\tYour current share of "..share.." does not meet our minimum of "..minshareReg.." MB  for Users."..   
"\r\n\r\n\tYou will have to increase your share with "..string.format(" %.2f ", Difference).."MB  to meet de min share of "..minshareReg.." MB  for Regged Users in this Hub."..   
"\r\n\r\n\tPlease increase your share.\t    Within "..klik.." minutes you will get a "..action.." !\tUntil then anyone your stay."..
                        "\r\n\r\n"..kunst.."\r\n\r\n"
user:SendData(sBot,txt)
end
end
collectgarbage()
end
OpDisconnected = UserDisconnected



Have fun.

Respectfully,

[NL]Daddy-Bear?

Title: Re: OnShareTimedRedir Version 1.0
Post by: greenbee on 05 May, 2007, 16:15:23
thx m8 gona test it.
doesent seem to send the redirect users txt to my nick m8,
the !topinter is sending it in pm