message on connect
 

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

message on connect

Started by Techno_man, 13 September, 2005, 19:35:40

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Techno_man

Hi,

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

Thanks!!  :D

mateci

Can u explain more about what u are wanting(if possible give some examples pls)?

Techno_man

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?   :)

mateci

#3
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)

bastya_elvtars

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. ;-)
Everything could have been anything else and it would have just as much meaning.

mateci

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..

Cêñoßy†ê

;)

function NewUserConnected(curUser)
	if user.iProfile == -1 then
		curUser:SendPM(sBot,RegMsg)
	end
end
Powered By Leviathan™ 2nd Generation v. 1.9

[UK]Madman

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)

SMF spam blocked by CleanTalk