I need help for this LUA script
 

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

I need help for this LUA script

Started by Bollebus, 04 August, 2004, 19:27:23

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Bollebus

HI

the script is perfeck but i vill not send it in main as this script do
i wont the script send a pm to everyone type !pm or
!mass  someone here who can lock at this and fix it ?

but i worthless to edit lua script so i need help there

im running Ptokac soft whit robocop 8

thankz

//Bolle

-----------------------------------------------------------------------

endEvery = 2   ----  time in hrs
textfile = "massmessage.txt"
bot = "Mass_Message"
hrs = 1000 * 60 * 60 * SendEvery


function Main()
   SetTimer(hrs)
   StartTimer()
end



function OnTimer()
   massMessageToAll()
end




function massMessageToAll()
local handle = openfile(textfile, "r")
   if (handle ~= nil) then
      local line = read(handle)
                  Temptimerfile = "\r\n"
      while line do
         Temptimerfile = Temptimerfile.."\r\n"..line
         line = read(handle)
      end
         SendPmToAll(bot, Temptimerfile)
      closefile(handle)
   end
end

D-J Valhala

you have +mass in Robocop mate... :D
My PsyIsrael Network
==================
--=[PsyIsrael DC Hub]=--
--=[PsyIsrael Website]=--
==================

Herodes

Bolle a clue would be to try changing
SendPmToAll(bot, Temptimerfile)
to smth like
 
SendToAll(bot, Temptimerfile)

Try reading through the Scripting.txt in the docs folder of PtokaX. ...

Snooze

#3
SendEvery = 2 ---- time in hrs
textfile = "massmessage.txt"
bot = "Mass_Message"
hrs = 1000 * 60 * 60 * SendEvery
Prefix = "+"
Trigger1 = "pm"

function Main()
	SetTimer(hrs)
	StartTimer()
	frmHub:RegBot(bot)
end

function OnTimer()
	massMessageToAll()

end

function DataArrival(user,data)
	if strsub(data, 1, 1) == "<" or (strsub(data,1,5+strlen(Bot))=="$To: "..Bot) then
		local data=strsub(data,1,strlen(data)-1)
		s,e,cmd = strfind(data,"%b<>%s+(%S+)")
          	 if cmd == Prefix..Trigger1 then 
	   		massMessageToAll()
			return 1
		end
	end
end


function massMessageToAll()
	local handle = openfile(textfile, "r")
		if (handle ~= nil) then
			local line = read(handle)
			Temptimerfile = "\r\n"
			while line do
			Temptimerfile = Temptimerfile.."\r\n"..line
			line = read(handle)
		end
		SendPmToAll(bot, Temptimerfile)
	closefile(handle)
	end
end

I hope this was what you had in mind..

Command is :

+pm

Will send the content of the massmessage.txt to all users in the hub + send it on the timer..

Best regards,

Snooze

Bollebus

Ptokax say =
Syntax Error bad argument #1 to'strlen' sting expected got nil

can u fix it i worthless to edit lua script

/Bolle

QuoteOriginally posted by Snooze
SendEvery = 2 ---- time in hrs
textfile = "massmessage.txt"
bot = "Mass_Message"
hrs = 1000 * 60 * 60 * SendEvery
Prefix = "+"
Trigger1 = "pm"

function Main()
	SetTimer(hrs)
	StartTimer()
	frmHub:RegBot(bot)
end

function OnTimer()
	massMessageToAll()

end

function DataArrival(user,data)
	if strsub(data, 1, 1) == "<" or (strsub(data,1,5+strlen(Bot))=="$To: "..Bot) then
		local data=strsub(data,1,strlen(data)-1)
		s,e,cmd = strfind(data,"%b<>%s+(%S+)")
          	 if cmd == Prefix..Trigger1 then 
	   		massMessageToAll()
			return 1
		end
	end
end


function massMessageToAll()
	local handle = openfile(textfile, "r")
		if (handle ~= nil) then
			local line = read(handle)
			Temptimerfile = "\r\n"
			while line do
			Temptimerfile = Temptimerfile.."\r\n"..line
			line = read(handle)
		end
		SendPmToAll(bot, Temptimerfile)
	closefile(handle)
	end
end

I hope this was what you had in mind..

Command is :

+pm

Will send the content of the massmessage.txt to all users in the hub + send it on the timer..

Best regards,

Snooze

Snooze

SendEvery = 2 ---- time in hrs
textfile = "massmessage.txt"
bot = "Mass_Message"
hrs = 1000 * 60 * 60 * SendEvery
Prefix = "+"
Trigger1 = "pm"

function Main()
	SetTimer(hrs)
	StartTimer()
	frmHub:RegBot(bot)
end

function OnTimer()
	massMessageToAll()
end

function DataArrival(user,data)
	if strsub(data, 1, 1) == "<" or (strsub(data,1,5+strlen(bot))=="$To: "..bot) then
		local data=strsub(data,1,strlen(data)-1)
		s,e,cmd = strfind(data,"%b<>%s+(%S+)")
          	 if cmd == Prefix..Trigger1 then 
	   		massMessageToAll()
			return 1
		end
	end
end


function massMessageToAll()
	local handle = openfile(textfile, "r")
		if (handle ~= nil) then
			local line = read(handle)
			Temptimerfile = "\r\n"
			while line do
			Temptimerfile = Temptimerfile.."\r\n"..line
			line = read(handle)
		end
		SendPmToAll(bot, Temptimerfile)
	closefile(handle)
	end
end

Sorry about that .. :)

Bollebus

No problem youre script its perfeckt   im so happy now :)

i realy realy will THANK U

//bolle

QuoteOriginally posted by Snooze
SendEvery = 2 ---- time in hrs
textfile = "massmessage.txt"
bot = "Mass_Message"
hrs = 1000 * 60 * 60 * SendEvery
Prefix = "+"
Trigger1 = "pm"

function Main()
	SetTimer(hrs)
	StartTimer()
	frmHub:RegBot(bot)
end

function OnTimer()
	massMessageToAll()
end

function DataArrival(user,data)
	if strsub(data, 1, 1) == "<" or (strsub(data,1,5+strlen(bot))=="$To: "..bot) then
		local data=strsub(data,1,strlen(data)-1)
		s,e,cmd = strfind(data,"%b<>%s+(%S+)")
          	 if cmd == Prefix..Trigger1 then 
	   		massMessageToAll()
			return 1
		end
	end
end


function massMessageToAll()
	local handle = openfile(textfile, "r")
		if (handle ~= nil) then
			local line = read(handle)
			Temptimerfile = "\r\n"
			while line do
			Temptimerfile = Temptimerfile.."\r\n"..line
			line = read(handle)
		end
		SendPmToAll(bot, Temptimerfile)
	closefile(handle)
	end
end

Sorry about that .. :)


Bollebus

Yes

and u are good on lua script
i hope i can ask u more if i have problem whit lua y are so goood at that

anyway
a BIG Thankz

//bolle

QuoteOriginally posted by Snooze
Im glad that it worked out as you wished..


Snooze

Snooze

I'm still a newbie, but feel free to ask and I'll do my best

SMF spam blocked by CleanTalk