PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: Smulf on 11 January, 2004, 17:41:56

Title: Need difr. scripts
Post by: Smulf on 11 January, 2004, 17:41:56
Hi

I was wondering if someone got these scripts and would like to post them.

1. A simpel script when a user is writing !rules the rules would be shown in main window, it would be nice if I could write the rules in a text file.

2. A script so users can reg them self.

3. A script with an OP bot so only OP's and masters can talk.

4. A script so ONLY masters can talk to each other.

Well anyway thanks if some of them is posible.
 
 
Title: Hi...!
Post by: WickeD on 11 January, 2004, 17:57:56
I think that you can get all that funktions out off RoboCop 5b....!

Try it and see...it is the best Bot/Script there is!...But that is me!  =)

Good luck!


//WickeD
Title: k, but...
Post by: Smulf on 11 January, 2004, 18:10:03
Thanks but I need them separately...
Title:
Post by: NightLitch on 11 January, 2004, 18:35:50
Simple Scripts:

Rule-Bot

-- By: NightLitch
Bot = "RuleBot"
filename = "rules.txt"
command = "+rules"

function Main()
frmHub:RegBot(Bot)
end

function DataArrival(user, data)
if( strsub(data, 1, 1) == "<" ) then
s,e,cmd = strfind( data, "%b<>%s+(%S+)%s*")
cmd=strsub(cmd,1,strlen(cmd)-1)
if (cmd==command) then
readfrom(textfile)
while 1 do
line = read()
if line == nil then break end
user:SendPM(Bot,line)
end
readfrom()
end
end
end

Reg-Me Bot

Bot = "RegMe"

function Main()
end

function DataArrival(user, data)
if (strsub(data, 1, 1) == "<") then
data=strsub(data,1,strlen(data)-1)
local _,_,cmd=strfind(data, "%b<>%s+(%S+)")

if not cmd then return 0; end

cmd = strlower(cmd)

if (cmd =="!regme") and not user.bOperator then
local _,_,cmd,AddPass = strfind( data, "%b<>%s+(%S+)%s+(.+)" )

if (AddPass ~= nil and strfind(AddPass, "%W") == nil) then
AddRegUser(user.sName, AddPass,3)
user:SendData(Bot," "..user.sName.."  *** You have been succesfull added as new Registred user!! ***")
user:SendData(Bot, "Your password is:  "..AddPass.."  Reconnect and use that!!")
else
user:SendData(Bot,"*** Syntax: !regme ***");
end

return 1;
elseif (cmd =="!showregs") then
local ru = GetUsersByProfile(GetProfileName(3))
for i, n in ru do
SendPmToNick(user.sName, Bot, n)
end
end
end
end

Master Chat
-- Master-Chat
-- Original VipChat v1.0
-- By Guibs 10/11/2003
-- Enjoy :)
-- Simple Modify by NightLitch
-- to Master Bot Only

------------------
-- Main Function --
------------------
function Main()
OPCHAT = "-=Master-Chat=-"
frmHub:RegBot(OPCHAT)
end

------------------
-- Data Arrival --
------------------

function DataArrival(user,data)
if(strsub(data,1,4) == "$To:") then
s,e,whoTo = strfind(data,"$To:%s+(%S+)")
if whoTo == OPCHAT then
if user.iProfile == 0 then
s,e,whoTo,from,msg = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(.+)")
MasterChatRoom(user,msg)
end
end
end
end

function MasterChatRoom(user,msg)
local allprofiles = GetProfiles()
local index, profile, index2, nick
for index, profile in allprofiles do
local users = GetUsersByProfile(profile)
for index2, nick in users do
local usr = GetItemByName(nick)
if usr ~= nil then
if user.sName == usr.sName then
else
if usr.iProfile == 0 then
usr:SendData("$To: "..usr.sName.." From: "..OPCHAT.." $<"..user.sName.."> " ..msg)
end
end
end
end
end
end

Op/Master Chat

-- Op/Master-Chat
-- Original VipChat v1.0
-- By Guibs 10/11/2003
-- Enjoy :)
-- Simple Modify by NightLitch
-- to Master Bot Only

------------------
-- Main Function --
------------------
function Main()
OPCHAT = "-=Op-Chat=-"
frmHub:RegBot(OPCHAT)
end

------------------
-- Data Arrival --
------------------

function DataArrival(user,data)
if(strsub(data,1,4) == "$To:") then
s,e,whoTo = strfind(data,"$To:%s+(%S+)")
if whoTo == OPCHAT then
if user.iProfile == 0 or user.iProfile == 1 then
s,e,whoTo,from,msg = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(.+)")
ChatRoom(user,msg)
end
end
end
end

function ChatRoom(user,msg)
local allprofiles = GetProfiles()
local index, profile, index2, nick
for index, profile in allprofiles do
local users = GetUsersByProfile(profile)
for index2, nick in users do
local usr = GetItemByName(nick)
if usr ~= nil then
if user.sName == usr.sName then
else
if usr.iProfile == 0 or usr.iProfile == 1 then
usr:SendData("$To: "..usr.sName.." From: "..OPCHAT.." $<"..user.sName.."> " ..msg)
end
end
end
end
end
end

Hope it help's...
Title: Thanks!
Post by: Smulf on 11 January, 2004, 19:02:39
Oh thanks alot! Just what I needed...!
Title:
Post by: Smulf on 11 January, 2004, 19:19:47
Where should I put the rules.txt...?
Title:
Post by: B@B? on 11 January, 2004, 19:44:06
QuoteOriginally posted by Smulf
Where should I put the rules.txt...?

In the *Scripts* - Folder... :O
Title:
Post by: raz on 11 January, 2004, 19:50:17
y do u need a script if ptokax already has Opchat in it.lolll. :D
Title:
Post by: B@B? on 11 January, 2004, 19:55:22
QuoteOriginally posted by raz
y do u need a script if ptokax already has Opchat in it.lolll. :D

That?s, why below his name stands NEWBIE!

And NEWBIES...we?d all been...since a time, doesn?t we?  :rolleyes:
Title:
Post by: Smulf on 11 January, 2004, 19:58:08
Yeh okay I have found out... I'm only newb with scripting...
Title: Thnx
Post by: XPMAN on 11 January, 2004, 20:36:08
Hey thanks for the stand alone chat scripts....very handy to have. Much appreciated, am using the  Op\Master chat now in the hub.

Thnx again.
Title:
Post by: NightLitch on 11 January, 2004, 20:59:37
Well it wasn't really hard modify Guibs VIP-Chat...

If you all want I can make it so You can Deside yourself
witch levels are allowed chatting in it...?

But Guibs should have the big eloge here for creating it...
Title:
Post by: NightLitch on 11 January, 2004, 21:02:01
One Point...

The OP/Master Bot is exact the same as the Built-In OP-Chat...

The Master Chat is only for Masters...
Title:
Post by: kepp on 11 January, 2004, 21:09:05
QuoteOriginally posted by B@B?
QuoteOriginally posted by raz
y do u need a script if ptokax already has Opchat in it.lolll. :D

That?s, why below his name stands NEWBIE!

And NEWBIES...we?d all been...since a time, doesn?t we?  :rolleyes:

So what? NEWBIE or NOT... So are you.. me and everyone else on this forum i suppose, Bacuase no-1 knows everything in LUA, I prefer a stand alone script for OpChat as you can configure it for your needs
Title:
Post by: NightLitch on 11 January, 2004, 21:12:14
agree to your words kepp... We are not here to slap each others face's
for being NEWBIE's... where here to help each others...

or AM I wrong ?
Title:
Post by: plop on 12 January, 2004, 00:35:21
QuoteOriginally posted by NightLitch
agree to your words kepp... We are not here to slap each others face's
for being NEWBIE's... where here to help each others...

or AM I wrong ?
your right, but i hope you vote left. lol
and just like kepp i have my own opchat in a.i. bot.
reason is simple, didn't like the opchat from ptokax.
my version users can msg straigth into it but can't read it unless the ops use a special command 2 reply.
+ i added a filter for that anoying "Don't ask..." from bcdc++, and away msg's.

plop