PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: Techno_man on 13 September, 2005, 19:35:40

Title: message on connect
Post by: Techno_man on 13 September, 2005, 19:35:40
Hi,

I'd like a script that sends a PM to every user on connect.

Thanks!!  :D
Title:
Post by: mateci on 13 September, 2005, 20:58:53
Can u explain more about what u are wanting(if possible give some examples pls)?
Title:
Post by: Techno_man on 13 September, 2005, 21:10:40
I would like a script that send a message like this:
"Register yourself now!!" in PM to every not register user on login.

do you understand?   :)
Title:
Post by: mateci on 13 September, 2005, 22:19:45
This is the most simple script which sends reg message on connect if not reg user..


sBot = "RegtoHub"   -- Reg message send with this name. Use " "
ShowBot = 1 -- If it is 0, the bot can not see like an op in the user list and the message send to main(Dc++). Don't use " "

RegMsg = "Please Register to Hub"   -- Reg message. Change with your reg message. Use " "

function Main()
if ShowBot == 1 then
frmHub:RegBot(sBot)
end
end
function NewUserConnected(curUser)
if curUser.bRegistered ~= 1 then
curUser:SendPM(sBot,RegMsg)
end
end


If it s what u want good uses

Changed RegBot location as bastya_elvtars' warning. (thx)
Title:
Post by: bastya_elvtars on 13 September, 2005, 22:53:14
1) Please use RegBot in Main() to save resources, enough to reg only once. :)
2) user.bRegistered can NEVER be 1, it's a boolean, it can be true or false. Use like:
if user.bRegistered then -- yes, it is
if not user.bRegistered then -- nope, it ain't

No offences, just advice. ;-)
Title:
Post by: mateci on 14 September, 2005, 11:15:07
QuoteOriginally posted by bastya_elvtars

user.bRegistered can NEVER be 1, it's a boolean, it can be true or false. Use like:


I try this code now and it gives 1

function NewUserConnected(curUser)
a = curUser.bRegistered
curUser:SendPM(sBot,a)
end

thx again for first one..
Title:
Post by: Cêñoßy†ê on 14 September, 2005, 15:13:52
;)

function NewUserConnected(curUser)
if user.iProfile == -1 then
curUser:SendPM(sBot,RegMsg)
end
end
Title:
Post by: [UK]Madman on 14 September, 2005, 16:10:54
From Lua manual;

In Lua, both nil and false make a condition false; any other value makes it true.

So user.bRegistered will return nil as false and a non-nil value as true (ive never seen it return true as anything but 1)