I would like a script wich will give a PM to a user who has connected for the first time to the hub.
The script would contain a text file or something with it in wich the owner will add some data wich will be shown in PM. The time for wich the message will be shown shud be changeable.
Like if I want tht a user shud get tht PM for full 1 day i.e whenever he reconnects, he gets the PM.
After tht 1 day he will never get tht kinda PM ;)
I dont think such kind of script exists, if I am wrong thn plzz tel me ;)
Thx for ne help
hi,
u can use the MOTD sender, it sends motd to user according to their profile and it creates a folder in ur script folder which has text files for each profile and can be changed as whished
This (http://forum.ptokax.org/index.php?topic=6313.0) may help you :)
hope it suits u ;)
bbye,
achiever
Quote from: achiever on 19 November, 2006, 16:54:27
u can use the MOTD sender, it sends motd to user according to their profile and it creates a folder in ur script folder which has text files for each profile and can be changed as whished
Ah, nope dude i would like the message to be send to the user only on tht particular day i.e on the day of registration ;)
Okay, see if I have the idea correctly...
Suppose we make a table, and when a user logs in, we check wether he is in the table.
If not, it is his first time ever in the hub, so we add him to the table with the day's date --> tUsers[User.sName] = os.date() (for example)
And we send the user a welcome message in pm.
The next time the user logs in, we check the table again, and this time we find him with a date stored he first logged in.
If this date is still today's date, then send pm again.
If not, then take no action
Correct ?
Quote from: CrazyGuy on 20 November, 2006, 12:16:37
Okay, see if I have the idea correctly...
Suppose we make a table, and when a user logs in, we check wether he is in the table.
If not, it is his first time ever in the hub, so we add him to the table with the day's date --> tUsers[User.sName] = os.date() (for example)
And we send the user a welcome message in pm.
The next time the user logs in, we check the table again, and this time we find him with a date stored he first logged in.
If this date is still today's date, then send pm again.
If not, then take no action
Correct ?
Perfect!! ;)
--[[
New User Message script by CrazyGuy
requested by speedx
written in LUA 5
requires file welcome_user.txt which holds the message send to the new users.
Script sends new user a pm on login, and on every following login on the first day.
Only if profile = -1
]]--
fRegistration = "known_users.dat"
fMessage = "welcome_user.txt"
sMessage = ""
tKnown = {}
Main = function()
LoadTable(tKnown, fRegistration)
LoadText(fMessage)
end
LoadTable = function(tTable, fFile)
local fHandle = io.open(fFile)
if fHandle then
fHandle:close()
tTable.items = dofile(fFile)
end
end
LoadText = function(fFile)
local fHandle = io.open(fFile)
if fHandle then
sMessage = fHandle:read("*a")
fHandle:close()
end
end
NewUserConnected = function(User)
if tKnown[User.sName] == nil then
tKnown[User.sName] = tonumber(os.date("%m")).."-"..tonumber(os.date("%d"))
User:SendPM(frmHub:GetHubBotName(), sMessage)
SafeList(tKnown, "tKnown", fRegistration)
else
if tKnown[User.sName] == tonumber(os.date("%m")).."-"..tonumber(os.date("%d")) then
User:SendPM(frmHub:GetHubBotName(), sMessage)
SafeList(tKnown, "tKnown", fRegistration)
end
end
end
function SafeList(tList, sList, fList)
local hList = io.open(fList, "w+")
hList:write(Serialize(tList, sList))
hList:flush()
hList:close()
end
function Serialize(tTable, sTableName, sTab)
sTab = sTab or "";
sTmp = ""
sTmp = sTmp..sTab..sTableName.." = {\n"
for key, value in pairs(tTable) do
local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key);
if(type(value) == "table") then
sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
else
local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value);
sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
end
sTmp = sTmp..",\n"
end
sTmp = sTmp..sTab.."}"
return sTmp
end
Aight, give that a go.
I haven't tested it, and you'll need to create the textfile first which will hold the message
Thx for the help CrazyGuy ;)
but
requires file welcome_user.txt which holds the message send to the new users.
Script sends new user a pm on login, and on every following login on the first day.
Only if profile = -1
Is it possible to make it for all profiles??
And also whenever a PM goes to a user, at the top of PM his name with profile shud come like:
Quote
Private Message to Reg speedX
Private Message to Operator CrazyGuy
Thank you for any help
QuoteIs it possible to make it for all profiles??
Yes, add a line somewhere saying
OpConnected = NewUserConnected
Quote
And also whenever a PM goes to a user, at the top of PM his name with profile shud come like:
Quote
Private Message to Reg speedX
Private Message to Operator CrazyGuy
Change
User:SendPM(frmHub:GetHubBotName(), sMessage)
to
User:SendPM(frmHub:GetHubBotName(), "Private Message to "..GetProfileName(User.iProfile).." "..User.sName.."\r\n"..sMessage)
Hey thx for the quick reply dude, the script works gr8
cool, enjoy ;D
crazyguy tell me why i don't see all msg in pm i see a little for msg in main and in pm?
If the message starts in pm and then switches to main, It is usually caused by an endpipe in the message.
Endpipes ( | ) should be replaced with | for proper handling.
where i need to replce in the script i can't find what need replace?
same one can to tell me?
It'll be in the textfile you have saved on your harddrive
fMessage = "welcome_user.txt"
really don't undersnad u the msg in pm but not all msg same from msg in main
Quote from: TrIp-iN-SuN on 11 January, 2007, 18:56:15
really don't undersnad u the msg in pm but not all msg same from msg in main
hmm, maybe i'm not understanding you...
This script sends 1 message, the 1 stored in the file welcome_user.txt at once in 1 pm using User:SendPM.
So, unless the message send has some reserved characters in it, it cannot end up in both pm and main.
Hope that helps, and if not, can you paste here in a post what exactly goes to pm and what exactly goes to main, + paste also the whole txt file plz
Hello Mutor,
-- Number of days new users should receive the welcome message
Days = 1,
Is it possible to convert the days into hours or minutes??
Like this
-- Total Minutes new users should receive the welcome message
Minutes = 60,
Please..
I am getting the following error
Quote
Syntax ...Scripts\Original\HOPS HUB\HOPS HUB\scripts\guest.lua:87: attempt to index field 'Guests' (a nil value)
Wat might be the problem?? Is it frm my side??
And when I login I dont get the message....
The script works well now
But there is one prob....
My settings are
-- Increment of time to use for welcome message ["day"/"hour"/"mins"]
Increment = "mins",
-- Number of 'increments' above new users should receive the welcome message
Count = 1,
Still after 1 minute the user gets the message....
Quote from: Mutor on 08 February, 2007, 02:49:47
Man, I must be getting old in my old age.
lol
The script works well, thanx Mutor
Good evening
Quote-- Welcome message, [usr] shall be replaced with user's name, prof with user's profile
Msg = "Welcome to "..frmHub:GetHubName()..". We're glad you could join us prof usr.",
-- Send this file [path/file] instead of message above ["" = none/use Msg above]
MessageFile = "",
Is it possible to make these options work at the sime time?
1. Welcome message appears in mainchat so that everybody can see that the new user has logged in?
and
2. Messagefile is sent in pm to the user?
Thank you :)
For 2) consider sending the MOTD in PM.
Since I was thinking of a welocomeinfo/welcomemessage that only is being sent on the first day the user is new in the hub, MOTD isn't so good, but thank you for fast reply =)
//Miago
PS. I have this script alreday that sends a textmessage in pm to the new user during the first day
"New User Message script by CrazyGuy
requested by speedx
written in LUA 5"
but my thoughts now was to use this one instead if it can do both the options =)
As always..THANK YOU!! :D
//Miago
Thank you for the nice scripts Mr Mutor.. I started working on my College DC Hub yesterday and in the proces of finding various scripts like request bot,freshstuff,message bot etc I have come across ur posts and found them very important.. both on this board and the other uknet board... My main reason for registering was to only express my thanks to you , bastya_elvtars and hiten.