Send Msg to UnRegged Users
 

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

Send Msg to UnRegged Users

Started by BlazeXxX, 31 October, 2003, 03:34:43

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

BlazeXxX

-- Start Copying from this line
--// Script for sending chat messages to all non-registered users
--// Format: !nonregmsg message
--// Works for operators only (all users with Key)
--//
--// by Ptaczek, 21-8-2003
--// v1.0
--//
--// Note: the nonRegistered users list is lost after script restart!

nonRegUsers = {};

function DataArrival(user, data)
if( user.bOperator and strsub(data,1,1) == "<" ) then
local msg = strsub(data, strlen(user.sName)+4, -2)
if( strsub(msg,1,1) == "!" ) then
local cmd,args
_,_,cmd,args = strfind(msg,"([%w%p]+) ([%w%s%p]+)")
if( cmd == "!nonregmsg" ) then
SendToNonReg(user, args)
return 1
end
end
end
end

function SendToNonReg(user, msg)
local fullmsg = "<"..user.sName.."> "..msg
for nick, i in nonRegUsers do
SendPmToNick(nick, "RegBot", fullmsg)
end
end

function NewUserConnected(user)
if (user.iProfile == -1) then
nonRegUsers[user.sName] = 1;
end
end

function UserDisconnected(user)
if( nonRegUsers[user.sName] ) then
nonRegUsers[user.sName] = nil
end
end

-- Finish Copying

[NL]trucker

BlazeXxX

i like your idear but......

is it possiblle to make the script read from a txt.file?

in tha case it would be easier to edit the message and to add more messages.

like "!nonregmsg" txt1 or txt2.
Owner of FunnyHub
 
Funyhub.no-ip.info
       Forum Master of


BlazeXxX

Ooops... I mentioned in top line, its not my script.. Its written by Ptacezk.. I think its possible to do it.. Just wait for some ppl like.. [NL]Pur, Phatty,Skrolster,Klownietklowniet or others who is good at scripting :)

pHaTTy

QuoteOriginally posted by [NL]trucker
BlazeXxX

i like your idear but......

is it possiblle to make the script read from a txt.file?

in tha case it would be easier to edit the message and to add more messages.

like "!nonregmsg" txt1 or txt2.

Im not sure i quite understand what you mean, can you explain a little please

so you mean when they enter the hub? they get a msg from a txt file and not have to have user input?
Resistance is futile!

pHaTTy

btw here is a quick little edit whilst im back

--// Script for sending chat messages to all non-registered users 
--// Format: !nonregmsg message 
--// Works for operators only (all users with Key) 
--// 
--// by Ptaczek, 21-8-2003 
--// v1.0 
--// 
--// Note: the nonRegistered users list is lost after script restart!
--// Some little edits by Phatty 


Prefix = "!"
Command = "nonregmsg"

nonRegUsers = {}; 

function SendToNonReg(user, msg) 
	local fullmsg = "<"..user.sName.."> "..msg 
	for nick, i in nonRegUsers do 
		SendPmToNick(nick, "RegBot", fullmsg) 
	end 
end 

function NewUserConnected(user) 
	if (user.iProfile == 1) then 
		nonRegUsers[user.sName] = 1; 
	end 
end 

function UserDisconnected(user) 
	if( nonRegUsers[user.sName] ) then 
		nonRegUsers[user.sName] = nil 
	end 
end

function DataArrival(user, data) 
	if( user.bOperator and strsub(data,1,1) == "<" ) then 
	local msg = strsub(data, strlen(user.sName)+4, -2) 
		if( strsub(msg,1,1) == Prefix ) then 
		local cmd,args 
		_,_,cmd,args = strfind(msg,"([%w%p]+) ([%w%s%p]+)") 
			if( cmd == Prefix..Command ) then 
				SendToNonReg(user, args) 
			return 1 
			end 
		end 
	end 
end


l8rr,,
Resistance is futile!

turkiye


BlazeXxX

(uk-kingdom)pH?tt?: What he means is like:

!nonregmsg txtfile1
OR
!nonregmsg txtfile2

So He would have two text files, he can choose which one should be Mass msged to unregistered users.. If you get what i meant :)

pHaTTy

Ahhh ic :o) thx i will get right on it as soon as i get 5 ;)
Resistance is futile!

pHaTTy

not got much time but ive quickly wrote this

Untested so use with care

Command = "!nonregmsg"

nonRegUsers = {}


function NewUserConnected(user) 
	if (user.iProfile == 1) then 
		nonRegUsers[user.sName] = 1 
	end 
end 

function UserDisconnected(user) 
	if( nonRegUsers[user.sName] ) then 
		nonRegUsers[user.sName] = nil 
	end 
end

function DataArrival(user, data) 
	if strsub(data, 1, 1) == "<" then
		data=strsub(data,1,strlen(data)-1)
		s,e,cmd,file = strfind(data,"%b<>%s+(%S+)%s+(%S+)")

		if cmd == Command then
			for nick, i in nonRegUsers do 
 			readfrom(file,".txt")
				while 1 do 
				line = read() 
					SendPmToNick(nick,user.sName..line) 
				end 
			readfrom() 
			end 		
		end
	end
end


l8rr,,
Resistance is futile!

BlazeXxX

So it sends like !nonregmsg 1 or !nonregmsg 2 ??? like that?

pHaTTy

nah say you make a file names test.txt

then the command wud be !nonregmsg test

l8rr,, ;)
Resistance is futile!

NightLitch

Haven't tried this one...

But with this code you should be able too restart as you wish without losing the users...

Could be wrong, maybe don't work...

Command = "!nonregmsg"

function DataArrival(user, data) 
	if strsub(data, 1, 1) == "<" then
		data=strsub(data,1,strlen(data)-1)
		s,e,cmd,file = strfind(data,"%b<>%s+(%S+)%s+(%S+)")

		if cmd == Command then
			local ru = GetUsersByProfile(GetProfileName(-1))
			for nick, i in ru do
	 			readfrom(file,".txt")
				while 1 do 
					line = read() 
					SendPmToNick(nick,user.sName..line) 
				end 
				readfrom() 
			end 		
		end
	end
end

/NightLitch
//NL

tezlo

nice try..
but -1 is not a valid profile
ptokaz doesnt keep a list of unregged users

pHaTTy

im abit confused actually from the first script

if (user.iProfile == -1) then

???
Resistance is futile!

NightLitch

notice that... just tried to be sure... And Yes...

Didn't work...

boommer.... :-D

/NightLitch
//NL

NightLitch

1 is Operator Status

and -1 is NonRegUsers
//NL

pHaTTy

Hmmmm, ye i figured that bit out, but.............i dont see why ur way does not work.....:S

hmmmmmmmmm
Resistance is futile!

BlazeXxX

Hmm Well I checked most of the scripts and Tezlo is right... Unless you store the users that is connecting in a table and read them as unregged users.. and then make use of it.. or else check the RegisteredUsers.dat file and make it send the msg to the users who is not in that file.. Either way would work for sure :)

jsjen

Could someone put up the final script cause im totally lost on what is going on.

Flux

same here i am lost too hehehehe. maybe also it's cause i am stoned too. hehehe what is the final script between them or is there a newer update...
? Official HoD Website - http://www.houseofdance.net
? Official HoD Hub Community -  hodhub.dyndns.org:2007

Optimus

mmm, i allready posted 1 like this sometime ago... that saves all to file so that after Restartscripts all are still there, etc

-- Made by Optimus
-- 08/12/03
-- make a file called unRegUsers.txt

sBot = "-=unRegUsers=-"

unRegUsers = {}
unRegUserFile = "unRegUsers.txt"

function Main()
   frmHub:RegBot(sBot)
   doloadTable(unRegUserFile)
   if frmHub:GetUsersCount() == 0 then unRegUsers = {}
      dosaveTable(user,data)
   end
end

function NewUserConnected(user)
   if user.iProfile == -1 then
      doLog_unRegUsers(user, data)
   end
end
function UserDisconnected(user)
   if unRegUsers[user.sName] then
      unRegUsers[user.sName] = nil
      dosaveTable(user,data)
   end
end

function DataArrival(user, data)
   if (strsub(data, 1, 1) == "<" ) then
      data=strsub(data,1,strlen(data)-1)
      _,_,cmd=strfind(data, "%b<>%s+(%S+)")

      if user.bOperator then
         if (cmd == "!xmass") then            
            s,e,cmd,message = strfind(data,"%b<>%s+(%S+)%s+(.+)")

            if message then
               tosend = ""
               if (strlen ( message)*2/3+2) < 76 then
               border = strrep ("-", strlen (message)*2/3+2)
               else
               border = strrep ("-", 75)
               end
               tosend = "\r\n\r\n"..border.."\r\n"..message.."\r\n"..border.."\r\n"

               if unRegUsers then
                  for name,_ in unRegUsers do
                     SendPmToNick(name,sBot, tosend)
                  end
               end
            else
               user:SendData(sBot, "*** Please Enter a Message!")
            end
         end
      end
   end
end

function doLog_unRegUsers(user, data)
   if unRegUsers[user.sName] == nil then
      unRegUsers[user.sName] = 1
      dosaveTable(user,data)
   end
end

function doloadTable(unRegUserFile)
   assert(readfrom(unRegUserFile))
   dostring(read("*all"))
   readfrom()
end

function dosaveTable(user,data)
   writeto(unRegUserFile)
   write("unRegUsers = {")
   for a,b in unRegUsers do
   if b then
   write(format("[%q]=",a)..b..",")
   end
   end
   write("}" )
   writeto()
end


SMF spam blocked by CleanTalk