Config op report...
 

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

Config op report...

Started by Smulf, 15 February, 2004, 13:49:20

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Smulf

I have some problems with a script that sends a message to all online OPs.
It's for users that wanna report a faker or other relevant stuff...
I got a script, but every time I send a msg, like; "!report ", it will only show the first word in the line to the OP it is send to.
E.g, user writes:"!report I wanna report a faker!" --> the OP is getting the line: "The user [DK][OP]Smul reported: I",
so it's only the "I" and not the rest of the line.
The conclusion is that when a user is typing "SPACE" in the line the words after that won't be there...

The script:

--- Made by nErBoS ------ 

Bot = "Report" 

function Main() 
   frmHub:RegBot(Bot) 
end 

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

function DoReport(user, data)
	s,e,cmd,msg = strfind(data, "%b<>%s+(%S+)%s+(%S+)%s*")
	if (msg ~= nil) then
		SendPmToOps(Bot, "The user "..user.sName.." reported: "..msg)
		user:SendPM(Bot, "Your report has been send to all online OPs.") 
	elseif (msg == nill) then
		user:SendPM(Bot, "You must write a message, '!opreport '")
	end
end


If you understood anything of what I just wrote, it would be nice to here from you...
[Smulf]

DorianG

#1
you try to put this:

s,e,cmd,msg = strfind(data, "%b<>%s(%S+)%s(.+)")

instread this:

s,e,cmd,msg = strfind(data, "%b<>%s+(%S+)%s+(%S+)%s*")



--- Made by nErBoS ------ 

Bot = "Report" 

function Main() 
   frmHub:RegBot(Bot) 
end 

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

function DoReport(user, data)
	s,e,cmd,msg = strfind(data, "%b<>%s(%S+)%s(.+)")
	if (msg ~= nil) then
		SendPmToOps(Bot, "The user "..user.sName.." reported: "..msg)
		user:SendPM(Bot, "Your report has been send to all online OPs.") 
	elseif (msg == nil) then
		user:SendPM(Bot, "You must write a message, '!report '")
	end
end

Smulf

Thanks for such a fast reply and your time. It works... :P
[Smulf]

DorianG

ehehehe... It is not a job for me, it is like a test for see if I have understood like the LUA works. :D

nErBoS

#4
My bad Smulf forgot that, thanks for the correction DorianG.

Best regards, nErBoS
--## nErBoS Spot ##--

Smulf

Well no offence:) when you have alot to do sometimes you miss something...
[Smulf]

SMF spam blocked by CleanTalk