PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: liq?i?sw?rdz on 17 November, 2003, 11:39:51

Title: Need a Pm when entering script
Post by: liq?i?sw?rdz on 17 November, 2003, 11:39:51
could someone please make me a pm upon eantering script one to pm ops when they enter and one to pm regular users when they enter?
Title:
Post by: kepp on 17 November, 2003, 12:28:53
Bot = "Your_Bot_Name_Here"

function NewOpConnected(user)
SendPmToAll(Bot, "Welcome Home "..user.sName.." Beware this beast ...")
end


function OpDisconnected(user)
SendPmToAll(Bot, "Where do you think you are going "..user.sName.."? Get back emediately...")
end
Title:
Post by: BlazeXxX on 17 November, 2003, 12:38:10
-- Modified by BlazeX
-- Originally written by Kepp

Bot = "Your_Bot_Name_Here"

function NewOpConnected(user)
SendPmToNick(Bot, "Welcome Home "..user.sName.." Beware this beast ...")
end

function OpDisconnected(user)
SendPmToNick(Bot, "Where do you think you are going "..user.sName.."? Get back emediately...")
end

function NewUserConnected(user)
SendPmToNick(Bot, "Welcome Home "..user.sName.." Enjoy Your Stay ...")
end

function UserDisconnected(user)
SendPmToNick(Bot, "Bye Bye "..user.sName.." Thx for your stay ...")
end

--- End of Script

Kepp: I think he asked for new users too.. not just OPs.. So i just made a little modification to ur original one..  :D
Title:
Post by: kepp on 17 November, 2003, 14:37:52
oups, 2 more cup of coffe's and i would have done that :D :P
Title:
Post by: BlazeXxX on 19 November, 2003, 11:50:40
HeeHee.. lol.. No probs :)
Title:
Post by: liq?i?sw?rdz on 19 November, 2003, 16:17:15
ahhh thanks guys
Title:
Post by: liq?i?sw?rdz on 19 November, 2003, 16:29:35
Yo blaze do you think u can have it where it loads from a text file?   and the disconnecting messege could be takin out I only would like to pm them when they enter.
Title:
Post by: lazyj189 on 24 November, 2003, 07:15:26
ya having it read from a terxt file would be nice.
Title:
Post by: BlazeXxX on 24 November, 2003, 12:17:31
OK No problem.. I will write one tonight and post it ..
Title:
Post by: kepp on 24 November, 2003, 20:54:52
Bot = "BotName_Here"
file = "txt/Welcome.txt"

           function OpConnected(user)
             readfrom(file,"a")
             msg = ""
             while 1 do
             line = read()
                 if line == nil then break
     else
             message = msg..line.."\r\n"
      end
end
             SendPmToNick(Bot, message)
       readfrom()
  return 1
end

I have not tested this one!
Title:
Post by: BlazeXxX on 25 November, 2003, 09:08:54
Hia :)
I wrote one few months back, which reads two seperate files for diff profiles.. Might be useful for others..

-- Start copying from this line
-- Requested by liq?i?sw?rdz
-- Written by BlazeXxX

Bot = "Welcomer"
function Main()
frmHub:RegBot(Bot)
end

function NewUserConnected(curUser)
readfrom("users.txt")
local message = ""
while 1 do
local line = read()
if (line == nil) then break else
message = message..line.."\r\n"
end
end
curUser:SendPM(Bot,message)
end

function NewOpConnected(curUser)
readfrom("op.txt")
local message = ""
while 1 do
local line = read()
if (line == nil) then break else
message = message..line.."\r\n"
end
end
curUser:SendPM(Bot,message)
end

-- Finish copying
Title:
Post by: liq?i?sw?rdz on 25 November, 2003, 11:36:17
Just what I was looking for...thanks blaze
Title:
Post by: BlazeXxX on 25 November, 2003, 20:55:15
No probs.. You can try kepp's one to .. u have alternatives to choose from :)
Title:
Post by: liq?i?sw?rdz on 26 November, 2003, 04:26:50
Yo i cant get neither script to work can someone please help...............anybody
Title:
Post by: MrBuitenhuizenJunior on 26 November, 2003, 07:03:27
Hello,

I don't know this was the cause of the problem but maybe it is....
I've done a little change in the script:

("function NewOpConnected(curUser)" -> "function OpConnected(curUser)"

now the Op gets the message every time he connects and not only when he is a new one.
Add your own profiles, as example I have now added the profiles: OP, SOP and MASTER.
Don't forget to make your .txt documents.

-- Requested by liq?i?sw?rdz
-- Written by BlazeXxX

Bot = "your botname here"
function Main()
frmHub:RegBot(Bot)  
end

function OpConnected(curUser)
readfrom("op.txt")
local message = ""
while 1 do
local line = read()
if (line == nil) then break else
message = message..line.."\r\n"
end
end
curUser:SendPM(Bot,message)
end

function SOPConnected(curUser)
readfrom("sop.txt")
local message = ""
while 1 do
local line = read()
if (line == nil) then break else
message = message..line.."\r\n"
end
end
curUser:SendPM(Bot,message)
end


function MASTERConnected(curUser)
readfrom("master.txt")
local message = ""
while 1 do
local line = read()
if (line == nil) then break else
message = message..line.."\r\n"
end
end
curUser:SendPM(Bot,message)
end

-----

[NL]MrBuitenhuizen
Title:
Post by: kepp on 26 November, 2003, 07:12:57
And you noticed that your script dosen't work :P

To display some rules for a certain Profile
you can just use
if curUser.iProfile == 0 or
curUser.iProfile == 1 then
--// Open up some text for those two
end
Title:
Post by: MrBuitenhuizenJunior on 26 November, 2003, 07:34:50
Hello,

You're right it doesn't open the .txt file, but for me it works because I write the message between the " ", at:
"local message = " "  "
So it doesn't work the way wanted (load from a txt file)
So now we wait when you're returning from your work kepp  :D


[NL]MrBuitenhuizen
Title:
Post by: liq?i?sw?rdz on 26 November, 2003, 11:18:07
Having the script load from different files for different profiles would be nice.....but I have tried alllot of scripts and none seem to work. So if yours work please post
with instructions please
Title:
Post by: BlazeXxX on 26 November, 2003, 11:55:19
OK Sorry.. I didn't test it man.. Will post a new one that works with all profiles :)

Bye 4 now :)
Title: Question
Post by: Fire Koboy on 27 November, 2003, 19:08:08
I made some changes on a script... and would like to know if it will works or not...(I'm the only admin of the hub cause I want to be the only one to receive this message)

"

BotName = "my bot name"

function NewUserConnected(curUser)

SendPmToAdmin(Bot, "User: "..curUser..", a not registered user enter the hub...")
end


function NewUserDisconnected(user)
SendPmToAdmin(Bot, "User: "..curUser.." is gone...")
end

"

Instead of : "SendPmToAdmin"..
Is there another stuff like SendPmToMe or something else I don't know???

Could you correct it if it needs..
Other stuff..
In the "gone" message I would like to know how many time the user spend on the hub...possible???Could you add this fonction on my script???

Thanx to reply...and correct me...That's better to learn when mistakes are said by a good teacher..lol
++
Title: grrr
Post by: Fire Koboy on 27 November, 2003, 19:10:17
Actually I'm sure my script contains mistakes cause new users just connected and I didn't received anything :(
Title:
Post by: BlazeXxX on 29 November, 2003, 02:58:55
Hi there,
See if this one helps.. I modified the script for you..

Byez,
BlazeX

--// Modified by BlazeXxX
--// Random Intros and Outros
--// Originally By Chaggydawg


HubOwner = "HubOwnerName"

intros = {
"[USERNAME] Crawls In On Their Hands And Knees.",
"In A Fiery Explosion [USERNAME] Appears.",
"With A Crazed Look In Their Eyes [USERNAME] Arrives.",
"Sir [USERNAME] Of The East Lunatic Fringe Has Arrived.",
"[USERNAME] Arrives Yelling And Screaming Like A Maniac.",
"[USERNAME] Arrives Ranting And Raving About Aliens Or Some Such Rot.",
"The Demented [USERNAME] Has Arrived.",
"[USERNAME] Climbs In Through The Window.",
"[USERNAME] Falls From The Skylight And Lands On A Chair.",
"[USERNAME] Enters the Room Via The Basement Door.",
"[USERNAME]  is here, How about a round of elfgirls for everyone?",
}

outros = {
"[USERNAME] Has Left The Hub",
"Jumping Through A Plate-Glass Window [USERNAME] Leaves The Hub.",
"Aliens Rocks Abduct [USERNAME], And They Are Gone.",
"[USERNAME] Begins Shrinking, And Eventually Disappears From The Hub.",
"Suddenly [USERNAME] Leaps Up And Bolts For The Door.",
"[USERNAME] Tosses A Ten On Janine Dresser And Walks Out The Door.",
"[USERNAME] Runs Around The Room Screaming And Then Leaps Out The Window.",
}


function OpConnected(curUser)
Blaze = GetProfileName(curUser.iProfile)
if GetProfileName(curUser.iProfile) == "Master" then Blaze = "Administrator" end
if curUser.sName == HubOwner then Blaze = "Hub Owner" end
intro, x = gsub(intros[random(1,getn(intros))], "%b[]", curUser.sName)
SendToAll(Blaze, intro)
end

function OpDisconnected(curUser)
Blaze = GetProfileName(curUser.iProfile)
if GetProfileName(curUser.iProfile) == "Master" then Blaze = "Administrator" end
if curUser.sName == HubOwner then Blaze = "Hub Owner" end
outro, x = gsub(outros[random(1,getn(outros))], "%b[]", curUser.sName)
SendToAll(Blaze, outro)
end