PtokaX forum

Archive => Archived 5.1 boards => Finished Scripts => Topic started by: Mozzilla? on 10 November, 2006, 00:28:07

Title: TeamBot Update
Post by: Mozzilla? on 10 November, 2006, 00:28:07
Hope you don't mind, 6Marilyn6Manson6, but i changed a few things around and added a few things also.  Hope this update benefits some of you.

---TeamBot Update by Mozzilla?
---Description - Allows hub users to see a full list of members by profile or full lists of individual profiles
---Original author: Mutor, original source: LUA4
---comands: !listreg / !listvip / !listop / !listmod / !listmaster / !listfounder / !listall
--// Update To Lua 5.1.1 by 6Marilyn6Manson6    27/07/2006
--// Change commands: !listreg / !listvip / !listope / !listmod / !listmas / !listntf / !listown / !listall
--// Thanks bastya_elvtars for small help with return commands :)    16/08/2006

--// Changes made By Mozzilla? 09/11/2006
--// Added new command - !listown
--// Added Owner profile, just in case it is part of your hub soft
--// Added Owner to UseCMD
--// Added Right Click
--// Changed order in which !listall is displayed
--// Added 10/11/2006
--// End result will now show HubName in display

----------------------------------------------------
----------------------------------------------------
Prefix = "!" -- ! + # ? -
sBotName = "Bot-Name-Here" -- or frmHub:GetHubBotName(),
sHubName = frmHub:GetHubName()
----------------------------------------------------
UseCMD = { -- What profile you want blocked 1/yes 0/no
[0] = 1, -- Master
[1] = 1, -- Operator
[2] = 0, -- VIP
[3] = 0, -- Registered
[4] = 1, -- Moderator
[5] = 1, -- Netfounder
[6] = 1, -- Owner
[-1] = 0, -- Unregistered
}
----------------------------------------------------
SendTo = {
[0] = 1, -- Masters
[1] = 1, -- Operators
[2] = 0, -- Vips
[3] = 0, -- Regs
[4] = 1, -- Moderator
[5] = 1, -- NetFounder
[6] = 1, -- Owner
[-1] = 0, -- Unregistered
}
----------------------------------------------------
function NewUserConnected(user)
if SendTo [user.iProfile] > 0 then
user:SendData("$UserCommand 1 3 "..sBotName.."\\List All Owners$<%[mynick]> !listown&#124;|")
user:SendData("$UserCommand 1 3 "..sBotName.."\\List All Network Founders$<%[mynick]> !listntf&#124;|")
user:SendData("$UserCommand 1 3 "..sBotName.."\\List All Masters$<%[mynick]> !listmas&#124;|")
user:SendData("$UserCommand 1 3 "..sBotName.."\\List All Operators$<%[mynick]> !listope&#124;|")
user:SendData("$UserCommand 1 3 "..sBotName.."\\List All Moderators$<%[mynick]> !listmod&#124;|")
user:SendData("$UserCommand 1 3 "..sBotName.."\\List All VIP's$<%[mynick]> !listvip&#124;|")
user:SendData("$UserCommand 1 3 "..sBotName.."\\List All Registered Users$<%[mynick]> !listreg&#124;|")
user:SendData("$UserCommand 1 3 "..sBotName.."\\List All Hub Members$<%[mynick]> !listall&#124;|")
end
end

OpConnected = NewUserConnected
----------------------------------------------------
tCommands = {
["listreg"] = function(user)
Show(user, "Reg")
end,
["listvip"] = function(user)
Show(user, "VIP")
end,
["listope"] = function(user)
Show(user, "Operator")
end,
["listmod"] = function(user)
Show(user, "Moderator")
end,
["listmas"] = function(user)
Show(user, "Master")
end,
["listntf"] = function(user)
Show(user, "NetFounder")
end,
["listown"] = function(user)
Show(user, "Owner")
end,
["listall"] = function(user)
Show(user,"Owner")
Show(user,"NetFounder")
Show(user,"Master")
Show(user,"Operator")
Show(user,"Moderator")
Show(user,"VIP")
Show(user,"Reg")
end,
}

function ChatArrival(user,data)
if user.bOperator and UseCMD[user.iProfile]==1 then
local _,_,pref,cmd = string.find(data, "%b<>%s+(%p)(%S+)%|")
if pref == Prefix and tCommands[cmd] ~= nil then
tCommands[cmd](user)
return 1
end
end
end
----------------------------------------------------
function Show(user,which)
user:SendPM(sBotName,"")
user:SendPM(sBotName,"")
user:SendPM(sBotName,"\t---<>--------------------------------------------------<>--")
user:SendPM(sBotName,"\t\tList of Current "..which.."s")
user:SendPM(sBotName,"\t\tIn "..sHubName)
user:SendPM(sBotName,"\t---<>--------------------------------------------------<>--")
local aux,usr
for aux, usr in pairs(GetUsersByProfile(which)) do
user:SendPM(sBotName,"\t\t"..usr)
end
user:SendPM(sBotName,"")
user:SendPM(sBotName,"")
end
----------------------------------------------------
--// 6Marilyn6Manson6
Title: Re: TeamBot Update
Post by: 6Marilyn6Manson6 on 10 November, 2006, 08:01:45
NP and good script ;)
Title: Re: TeamBot Update
Post by: Herodes on 10 November, 2006, 08:14:37
Call me picky but nowhere in the credits I see the name of the Bot-Script,
this makes feature reference to it difficult.
Please amend...
Title: Re: TeamBot Update
Post by: Mozzilla? on 10 November, 2006, 16:11:44
Quote from: 6Marilyn6Manson6 on 10 November, 2006, 08:01:45
NP and good script ;)

Thanks 6Marilyn6Manson6

Quote from: Herodes on 10 November, 2006, 08:14:37
Call me picky but nowhere in the credits I see the name of the Bot-Script,
this makes feature reference to it difficult.
Please amend...

And sorry Herodes, you're not being picky at all, it is indeed beneficial to have the name of the Bot-Script entered in the credits.
Thankyou for noticing it and pointing it out.

First post updated.

Posted on: November 10, 2006, 01:44:05 pm
Just added to the script - HubName will be shown in PM from bot

Quote[15:07:57] <??ReG~LisT???>    ---<>--------------------------------------------------<>--
[15:07:57] <??ReG~LisT???>       List of Current Master
[15:07:57] <??ReG~LisT???>       In <YOUR HUB NAME WILL APPEAR HERE>
[15:07:57] <??ReG~LisT???>    ---<>--------------------------------------------------<>--

First Post amended and updated.
Title: Re: TeamBot Update
Post by: CrazyGuy on 10 November, 2006, 17:49:51
Nice work, just saw a few things that had room for improvement.. and after reading it a few times, felt like doing so  :P



replace

function ChatArrival(user,data)
if user.bOperator then
if UseCMD[user.iProfile]==1 then
local s,e,cmd = string.find(data, "%b<>%s+(%S+)(%S+)")
if cmd == Prefix.."listreg" then
Show(user,"Reg")
return 1
elseif cmd == Prefix.."listvip" then
Show(user,"VIP")
return 1
elseif cmd == Prefix.."listope" then
Show(user,"Operator")
return 1
elseif cmd == Prefix.."listmod" then
Show(user,"Moderator")
return 1
elseif cmd == Prefix.."listmas" then
Show(user,"Master")
return 1
elseif cmd == Prefix.."listntf" then
Show(user,"NetFounder")
return 1
elseif cmd == Prefix.."listown" then
Show(user,"Owner")
return 1
elseif cmd == Prefix.."listall" then
Show(user,"Owner")
Show(user,"NetFounder")
Show(user,"Master")
Show(user,"Operator")
Show(user,"Moderator")
Show(user,"VIP")
Show(user,"Reg")
return 1
end
end
else
end
end


with


tCommands = {
["listreg"] = function(user)
Show(user, "Reg")
end,
["listreg"] = function(user)
Show(user, "VIP")
end,
["listope"] = function(user)
Show(user, "Operator")
end,
["listmod"] = function(user)
Show(user, "Moderator")
end,
["listmas"] = function(user)
Show(user, "Master")
end,
["listntf"] = function(user)
Show(user, "NetFounder")
end,
["listown"] = function(user)
Show(user, "Owner")
end,
["listall"] = function(user)
Show(user,"Owner")
Show(user,"NetFounder")
Show(user,"Master")
Show(user,"Operator")
Show(user,"Moderator")
Show(user,"VIP")
Show(user,"Reg")
end,
}

function ChatArrival(user,data)
if user.bOperator and UseCMD[user.iProfile]==1 then
local _,_,pref,cmd = string.find(data, "%b<>%s+(%p)(%S+)")
if pref == Prefix and tCommands[cmd] ~= nil then
tCommands[cmd](user)
return 1
end
end
end
Title: Re: TeamBot Update
Post by: Mozzilla? on 10 November, 2006, 19:01:44
Thanks CrazyGuy, I replaced that piece of the script with your alterations and it didn't work.

All I got was the command come up in Main Chat

!listall
!listope

Thanks for your reply
Title: Re: TeamBot Update
Post by: CrazyGuy on 10 November, 2006, 19:49:40
sorry, my bad

change

local _,_,pref,cmd = string.find(data, "%b<>%s+(%p)(%S+)")

to

local _,_,pref,cmd = string.find(data, "%b<>%s+(%p)(%S+)%|")

:)
Title: Re: TeamBot Update
Post by: Herodes on 10 November, 2006, 20:00:05
Quote from: CrazyGuy on 10 November, 2006, 19:49:40
sorry, my bad

change

local _,_,pref,cmd = string.find(data, "%b<>%s+(%p)(%S+)")

to

local _,_,pref,cmd = string.find(data, "%b<>%s+(%p)(%S+)%|")

:)
local cmd = ( ( data:sub(1,-2) ):lower() ):match( "%b<>%s+[%!%?%+%.%#%-](%S+)" )
hihihihii.. . :)
Title: Re: TeamBot Update
Post by: bastya_elvtars on 10 November, 2006, 20:48:48
Quote from: Herodes on 10 November, 2006, 20:00:05
local cmd = ( ( data:sub(1,-2) ):lower() ):match( "%b<>%s+[%!%?%+%.%#%-](%S+)" )
hihihihii.. . :)

LOL :-D
Title: Re: TeamBot Update
Post by: Mozzilla? on 10 November, 2006, 21:28:21
Thanks CrazyGuy.

Quote from: CrazyGuy on 10 November, 2006, 19:49:40
sorry, my bad

change

local _,_,pref,cmd = string.find(data, "%b<>%s+(%p)(%S+)")

to

local _,_,pref,cmd = string.find(data, "%b<>%s+(%p)(%S+)%|")

:)

Also changed

["listreg"] = function(user)
Show(user, "VIP")
end,


to

["listvip"] = function(user)
Show(user, "VIP")
end,



That did work.

Quote from: Herodes on 10 November, 2006, 20:00:05
local cmd = ( ( data:sub(1,-2) ):lower() ):match( "%b<>%s+[%!%?%+%.%#%-](%S+)" )
hihihihii.. . :)

But that didn't work.


Thankyou both for your replies.

First post amended and updated.
Title: Re: TeamBot Update
Post by: CrazyGuy on 10 November, 2006, 22:36:21
Quote
Quote from: Herodes on Today at 08:00:05 pm
local cmd = ( ( data:sub(1,-2) ):lower() ):match( "%b<>%s+[%!%?%+%.%#%-](%S+)" )

hihihihii.. .
But that didn't work

LoooL  ;D
Title: Re: TeamBot Update
Post by: Mozzilla? on 11 November, 2006, 02:47:09
Does anybody have any idea how the result PM could include the following info:

Show whether a user is online or offline

Instead of

Quote[01:24:03] <??ReG~LisT???>    ---<>--------------------------------------------------<>--
[01:24:03] <??ReG~LisT???>       List of Current Masters
[01:24:03] <??ReG~LisT???>       In ReSurRecTioN NeTworkS PriVatE 100gig HuB
[01:24:03] <??ReG~LisT???>    ---<>--------------------------------------------------<>--
[01:24:03] <??ReG~LisT???>       ??l??-h??v??
[01:24:03] <??ReG~LisT???>       danielle
[01:24:03] <??ReG~LisT???>       Mark675
[01:24:03] <??ReG~LisT???>       ??l??-h??v???
[01:24:03] <??ReG~LisT???>       CLAIRNATH
[01:24:03] <??ReG~LisT???>       ]-[?LL?L?L??nG?L
[01:24:03] <??ReG~LisT???>       R????
[01:24:03] <??ReG~LisT???>       !J??J???666!?
[01:24:03] <??ReG~LisT???>       j??h?ll?8?

Make it look like this

Quote][01:24:03] <??ReG~LisT???>    ---<>--------------------------------------------------<>--
[01:24:03] <??ReG~LisT???>       List of Current Masters
[01:24:03] <??ReG~LisT???>       In ReSurRecTioN NeTworkS PriVatE 100gig HuB
[01:24:03] <??ReG~LisT???>    ---<>--------------------------------------------------<>--
[01:24:03] <??ReG~LisT???>       ??l??-h??v?? [online]
[01:24:03] <??ReG~LisT???>       danielle [offline]
[01:24:03] <??ReG~LisT???>       Mark675 [offline]
[01:24:03] <??ReG~LisT???>       ??l??-h??v??? [online]
[01:24:03] <??ReG~LisT???>       CLAIRNATH [offline]
[01:24:03] <??ReG~LisT???>       ]-[?LL?L?L??nG?L [online]
[01:24:03] <??ReG~LisT???>       R???? [offline]
[01:24:03] <??ReG~LisT???>       !J??J???666!? [offline]
[01:24:03] <??ReG~LisT???>       j??h?ll?8? [online]

Any assistance with this would be much appreciated.
Title: Re: TeamBot Update
Post by: CrazyGuy on 11 November, 2006, 18:21:44
modify your function Show to this:


function Show(user,which)
user:SendPM(sBotName,"")
user:SendPM(sBotName,"")
user:SendPM(sBotName,"\t---<>--------------------------------------------------<>--")
user:SendPM(sBotName,"\t\tList of Current "..which.."s")
user:SendPM(sBotName,"\t\tIn "..sHubName)
user:SendPM(sBotName,"\t---<>--------------------------------------------------<>--")
local aux,usr
for aux, usr in pairs(GetUsersByProfile(which)) do
local tOnline = frmHub:GetOnlineUsers(GetProfileIdx(which))
local bisOnline = 0
for k in pairs(tOnline) do
if tOnline[k].sName == usr then bisOnline = 1 end
end
if bisOnline == 1 then
user:SendPM(sBotName,"\t\t"..usr.." [online]")
else
user:SendPM(sBotName,"\t\t"..usr.." [offline]")
end
end
user:SendPM(sBotName,"")
user:SendPM(sBotName,"")
end


result:

Quote
18:16:53] <Bot-Name-Here>    ---<>--------------------------------------------------<>--
[18:16:53] <Bot-Name-Here>       List of Current Operators
[18:16:53] <Bot-Name-Here>       In CG's TestHub
[18:16:53] <Bot-Name-Here>    ---<>--------------------------------------------------<>--
[18:16:53] <Bot-Name-Here>       clienttest [offline]
[18:16:53] <Bot-Name-Here>       Banbot [offline]
[18:16:53] <Bot-Name-Here>       CrazyGuy [online]
Title: Re: TeamBot Update
Post by: Mozzilla? on 16 November, 2006, 12:37:11
Whoops.. Sorry.. Haven't been around here for a while.  Thanks for the reply CrazyGuy
Title: Re: TeamBot Update
Post by: achiever on 21 April, 2007, 15:13:39
[18:34] Syntax D:\...\0.3.5.2[Fusion Hub]\scripts\tp.lua:112: bad argument #1 to 'pairs' (table expected, got no value)
can some 1 correct this plzz?
Title: Re: TeamBot Update
Post by: 6Marilyn6Manson6 on 21 April, 2007, 15:17:25
Quote from: achiever on 21 April, 2007, 15:13:39
[18:34] Syntax D:\...\0.3.5.2[Fusion Hub]\scripts\tp.lua:112: bad argument #1 to 'pairs' (table expected, got no value)
can some 1 correct this plzz?

Post your script please
Title: Re: TeamBot Update
Post by: achiever on 21 April, 2007, 15:21:53
Quote from: 6Marilyn6Manson6 on 21 April, 2007, 15:17:25
Post your script please
---TeamBot Update by Mozzilla?
---Description - Allows hub users to see a full list of members by profile or full lists of individual profiles
---Original author: Mutor, original source: LUA4
---comands: !listreg / !listvip / !listop / !listmod / !listmaster / !listfounder / !listall
--// Update To Lua 5.1.1 by 6Marilyn6Manson6    27/07/2006
--// Change commands: !listreg / !listvip / !listope / !listmod / !listmas / !listntf / !listown / !listall
--// Thanks bastya_elvtars for small help with return commands :)    16/08/2006

--// Changes made By Mozzilla? 09/11/2006
--// Added new command - !listown
--// Added Owner profile, just in case it is part of your hub soft
--// Added Owner to UseCMD
--// Added Right Click
--// Changed order in which !listall is displayed
--// Added 10/11/2006
--// End result will now show HubName in display

----------------------------------------------------
----------------------------------------------------
Prefix = "!" -- ! + # ? -
sBotName = "Bot-Name-Here" -- or frmHub:GetHubBotName(),
sHubName = frmHub:GetHubName()
----------------------------------------------------
UseCMD = { -- What profile you want blocked 1/yes 0/no
[0] = 1, -- Master
[1] = 1, -- Operator
[2] = 1, -- VIP
[3] = 1, -- Registered
[4] = 1, -- Moderator
[5] = 1, -- Netfounder
[6] = 1, -- Owner
[-1] = 0, -- Unregistered
}
----------------------------------------------------
SendTo = {
[0] = 1, -- Masters
[1] = 1, -- Operators
[2] = 0, -- Vips
[3] = 0, -- Regs
[4] = 1, -- Moderator
[5] = 1, -- NetFounder
[6] = 1, -- Owner
[-1] = 0, -- Unregistered
}
----------------------------------------------------
function NewUserConnected(user)
if SendTo [user.iProfile] > 0 then
user:SendData("$UserCommand 1 3 "..sBotName.."\\List All Owners$<%[mynick]> !listown||")
user:SendData("$UserCommand 1 3 "..sBotName.."\\List All Network Founders$<%[mynick]> !listntf||")
user:SendData("$UserCommand 1 3 "..sBotName.."\\List All Masters$<%[mynick]> !listmas||")
user:SendData("$UserCommand 1 3 "..sBotName.."\\List All Operators$<%[mynick]> !listope||")
user:SendData("$UserCommand 1 3 "..sBotName.."\\List All Moderators$<%[mynick]> !listmod||")
user:SendData("$UserCommand 1 3 "..sBotName.."\\List All VIP's$<%[mynick]> !listvip||")
user:SendData("$UserCommand 1 3 "..sBotName.."\\List All Registered Users$<%[mynick]> !listreg||")
user:SendData("$UserCommand 1 3 "..sBotName.."\\List All Hub Members$<%[mynick]> !listall||")
end
end

OpConnected = NewUserConnected
----------------------------------------------------
tCommands = {
["listreg"] = function(user)
Show(user, "Reg")
end,
["listvip"] = function(user)
Show(user, "VIP")
end,
["listope"] = function(user)
Show(user, "Operator")
end,
["listmod"] = function(user)
Show(user, "Moderator")
end,
["listmas"] = function(user)
Show(user, "Master")
end,
["listntf"] = function(user)
Show(user, "NetFounder")
end,
["listown"] = function(user)
Show(user, "Owner")
end,
["listall"] = function(user)
Show(user,"Owner")
Show(user,"NetFounder")
Show(user,"Master")
Show(user,"Operator")
Show(user,"Moderator")
Show(user,"VIP")
Show(user,"Reg")
end,
}

function ChatArrival(user,data)
if user.bOperator and UseCMD[user.iProfile]==1 then
local _,_,pref,cmd = string.find(data, "%b<>%s+(%p)(%S+)%|")
if pref == Prefix and tCommands[cmd] ~= nil then
tCommands[cmd](user)
return 1
end
end
end
----------------------------------------------------
function Show(user,which)
user:SendPM(sBotName,"")
user:SendPM(sBotName,"")
user:SendPM(sBotName,"\t---<>--------------------------------------------------<>--")
user:SendPM(sBotName,"\t\tList of Current "..which.."s")
user:SendPM(sBotName,"\t\tIn "..sHubName)
user:SendPM(sBotName,"\t---<>--------------------------------------------------<>--")
local aux,usr
for aux, usr in pairs(GetUsersByProfile(which)) do
user:SendPM(sBotName,"\t\t"..usr)
end
user:SendPM(sBotName,"")
user:SendPM(sBotName,"")
end
----------------------------------------------------
--// 6Marilyn6Manson6
Title: Re: TeamBot Update
Post by: 6Marilyn6Manson6 on 21 April, 2007, 15:31:17
Whedn you receive this error?
Title: Re: TeamBot Update
Post by: achiever on 21 April, 2007, 15:34:42
i think when i was trying list masters or some other command not sure, just got list of regs.
Title: Re: TeamBot Update
Post by: Madman on 21 April, 2007, 16:23:40
this script support more then px standard profiles.
check if you have Moderator, NetFounder, Owner profiles, if you don't remove everything that has to do with those profiels from the script...
Title: Re: TeamBot Update
Post by: achiever on 21 April, 2007, 19:00:35
Moderator, NetFounder, Master, Operator, Vip, and Reg these all profiles i have in my hub, so what i need to change?
Title: Re: TeamBot Update
Post by: Madman on 22 April, 2007, 01:00:07
you don't have Owner

find and delete this...
user:SendData("$UserCommand 1 3 "..sBotName.."\\List All Owners$<%[mynick]> !listown||")
["listown"] = function(user)
Show(user, "Owner")
end,

Show(user,"Owner")
Title: Re: TeamBot Update
Post by: 6Marilyn6Manson6 on 22 April, 2007, 01:07:49
Yeah right, because in !listall for see all profile you don't have Owner profile and command search this profile and not exist, after made error...delete in your code what have write Madman in his post ^^
Title: Re: TeamBot Update
Post by: achiever on 23 April, 2007, 17:29:14
working fine now thks,

can this be made such that if a perticular profile has no entry then it should say so... in place of showing a blank-list.

thks
Title: Re: TeamBot Update
Post by: Madman on 23 April, 2007, 19:24:03
Yup, done...

Code (lua) Select

-- Added msg for missing profile, Madman
function Show(user,which)
Prof = GetUsersByProfile(which)
if Prof == nil then
user:SendPM(sBotName, "Profile " ..which.. " was not found in this hub")
else
Msg = "\n\n\t---<>" ..string.rep("-",50).. "<>--\n"
Msg = Msg.."\t\tList of Current "..which.."s\n\t\tIn "..sHubName.."\n"
Msg = Msg.."\t---<>" ..string.rep("-",50).. "<>--\n"
local aux,usr
for aux, usr in pairs(Prof) do
Msg = Msg.."\t\t"..usr.."\n"
end
user:SendPM(sBotName,Msg)
end
end
Title: Re: TeamBot Update
Post by: achiever on 24 April, 2007, 17:22:53
Quote from: Madman on 23 April, 2007, 19:24:03
Yup, done...
hi Madman,
i think u have misunderstood me.
what i needed was if there are no users of perticular profile then it should say that there r no users from this profile.
but ur code is not doing this, i think it checks if the profile is available or not?

thks,