Want to send different messages ...
 

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

Want to send different messages ...

Started by ketso, 07 November, 2003, 19:06:06

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ketso

To unregistered users and registered users.

All unregistered get: Welcome bla bla bla bla bla ......

All other gets : Welcome

Got it to work on Owner, operator,  OP, but not on VIP and REG.

If i set the privilege "kick" on them i get it to work, but i dont want to give that to VIP/REG.
How can i make this happend? (i use PtokaX TD4)

NightLitch

instead of using:

if curUser.bOperator then

use

if curUser.siProfile == 2 then


0 = MASTER, 1 = OP, 2 = VIP, 3 = REG, -1 = USER


hope it helps...

/NightLitch
//NL

NightLitch

for multiple users like you want VIP & REG to use one and NonREG one try this one:



function NewUserConnected(curUser)
if curUser.siProfile == 2 or curUser.siProfile == 3 then
curUser:SendData(BotName,"Welcome for VIP & REG")
else
curUser:SendData(BotName,"Welcome for Non REG")
end
end


/NightLitch
//NL

ketso

I'm new in this and now i have messed it up on this file (forgot to take backup)

-- InFoBot
Bot = "-InFo-"

function Main()
frmHub:RegBot(Bot)
end
function NewUserConnected(curUser) --this got all wrong now (and next line :)
if curUser.siProfile == -1 then
function curUser(curUser)
handle = openfile("txt/regged.txt", "r")
      if (handle ~= nil) then
        local line = read(handle)
        local sMsg = "\r\n"
        while line do
          sMsg = sMsg..line.."\r\n"
          line = read(handle)
end
answer = ""..sMsg..""
      SendToOps(Bot, answer)
      closefile(handle)
end
end
function DataArrival(user, data)
if( strsub(data, 1, 1) == "<" ) then
if( strfind( strlower(data), strlower("+help")) ) then   
handle = openfile("txt/help.txt", "r")
      if (handle ~= nil) then
        local line = read(handle)
        local sMsg = "\r\n"
        while line do
          sMsg = sMsg..line.."\r\n"
          line = read(handle)
end
answer = ""..sMsg..""
      user:SendPM(Bot, answer)
      closefile(handle)
   end
     end
end
if( strsub(data, 1, 1) == "<" ) then
if( strfind( strlower(data), strlower("+info")) ) then
      handle = openfile("txt/info.txt", "r")
      if (handle ~= nil) then
        local line = read(handle)
        local sMsg = "\r\n"
        while line do
          sMsg = sMsg..line.."\r\n"
          line = read(handle)
end
answer = ""..sMsg..""
      user:SendPM(Bot, answer)
      closefile(handle)
      end
    end
end
if( strsub(data, 1, 1) == "<" ) then
if( strfind( strlower(data), strlower("+rules")) ) then
      handle = openfile("txt/rules.txt", "r")
      if (handle ~= nil) then
        local line = read(handle)
        local sMsg = "\r\n"
        while line do
          sMsg = sMsg..line.."\r\n"
          line = read(handle)
end
answer = ""..sMsg..""
      user:SendPM(Bot, answer)
      closefile(handle)
      end
    end
end
if( strsub(data, 1, 1) == "<" ) then
if( strfind( strlower(data), strlower("+news")) ) then
      handle = openfile("txt/news.txt", "r")
      if (handle ~= nil) then
        local line = read(handle)
        local sMsg = "\r\n"
        while line do
          sMsg = sMsg..line.."\r\n"
          line = read(handle)
end
answer = ""..sMsg..""
      user:SendPM(Bot, answer)
      closefile(handle)
      end
    end
end
if( strsub(data, 1, 1) == "<" ) then
if( strfind( strlower(data), strlower("+agreedto")) ) then
      handle = openfile("txt/agree.txt", "r")
      if (handle ~= nil) then
        local line = read(handle)
        local sMsg = "\r\n"
        while line do
          sMsg = sMsg..line.."\r\n"
          line = read(handle)
end
answer = ""..sMsg..""
      user:SendPM(Bot, answer)
      closefile(handle)
      end
    end
end
if strsub(data, 1, 9+strlen(Bot)) == "$GetINFO "..Bot then
      user:SendData("$MyINFO $ALL "..Bot.." zInFo v.0.1$ $LAN(T3)\001$$0$")
end
end

NightLitch

#4
really messy... hehe.. but I can fix it for ya, later... If not somebody else is quicker...

/NightLitch
//NL

NightLitch

Here you go just a start have explained a few things... but not much....

Can do it more simple later if you want...

-- InFoBot 
--By: NightLitch to ketso
--
-- NOTE: Don't forget to create following files in txt-folder:
-- regged.txt, nonreg.txt, help.txt, rules.txt, info.txt,  news.txt & agree.txt
--

--// Set Botname
Bot = "-InFo-" 
--// Registred Users Welcome File
REGFile = ("txt/regged.txt")
--// Non-Registred Users Welcome File
NONFile = ("txt/nonreg.txt")


--// This is fired when hub starts or scripts restarted
function Main() 
	frmHub:RegBot(Bot) 
end 

--// This is fired when a new user logs in...
function NewUserConnected(curUser)
	if curUser.siProfile == 2 or curUser.siProfile == 3 then 
		REGGEDTEXTLOAD(curUser)
	else
		NONREGTEXTLOAD(curUser) 
	end
end

--// Read Registred Users File
function REGGEDTEXTLOAD(curUser) 
	handle = openfile(REGFile, "r") 
	if (handle ~= nil) then 
		local line = read(handle) 
		local sMsg = "\r\n" 
		while line do 
			sMsg = sMsg..line.."\r\n" 
			line = read(handle) 
		end 
		answer = ""..sMsg.."" 
		curUser:SendData(Bot, answer) 
		closefile(handle) 
	end 
end 
--// Read Non-Registred Users File
function NONREGTEXTLOAD(curUser) 
	handle = openfile(NONFile, "r") 
	if (handle ~= nil) then 
		local line = read(handle) 
		local sMsg = "\r\n" 
		while line do 
			sMsg = sMsg..line.."\r\n" 
			line = read(handle) 
		end 
		answer = ""..sMsg.."" 
		curUser:SendData(Bot, answer) 
		closefile(handle) 
	end 
end 

--// Send Data Arrival
function DataArrival(curUser, data) 
	if( strsub(data, 1, 1) == "<" ) then
	
----------------------------------------------------------------------------------
--// Help Command
		if( strfind( strlower(data), strlower("+help")) ) then 
			handle = openfile("txt/help.txt", "r") 
			if (handle ~= nil) then 
				local line = read(handle) 
				local sMsg = "\r\n" 
				while line do 
					sMsg = sMsg..line.."\r\n" 
					line = read(handle) 
				end 
				answer = ""..sMsg.."" 
				curUser:SendPM(Bot, answer) 
				closefile(handle) 
			end 
			return 1
----------------------------------------------------------------------------------
--// Info Command
		elseif( strfind( strlower(data), strlower("+info")) ) then 
			handle = openfile("txt/info.txt", "r") 
			if (handle ~= nil) then 
				local line = read(handle) 
				local sMsg = "\r\n" 
				while line do 
					sMsg = sMsg..line.."\r\n" 
					line = read(handle) 
				end 
				answer = ""..sMsg.."" 
				curUser:SendPM(Bot, answer) 
				closefile(handle) 
			end 
			return 1
----------------------------------------------------------------------------------
--// Rule Command
		elseif(	strfind( strlower(data), strlower("+rules")) ) then 
			handle = openfile("txt/rules.txt", "r") 
			if (handle ~= nil) then 
				local line = read(handle) 
				local sMsg = "\r\n" 
				while line do 
					sMsg = sMsg..line.."\r\n" 
					line = read(handle) 
				end 
				answer = ""..sMsg.."" 
				curUser:SendPM(Bot, answer) 
				closefile(handle) 
			end 
			return 1
----------------------------------------------------------------------------------
--// News Command
		elseif( strfind( strlower(data), strlower("+news")) ) then 
			handle = openfile("txt/news.txt", "r") 
			if (handle ~= nil) then 
				local line = read(handle) 
				local sMsg = "\r\n" 
				while line do 
					sMsg = sMsg..line.."\r\n" 
					line = read(handle) 
				end 
				answer = ""..sMsg.."" 
				curUser:SendPM(Bot, answer) 
				closefile(handle) 
			end
			return 1
----------------------------------------------------------------------------------
--// Agreeto Command
		elseif(	strfind( strlower(data), strlower("+agreedto")) ) then 
			handle = openfile("txt/agree.txt", "r") 
			if (handle ~= nil) then 
				local line = read(handle) 
				local sMsg = "\r\n" 
				while line do 
					sMsg = sMsg..line.."\r\n" 
					line = read(handle) 
				end 
				answer = ""..sMsg.."" 
				curUser:SendPM(Bot, answer) 
				closefile(handle) 
			end
			return 1
		end
	end
end



/NightLitch
//NL

ketso

#6
This give me nonreg.txt file on both unregged, vip, reg

I have a leecher script that give nonregged users a message and that works. (none regged users get that message) But I want one spesial message for the regged ppl too.

I chanced it to this:
-----------------------------------------------------------------------
--// Set Botname
Bot = "-InFo-"
--// Registred Users Welcome File
REGFile = ("txt/regged.txt")

--// This is fired when hub starts or scripts restarted
function Main()
   frmHub:RegBot(Bot)
end

--// This is fired when a new user logs in...
function NewUserConnected(curUser)
   if curUser.siProfile == 2 or curUser.siProfile == 3 then
      REGGEDTEXTLOAD(curUser)
   end
end

--// Read Registred Users File
function REGGEDTEXTLOAD(curUser)
   handle = openfile(REGFile, "r")
   if (handle ~= nil) then
      local line = read(handle)
      local sMsg = "\r\n"
      while line do
         sMsg = sMsg..line.."\r\n"
         line = read(handle)
      end
      answer = ""..sMsg..""
      curUser:SendData(Bot, answer)
      closefile(handle)
   end
end
-----------------------------------------------------------------------

But this gives no message again :S
(yes, i do got txt/regged.txt)


ketso

i use -- LEECHBLOCKER 02 -- for PtokaX TD4  and that gives messages to -1 users.

NightLitch

I see no problem in my script...
//NL

NightLitch

ok notice on bug or a thing I wrote wrong


curUser.siProflie should be:

curUser.iProfile


this is the functioning code:

-- InFoBot 
--By: NightLitch to ketso
--
-- NOTE: Don't forget to create following files in txt-folder:
-- regged.txt, nonreg.txt, help.txt, rules.txt, info.txt,  news.txt & agree.txt
--

--// Set Botname
Bot = "-InFo-" 
--// Registred Users Welcome File
REGFile = ("txt/regged.txt")
--// Non-Registred Users Welcome File
NONFile = ("txt/nonreg.txt")


--// This is fired when hub starts or scripts restarted
function Main() 
	frmHub:RegBot(Bot) 
end 

--// This is fired when a new user logs in...
function NewUserConnected(curUser) --this got all wrong now (and next line :) 
	if curUser.iProfile == 2 or curUser.iProfile == 3 then 
		REGGEDTEXTLOAD(curUser)
	else
		NONREGTEXTLOAD(curUser) 
	end
end

--// Read Registred Users File
function REGGEDTEXTLOAD(curUser) 
	handle = openfile(REGFile, "r") 
	if (handle ~= nil) then 
		local line = read(handle) 
		local sMsg = "\r\n" 
		while line do 
			sMsg = sMsg..line.."\r\n" 
			line = read(handle) 
		end 
		answer = ""..sMsg.."" 
		curUser:SendData(Bot, answer) 
		closefile(handle) 
	end 
end 
--// Read Non-Registred Users File
function NONREGTEXTLOAD(curUser) 
	handle = openfile(NONFile, "r") 
	if (handle ~= nil) then 
		local line = read(handle) 
		local sMsg = "\r\n" 
		while line do 
			sMsg = sMsg..line.."\r\n" 
			line = read(handle) 
		end 
		answer = ""..sMsg.."" 
		curUser:SendData(Bot, answer) 
		closefile(handle) 
	end 
end 

--// Send Data Arrival
function DataArrival(curUser, data) 
	if( strsub(data, 1, 1) == "<" ) then
	
----------------------------------------------------------------------------------
--// Help Command
		if( strfind( strlower(data), strlower("+help")) ) then 
			handle = openfile("txt/help.txt", "r") 
			if (handle ~= nil) then 
				local line = read(handle) 
				local sMsg = "\r\n" 
				while line do 
					sMsg = sMsg..line.."\r\n" 
					line = read(handle) 
				end 
				answer = ""..sMsg.."" 
				curUser:SendPM(Bot, answer) 
				closefile(handle) 
			end 
			return 1
----------------------------------------------------------------------------------
--// Info Command
		elseif( strfind( strlower(data), strlower("+info")) ) then 
			handle = openfile("txt/info.txt", "r") 
			if (handle ~= nil) then 
				local line = read(handle) 
				local sMsg = "\r\n" 
				while line do 
					sMsg = sMsg..line.."\r\n" 
					line = read(handle) 
				end 
				answer = ""..sMsg.."" 
				curUser:SendPM(Bot, answer) 
				closefile(handle) 
			end 
			return 1
----------------------------------------------------------------------------------
--// Rule Command
		elseif(	strfind( strlower(data), strlower("+rules")) ) then 
			handle = openfile("txt/rules.txt", "r") 
			if (handle ~= nil) then 
				local line = read(handle) 
				local sMsg = "\r\n" 
				while line do 
					sMsg = sMsg..line.."\r\n" 
					line = read(handle) 
				end 
				answer = ""..sMsg.."" 
				curUser:SendPM(Bot, answer) 
				closefile(handle) 
			end 
			return 1
----------------------------------------------------------------------------------
--// News Command
		elseif( strfind( strlower(data), strlower("+news")) ) then 
			handle = openfile("txt/news.txt", "r") 
			if (handle ~= nil) then 
				local line = read(handle) 
				local sMsg = "\r\n" 
				while line do 
					sMsg = sMsg..line.."\r\n" 
					line = read(handle) 
				end 
				answer = ""..sMsg.."" 
				curUser:SendPM(Bot, answer) 
				closefile(handle) 
			end
			return 1
----------------------------------------------------------------------------------
--// Agreeto Command
		elseif(	strfind( strlower(data), strlower("+agreedto")) ) then 
			handle = openfile("txt/agree.txt", "r") 
			if (handle ~= nil) then 
				local line = read(handle) 
				local sMsg = "\r\n" 
				while line do 
					sMsg = sMsg..line.."\r\n" 
					line = read(handle) 
				end 
				answer = ""..sMsg.."" 
				curUser:SendPM(Bot, answer) 
				closefile(handle) 
			end
			return 1
		end
	end
end

/NightLitch
//NL

ketso

Y E S !
There it was.

I removed for unregged users sinse they got it from leecher script.

Now i got:
function NewUserConnected(curUser) 
	if curUser.iProfile == 2 or curUser.iProfile == 3 then 
		REGGEDTEXTLOAD(curUser)
	end
end

If i want one message for 4, 5 and another one for 6, 7 i set two more "function NewUserConnected(curUser) if curUs......." (with respective nr of course) ?

Thanks a lot for the help, i realy appreciate the help your given me.

ketso

I trying to give su, operator and master the one message i have made in txt/privi.txt
It dosn't give error, but it dosn't work either.
--// Set Botname
Bot = "-InFo-" 
--// Registred Users Welcome File
REGFile = ("txt/regged.txt")
--// privileged users (like operator/su)
PRIVIFile = ("txt/privi.txt")

--// This is fired when hub starts or scripts restarted
function Main() 
	frmHub:RegBot(Bot) 
end 

--// This is fired when a new user logs in...
function NewUserConnected(curUser) 
	if curUser.iProfile == 2 or curUser.iProfile == 3 then 
		REGGEDTEXTLOAD(curUser)
	end
end

function NewUserConnected(curUser) 
	if curUser.iProfile == 1 or curUser.iProfile == 4 or curUser.iProfile == 0 then 
		PRIVILEGEDTEXTLOAD(curUser)
	end
end

--// Read Registred Users File
function REGGEDTEXTLOAD(curUser) 
	handle = openfile(REGFile, "r") 
	if (handle ~= nil) then 
		local line = read(handle) 
		local sMsg = "\r\n" 
		while line do 
			sMsg = sMsg..line.."\r\n" 
			line = read(handle) 
		end 
		answer = ""..sMsg.."" 
		curUser:SendData(Bot, answer) 
		closefile(handle) 
	end 
end 

--// Read privileged users File
function PRIVILEGEDTEXTLOAD(curUser) 
	handle = openfile(PRIVIFile, "r") 
	if (handle ~= nil) then 
		local line = read(handle) 
		local sMsg = "\r\n" 
		while line do 
			sMsg = sMsg..line.."\r\n" 
			line = read(handle) 
		end 
		answer = ""..sMsg.."" 
		curUser:SendData(Bot, answer) 
		closefile(handle) 
	end 
end 

--// Send Data Arrival
function DataArrival(curUser, data) 
	if( strsub(data, 1, 1) == "<" ) then
	
----------------------------------------------------------------------------------

Altso tried to use this:
--// This is fired when a new user logs in...
function NewUserConnected(curUser) 
	if curUser.iProfile == 2 or curUser.iProfile == 3 then 
		REGGEDTEXTLOAD(curUser)
	else
	if curUser.iProfile == 1 or curUser.iProfile == 4 or curUser.iProfile == 0 then 
		PRIVILEGEDTEXTLOAD(curUser)
		end
	end
end

I must find out how to trigger several messages, so i can give one message to each profile. (i tried a lot here now, but a lot gives error and nothing of it works)

SMF spam blocked by CleanTalk