PtokaX forum

Lua 5.3/5.2/5.1 Scripts (for PtokaX 0.4.0.0 and newer) => Request for scripts => Topic started by: hawaj on 07 July, 2021, 12:24:12

Title: simple welcome script
Post by: hawaj on 07 July, 2021, 12:24:12
hi iam looking fore simple welcome msg on log in script for all users (reg , unreg , etc)
with couple welcome msgs
can any1 help me with that script ????

best regards
Title: Re: simple welcome script
Post by: ATAG on 09 September, 2021, 15:01:12
Like this?
-- px_simple-welcome.lua /ATAG
-- Send welcome messages randomly

tMessages = {
"This is the first welcome message for you, have a nice day.",
[[a multiline
message looks
like this
if you want :)]],
"this is an other one...",
"you can use only static text this way.",
"Don't forget the comma at the end of line",
"And don't use quotation mark in the message :)",
}

function UserConnected(tUser)
--math.randomseed(os.time())
local i = math.random(1,table.getn(tMessages))
Core.SendToUser(tUser, "<"..SetMan.GetString(21).."> "..tMessages[i])
end
-- comment it to disable for reg users
Regconnected = UserConnected
-- comment it to disable for operators
OpConnected = UserConnected