Login Script
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Login Script

Started by speedX, 19 November, 2006, 09:52:56

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

speedX

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
Thanking You,

speedX

achiever

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 may help you :)

hope it suits u  ;)

bbye,

achiever
thks,
achiever.

speedX

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  ;)
Thanking You,

speedX

CrazyGuy

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 ?

speedX

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!! ;)
Thanking You,

speedX

CrazyGuy

#5
--[[
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

speedX

#6
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
Thanking You,

speedX

CrazyGuy

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)

speedX

Hey thx for the quick reply dude, the script works gr8
Thanking You,

speedX

CrazyGuy


TrIp-iN-SuN

crazyguy tell me why i don't see all msg in pm i see a little for msg in main and in pm?

CrazyGuy

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.

TrIp-iN-SuN

#12
where i need to replce in the script i can't find what need replace?

TrIp-iN-SuN

same one can to tell me?

CrazyGuy

It'll be in the textfile you have saved on your harddrive

fMessage = "welcome_user.txt"

TrIp-iN-SuN

really don't undersnad u the msg in pm but not all msg same from msg in main

CrazyGuy

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

speedX

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..
Thanking You,

speedX

speedX

#18
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....
Thanking You,

speedX

speedX

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....
Thanking You,

speedX

speedX

#20
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
Thanking You,

speedX

miago

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 :)
Being a biatch aint easy ;)

bastya_elvtars

For 2) consider sending the MOTD in PM.
Everything could have been anything else and it would have just as much meaning.

miago

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 =)
Being a biatch aint easy ;)

miago

As always..THANK YOU!!   :D
//Miago
Being a biatch aint easy ;)

SMF spam blocked by CleanTalk