PtokaX forum

Archive => Archived 4.0 boards => Finished Lua 4 scripts => Topic started by: DJ Bert on 08 December, 2003, 23:24:35

Title: Brutus
Post by: DJ Bert on 08 December, 2003, 23:24:35
Hi all

Brutus is back again. Thnx to Troubadour for help how to work with scripts.
Just have updated Brutus with hubstat. I try to get more updates soon  :)

Brutus 4.5 (http://www.djbert.org/Troubadour/brutus4.5.rar)

Grtzzz [NL]-=DJ_Bert=-
Title:
Post by: pHaTTy on 09 December, 2003, 02:16:13
I see many mistakes, that can cause major crashes, i will not point out all but here is a few, you have SendToAll outside the functions, making a global...:S

scriptrestart goes to function Main


function RandomVIPMsgExit(user)
local randomSeed = random(3)
if randomSeed == 1 then
return user.sName..", has left the hub and took all his available sluts........eh slots with him!"
elseif randomSeed == 2 then
return "Walking down the red carpet, "..user.sName.." struts out the building."
elseif randomSeed == 3 then
return user.sName.." has left the hub, and he's gonna be stinking drunk when he comes back."
end
end
end


[/code]
where is 3rd end coming from?

function NewUserConnected(user)
   if user.iProfile == 2 then
      SendToAll(Bot, RandomVIPMsgConnect(user))
   elseif user.iProfile == nil then
      SendToNick(Bot, "Welcome to the [NL]Holland Hub" )
end
[/code]

send to what nick

and thats where the extra end goes ;)
Title:
Post by: pHaTTy on 09 December, 2003, 02:26:30
here a little update for you to enjoy ;)]]ok this post is in 2 bits brrr


#####################
#### Brutus 4.60 ####
#####################
## Original Writer ##
#####################
## [NL]-=DJ_Bert=- ##
#####################

-- 4.6  -Changed and moved a little more, By Phatty 5th December 2k3
-- 4.6  -Moved Non Globals to functions, By Phatty 5th December 2k3
-- 4.6  -Give the script a new look, By Phatty 5th December 2k3
-- 4.6  -Removed return 0 from DataArrival , By Phatty 5th December 2k3
-- 4.6  -Removed all the uneeded returns, By Phatty 5th December 2k3
-- 4.6  -Fixed a few bugs, cleaned up scripts, By Phatty 5th December 2k3
-- 4.5    -added hubstat by [NL]-=DJ_Bert=- 07 dec 2003 --
-- 4.0    -reassigned txt info files Troubadour 10 nov 2003 --
-- 3.5    -updated VIP announcements by Troubadour 06 nov 2003 (because of provider switch a little behind with the updates) --
-- 3.4    -automatic implement of hubprofiles by Troubadour (request from wijsneus) 25 july 2003 --
-- 3.3    -assigned inbuilt hubfunktions by Troubadour 25 july 2003 --
-- 3.2    -re-assigned badclients by Troubadour 24 july 2003 --
-- 3.1    -added !description (explaining dc user description) by Troubadour 22 july 2003 --
-- 3.0    -added !faq by Troubadour 21 july 2003 --
-- 2.1    -modified !network and !rules in !oprules and !lol by [NL]-=DJ_Bert=- 20 july 2003 --
-- 2.0f   -modified random announcements by Troubadour 7 july 2003 --
-- 2.0e   -added !network by Troubadour 4 july 2003 --
-- 2.0d   -added !rules by Troubadour 4 july 2003 --
-- 2.0c   -Dc-gui kick removed by Troubadour and check for enabling dc tag by Plop 1 july 2003 --
-- 2.0b   -Single Op announcement for an exclusive operator besides the random announcements by Troubadour 1 july 2003 --
-- 2.0a   -bugfixed !away and !back command by Troubadour 29 june 2003 --
-- 2.0    -updated with !away command and !back command by Troubadour 28 june 2003 --
-- 1.0    -bugfixed Random VIP announcements by Troubadour 27 june 2003 --
-- 0.1e   -Random VIP announcements by Troubadour 26 june 2003 --
-- 0.1d   -Random OP announcements by Troubadour 26 june 2003 (idea seen during the use of channelbot)--
-- 0.1c   -bugfixed Op announcements by Troubadour 26 june 2003 --
-- 0.1b   -OP announcements by Troubadour 25 june 2003 --
-- 0.1a   -Updated botdescription en version announcement by Troubadour 24 june 2003 --
-- 0.1    -Brutus anti badclients by Troubadour 22 june 2003 --

------------Thanks--------------------------------------------------------------------
--(NL)(DSL)MrBuitenhuizenJunior for the help during the tests
--[NL]Xantia for watching our hub, during script-writing and for some ideas
--Ptaczek for the scripting info in the ptokax \doc directorie
--Nathanos and Guibs for the random announcement idea in channelbot (awesome)
--Plop (saved dcgui from the banlist)
--------------------------------------------------------------------------------------


Bot ="Brutus"
Version ="Brutus 4.6"
Creators ="[NL]-=DJ_Bert=-" --remember its who the oginal writer was ;)

sHubName = frmHub:GetHubName()
sHubDesc = frmHub:GetHubDescr()
sRedirect = frmHub:GetRedirectAddress()
sMaxUsers = frmHub:GetMaxUsers()
sMinShare = frmHub:GetMinShare()/(1024)

badclient = { "mldonkey", "mldc", "replika", "pepek", "netwerk", "MLDonkey" }
awayArray={}

file_login = "brutus/oplogfile.txt"
file_logout = "brutus/oplogfile.txt"
TimeSpanInMinutes = 60  --> sets Hubstats time in minutes
DCGUIMINVERSION = 2
DCGUIMINVERSION2 = 12
WAYTOMUCHSLOTS = 25

function Main()
SendToAll(Version.." Started"..date(" the %d/%m-%Y at %X ").."  <---)")
SendToAll(BotInfo)
Bot = frmHub:GetHubBot()
BotInfo = "$MyINFO $ALL "..Bot.." <++V:4.5 Brutus,?+?:Troubadour and [NL]-=DJ_Bert=-> $ $Limbo speed"..strchar(1).."$Brustus@djbert.org$"
ScriptRestart = {}
frmHub:UnregBot(Bot)
frmHub:RegBot(Bot)
SendToAll(BotInfo)
DoProfiles()
SetTimer(TimeSpanInMinutes*60000)
StartTimer()
end


function DoProfiles()
AddProfile("REG", 2147500032)
AddProfile("VIP", 2147975168)
AddProfile("OP", 4269260800)
AddProfile("MODERATOR", 4269273088)
AddProfile("SUPERMODERATOR", 4294963200)
AddProfile("NEWBIE-OP", 4096245760)
AddProfile("Guest", 2148028000)
end



function OnTimer()
SendAdMessage()
end

function SendAdMessage()
sCurrentShare = frmHub:GetCurrentShareAmount()/(1024^3)
sUserCount = frmHub:GetUsersCount()
upline = "============H=U=B==S=T=A=T=S=========="
underline = "======================================="
local tmp = clock()
local days, hours, minutes = floor(tmp/86400), floor(mod(tmp/3600, 24)), floor(mod(tmp/60, 60))
hubstats = "\r\n\r\n"..upline.."\r\n"..
"      ?Script Version:     "..Version.."\r\n"..
"      ?Script Creator:     "..Creators.."\r\n"..
"      ?Hub Name:     "..sHubName.."\r\n"..
"      ?Hub Description:   "..sHubDesc.."\r\n"..
"      ?Hub Adress:   limbohub.no-ip.com \r\n"..
"      ?Owner: [NL]-=DJ_Bert=-".."\r\n"..
"      ?Current uptime is: "..days.." days "..hours.." hours and "..minutes.." minutes\r\n"..
"      ?Redirect Adress:   "..sRedirect.."\r\n"..
"      ?Maximum Users:   "..sMaxUsers.."\r\n"..
"      ?Total Users at this moment:   "..sUserCount.."\r\n"..
"      ?Minimum Share:   "..sMinShare.." GB".."\r\n"..
"      ?Total Share in the hub:   "..sCurrentShare.." in bytes".."\r\n"..
"      ?Hub Network: !network".."\r\n"..
"      ?Add this hub to your favorites: /fav in mainchat".."\r\n"..
"      ?Hub Rules:     !rules".."\r\n"..underline.."\r\n".." "
SendToAll(Bot, hubstats)
end

function OpConnected(user)
if (user.sName == "[NL]-=IRIS=-") then
SendToAll(Bot, "[NL]-=IRIS=- has entered the hub. Look at the legs on that gorgieus lady!")
else
SendToAll(Bot, RandomEntryMsg(user))
end
end

function OpDisconnected(user)
if (user.sName == "[NL]-=DJ_Bert=-") then
SendToAll(Bot, "The hubowner [NL]-=DJ_Bert=- left tha house and will back soon to control you...")
else
SendToAll(Bot, RandomExitMsg(user))
end
end

function OpConnected(user)
if (user.sName == "[NL]-=DJ_Bert=-") then
SendToAll(Bot, "The hubowner [NL]-=DJ_Bert=- entered tha house and is gonna control this hub!")
else
SendToAll(Bot, RandomEntryMsg(user))
end
end


function OpDisconnected(user)
if (user.sName == "[NL]-=IRIS=-") then
SendToAll(Bot, "[NL]-=IRIS=- is going to powder her nose, will she return?")
else
SendToAll(Bot, RandomExitMsg(user))
end
end

function UserDisconnected(user)
if user.iProfile == 2 then
SendToAll(Bot, RandomVIPMsgExit(user))
end
end


function CheckIfDcguiHasTagEnabled(user)
if strfind(user.sMyInfoString, "dc-gui", 1, 1) or strfind(user.sMyInfoString, "dc.ketelhot.de", 1, 1) or strfind(user.sMyInfoString, "DCGUI", 1, 1) then
if not strfind(user.sMyInfoString, " user:SendData(" Pls enable your dc tag, you are now being disconnected  |")
user:Disconnect()
end
end
end

function VersionCheckDcgui(user)
_,b, dcver = strfind(user.sMyInfoString,"V:0.(%x+).%x+")
_,b, dcver2 = strfind(user.sMyInfoString,"V:0.%x+.(%d+)")
user:SendData(" The oldest allowed version of Dcgui is 0."..DCGUIMINVERSION.."."..DCGUIMINVERSION2.." |")
user:SendData(" You are using Dcgui version 0."..dcver.."."..dcver2.." |")
if (tonumber(dcver2) < DCGUIMINVERSION2) or (tonumber(dcver) < DCGUIMINVERSION) then
user:SendData(" You are using a to old client use at least version 0."..DCGUIMINVERSION.."."..DCGUIMINVERSION2.." |")
user:SendData(" you are now being disconnected ... |")
user:Disconnect()
end
end

function CheckTheBandwidthDcGui(user, suppressionstate)
s,e,dcpp = strfind(user.sMyInfoString, "%$")

if dcpp ~= nil then
s,e,bandwidth = strfind( dcpp, "L:(%d+%.%d+)")
s,e,slots = strfind( dcpp, "S:(%d+)")

if bandwidth == nil then
s,e,bandwidth = strfind( dcpp "L:(%d+)")
end

if bandwidth == nil then
bandwidth = "unlimited"
else
bandwidth = bandwidth * slots -- the tag shows the speed per slot
end
minBandwidth = MinbandwithlimiterChecker(user)--- use this 1 if you have different settings for different connection types
--minBandwidth = -- uncomments this line and place the comment on the above line if you use a single setting for all connection types
if suppressionstate == "off" then
user:SendData(" The minimum amount of upload bandwidth in k/s required for your class is set to: "..minBandwidth.." |")
user:SendData(" You currently are sharing with a maximum k/s upload restriction of: "..bandwidth.." |")
if bandwidth ~= "unlimited" then
if (tonumber(bandwidth) < minBandwidth) then
user:SendData(" You do not meet the minimum upload bandwidth required, and are being disconnected ... |")
                user:Disconnect()
end
end
elseif suppressionstate == "on" then
if bandwidth ~= "unlimited" then
if (tonumber(bandwidth) < minBandwidth) then
user:SendData(" You no longer meet the minimum upload bandwidth required, and are being disconnected ... |")
user:Disconnect()
end
end
end
end
end
Title:
Post by: pHaTTy on 09 December, 2003, 02:27:11


function CheckTheSlotsDcGui(user, suppressionstate)
s,e,dcpp = strfind(user.sMyInfoString, "%$")
minSlots = SSBDefinitions(user, "slot")   --- use this 1 if you have different settings for different connection types
  --minSlots = 2 -- uncomments this line and place the comment on the above line if you use a single setting for all connection types
if dcpp ~= nil then
s,e,slots = strfind( dcpp, "S:(%d+)")
    maxSlots = MaxSlotChecker(user)  --- use this 1 if you have different settings for different connection types
    --maxSlots = -- uncomments this line and place the comment on the above line if you use a single setting for all connection types
    if slots == nil or slots == 0 then
        user:SendData(" Don't use unlimited slots, your connection isn't unlimited either. use a preset number ... |")
        user:SendData(" you are now being disconnected ... |")
        user:Disconnect()
end
if suppressionstate == "off" then
user:SendData(" The minimum number of open slots required for your class is set to: "..minSlots.." |")
user:SendData(" The maximum number of open slots required for your class is set to: "..maxSlots.." |")
user:SendData(" You currently have "..slots.." open slot(s). |")
if (tonumber(slots) < minSlots) then
user:SendData(" You do not meet the slot minimum, and are being disconnected ... |")
user:Disconnect()
elseif (tonumber(slots) > maxSlots) then
if WAYTOMUCHSLOTS ~= 0 then
if (tonumber(slots)) > WAYTOMUCHSLOTS then
user:SendData(" You opened so much slots that your not getting a kick  |")
user:SendData(" you are now being banned ... |")
user:Ban()
end
end
user:SendData(" You do not meet the slot maximum, and are being disconnected ... |")
user:Disconnect()
return
end
elseif suppressionstate == "on" then
if (tonumber(slots) < minSlots) then
user:SendData(" You no longer meet the slot minimum, and are being disconnected ... |")
user:Disconnect()
elseif (tonumber(slots) > maxSlots) then
if WAYTOMUCHSLOTS ~= 0 then
if (tonumber(slots)) > WAYTOMUCHSLOTS then
user:SendData(" You opened so much slots that you whill not get a kick  |")
user:SendData(" you are now being banned ... |")
user:Ban()
end
end
user:SendData(" You no longer meet the slot maximum, and are being disconnected ... |")
user:Disconnect()
end
end
end
end

function NewUserConnected(user)
if user.iProfile == 2 then
SendToAll(Bot, RandomVIPMsgConnect(user))
elseif user.iProfile == nil then
SendToNick(user.sName,Bot.."Welcome to the [NL]Holland Hub" )
end
end

function RandomEntryMsg(user)
local randomSeed = random(7)
if randomSeed == 1 then
return user.sName.." has entered the hub. Let the games begin.!"
elseif randomSeed == 2 then
return user.sName.." has entered the hub. Once again the mistery is solved.!"
elseif randomSeed == 3 then
return user.sName.." appears from a cloud of mist ..."
elseif randomSeed == 4 then
return "\r\n\r\n                \\ ~ ~ //\r\n                  ( 0-0 )\r\n----oOO-------(_)--------------------------\r\nI       "..user.sName.."      I\r\n     I           Is peeking at you I\r\n-------------------oOO----------------------\r\n               I__I__I\r\n                I I  I I\r\n           nooO Ooo"
elseif randomSeed == 5 then
return "Twirling his pea shooters ... "..user.sName.." rocks up and a says 'Howdy partners.'"
elseif randomSeed == 6 then
return "Please give him a big welcome! "..user.sName.." has entered the hub.!"
elseif randomSeed == 7 then
return "And you will know my name is "..user.sName..". Better behave or else.......!!!"
end
end

function RandomVIPMsgConnect(user)
local randomSeed = random(4)
if randomSeed == 1 then
return user.sName.." crawls through the door."
elseif randomSeed == 2 then
return "Walking down the stairs "..user.sName.." enters the hub!"
elseif randomSeed == 3 then
return user.sName.." is about to get the party started ..."
elseif randomSeed == 4 then
return user.sName.." is happy to be a member of this cool hub!"
end
end

function RandomExitMsg(user)
local randomSeed = random(7)
if randomSeed == 1 then
return user.sName.." snaps his fingers and disappears in a puff of smoke ..."
elseif randomSeed == 2 then
return user.sName.." simply disappears like a fart in the wind ..."
elseif randomSeed == 3 then
return user.sName.." hops on his Harley and rides off into the sunset ..."
elseif randomSeed == 4 then
return user.sName.." stumbles off yelling ... I'll be back!'"
elseif randomSeed == 5 then
return "'oh mama!', says "..user.sName.." and suddenly disappears out off sight ..."
elseif randomSeed == 6 then
return user.sName.." does his david copperfield imitation and is vanished!'"
elseif randomSeed == 7 then
return user.sName.." has left the hub, and is taking his absurdly huge share with him."
end
end

function RandomVIPMsgExit(user)
local randomSeed = random(3)
if randomSeed == 1 then
return user.sName..", has left the hub and took all his available sluts........eh slots with him!"
elseif randomSeed == 2 then
return "Walking down the red carpet, "..user.sName.." struts out the building."
elseif randomSeed == 3 then
return user.sName.." has left the hub, and he's gonna be stinking drunk when he comes back."
end
end

function SendOprules(user)
readfrom("txt/oprules.txt")
DoRead(user)
end

function SendLol(user)
readfrom("txt/lol.txt")
DoRead(user)
end

function SendFaq(user)
readfrom("txt/faq.txt")
DoRead(user)
end

function SendDescription(user)
readfrom("txt/description.txt")
DoRead(user)
end

function DoRead(user)
while 1 do
line = read()
if line == nil then break end
user:SendPM(Bot, line)
end
readfrom()
end


function DataArrival(user, data)
if( strsub(data, 1, 1) == "<" ) then
data=strsub(data,1,strlen(data)-1)
s,e,cmd,arg = strfind( data, "%b<>%s+(%S+)%s+(.*)" )
if (arg==nil) then
s,e,cmd = strfind( data, "%b<>%s+(%S+)%s*" )
end
for key,m in badclient do
if strfind(user.sMyInfoString,m,1,1) then
user:Disconnect()
end
end

if (cmd=="!away") then
if (not (arg)) then
arg = "<----- will return later again"
end
SendToAll(Bot,date("User "..user.sName.." Is Away From The Hub %T Reason: ...")..arg.." ;)")
awayArray[user.sName]=arg

elseif (cmd=="!back") then
if (awayArray[user.sName]==nil) then
else
SendToAll(Bot,date("User "..user.sName.." is back to the hub! %T!"))
awayArray[user.sName]=nil
end
if(awayArray[user.sName]) then
SendToAll(Bot,date("User "..user.sName.." is back to the hub! %T!"))
awayArray[user.sName]=nil
end
elseif (cmd=="!oprules") then
SendOprules(user)
elseif (cmd=="!lol") then
SendLol(user)
elseif (cmd=="!faq") then
SendFaq(user)
elseif (cmd=="!description") then
SendDescription(user)
end
end
end


if you need help, you can find me always ;)

just ask....

l8rr,,

enjoy...

-phatty ;)
Title:
Post by: plop on 09 December, 2003, 02:54:49
check the thread about the dcgui functions.
the old 1 you use kicks dcgui 0.3.x for being 2 old.
updated version is posted in that thread.

plop
Title: Brutus
Post by: DJ Bert on 09 December, 2003, 12:09:35
Thnx pH?tt?
I will fixs Brutus this week and Brutus become some more fuctions.  ;)

Grzzt Bert
Title: Brutus 4.6
Post by: DJ Bert on 10 December, 2003, 16:04:16
Hi all,

New updated Brutus 4.6
Thnx to Phatty for fixing script for TD 4.  :)

Added Badfilecheck today

Brutus 4.6 for TD 3 (http://www.djbert.org/Troubadour/brutus4.6td3.rar)

Brutus 4.6 for TD 4 (http://www.djbert.org/Troubadour/brutus4.6td4.rar)


Greetzzz DJ Bert
Title:
Post by: turkiye on 10 December, 2003, 16:10:29
QuoteOriginally posted by DJ Bert
Hi all,

New updated Brutus 4.6
Thnx to Phatty for fixing script for TD 4.  :)

Added Badfilecheck today

Brutus 4.6 for TD 3 (http://www.djbert.orgtroubadour/brutus4.6td3.rar)

Brutus 4.6 for TD 4 (http://www.djbert.orgtroubadour/brutus4.6td4.rar)


Greetzzz DJ Bert

The Link Is DEAD!!!
Title: Brutus
Post by: DJ Bert on 10 December, 2003, 18:51:05
The links are fixed  :)
Title:
Post by: Cyberia on 10 December, 2003, 18:54:56
Yep, works fine now  :D
Title:
Post by: pHaTTy on 10 December, 2003, 19:28:36
Ok

You have

if user.sName == "whaterr" then


change this to

if user.sName == HubOwner then

and for the look at those legs change to

if user.sName == OpLady then

for the welcome lines

SendToAll(Bot,"Look ate those legs on "..OpLady.." etc etc"

the same for Hub owner and at the top near ther variables etc etc

Add

HubOwner = "whoever"
OpLady = "Whever"


it will make it much easier for ppl using your scripts,

have phun,

l8rr,,

-phatty
Title: Brutus Update
Post by: DJ Bert on 13 December, 2003, 15:04:16
Hi all,

Just a little update in Brutus for TD 4  ;)
Thnx Phatty's idea for this little update  :)
Brutus 4.65 TD 4 (http://www.djbert.org/Troubadour/brutus4.65td4.rar)

Greetzzz DJ Bert
Title:
Post by: Troubadour on 13 December, 2003, 16:30:28
Well done, keep up the good work.

-Troubadour-
Title: Brutus 4.7
Post by: DJ Bert on 21 December, 2003, 23:52:55
Updated version for Ptokax TD 4

Brutus 4.7 (http://www.djbert.org/Troubadour/Brutus4.7td4.rar)

-- 4.7    -added brutus.cfg (configuration file to change the script to your needs)--
-- 4.7    -added fakeshare check (gives pm to OPS if found)--
-- 4.7    -fixed and updated badshare check --

DJ Bert
Title: Next Brutus update
Post by: DJ Bert on 26 December, 2003, 16:49:24
A little error in brutus (Syntax Error: attempt to index global `userKicks' (a nil value)
will be fixed in Brutus 4.8. Also adding !hideme and unhidme. Updating configfile.
Brutus release 4.8 is aviable at sunday.

DJ Bert :]
Title: Version 4.8
Post by: DJ Bert on 28 December, 2003, 21:00:23
Version 4.8 is now aviable
Also working with Ptokax 0.330 and Ptokax TD 4
You can download it -=HERE=- (http://www.djbert.org/Troubadour/brutus4.8.rar)

DJ Bert
Title: Brutus 4.9
Post by: DJ Bert on 09 January, 2004, 22:33:57
-- 4.9     -added more lines to the cfg file (containing all txt in script)--
-- 4.9    -fixed some fixed some line cfg display errors--

-=Download Brutus 4.9=- (http://www.djbert.org/Troubadour/brutus4.9.rar)
 
Grtzzz DJ Bert :)
Title:
Post by: MrBuitenhuizenJunior on 15 January, 2004, 16:09:16
Hello,

I don't see any errors caused by this script.
Nice one! :)

[NL]MrBuitenhuizen
Title: Brutus 5.0
Post by: DJ Bert on 26 January, 2004, 13:45:11
-- 5.0    -added checking 28.8K 33.6K 56K and ISDN en disconnect users with it--
-- 5.0    -updated badfiles--

-=DOWNLOAD=- (http://www.djbert.org/Troubadour/brutus5.0.rar)

(http://www.danasoft.com/sig-dut.jpg)
Title:
Post by: blackwings on 31 March, 2004, 03:09:50
could you make so that brutus only sends the hub stat to the hub that it using it, because if you have a multihub chat, all hubs will see the hubstat and some of them are complaining about it.
Title:
Post by: DJ Bert on 23 April, 2004, 14:54:26
All links of Brutus are fixed and working :D

Grtzz DJ Bert
Title:
Post by: DJ Bert on 01 October, 2004, 22:06:32
Old Brutus Versions.

All old Brutus versions are deleted from http://www.djbert.org. Only the follow versions are online for download.

-= Brutus 4.9 =- (http://www.djbert.org/Guardian/brutus4.9.rar)

-= Brutus 5.0 =- (http://www.djbert.org/Guardian/brutus5.0.rar)

Greetzzz DJ Bert