Help please with script Filter PM
 

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

Help please with script Filter PM

Started by Braum, 26 May, 2006, 07:04:53

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Braum

Hi, I call for your help. The script have a failure. It works very well, avoid the private messages to not registered users, but it does not send them the answer message. Please I need your help in order to solve it. Thank you so very much.

--PM Filter 1.0 LUA 5
--
--by Mutor 7/6/05
--
--
-- Filter PM's by profiles
--
--User Settings-------------------------------------------------------------------------------------
Bot = frmHub:GetHubBotName()
-- Adjust to your profiles
--profile_idx, PM send is filtered [0=PM Filter is bypassed / 1=PM's are filtered]
CanSendPm = {
[-1] = 1, --Unregistered User
[0] = 0, --Master
[1] = 0, --Operator
[2] = 0, --Vip
[3] = 1, --Registered User
[4] = 0, --Moderator
[5] = 0, --NetFounder
}
-- Adjust to your profiles
--profile_idx, PM Permission level
--Sender may only PM profiles equal to or greater than their own profile setting.
CanGetPm = {
[-1] = 0, --Unregistered User
[0] = 6, --Master
[1] = 3, --Operator
[2] = 2, --Vip
[3] = 1, --Registered User
[4] = 4, --Moderator
[5] = 5, --NetFounder
}
--End User Settings----------------------------------------------------------------------------------
function ToArrival(user, data)
	if CanSendPm[user.iProfile] == 1 then
		local s,e,who = string.find(data,"$To:%s+(%S+)%s+From:")
		local userprof = GetProfileName(user.iProfile)
		local nick = GetItemByName(who)
			if not nick then 
				local OfflineMsg = "The user "..who.." is not online. Check your spelling."
				SendPmToNick(user.sName,Bot,OfflineMsg)
				return 1
			end
			if CanGetPm[user.iProfile] >= CanGetPm[nick.iProfile] then
				return 1
			else
				local nickprof = GetProfileName(nick.iProfile)
				local FilterMsg = "\r\n\r\n\t***Your Private Message To "..nick.sName.." Was Blocked.***\r\n"..
				"\t"..userprof.."'s are currently not allowed to PM "..nickprof.."'s.\r\n\r\n"
				SendPmToNick(user.sName,nick.sName,Bot.." 8( ...Sorry "..user.sName..FilterMsg)
				return 1
			end
	end
end


Please, Send Pm message ***Your Private Message To "..nick.sName.." Was Blocked.***  to Unregistered User

Thank

bastya_elvtars

user:SendPM(nick.sName, Bot.." 8( ...Sorry "..user.sName..FilterMsg)
Everything could have been anything else and it would have just as much meaning.

Braum

Quote from: bastya_elvtars on 27 May, 2006, 13:52:47
user:SendPM(nick.sName, Bot.." 8( ...Sorry "..user.sName..FilterMsg)

help, but it does not send them the answer message

bastya_elvtars

Then the hub bot name isn't filled, I cannot think of anything else right now.
Everything could have been anything else and it would have just as much meaning.

Braum

Quote from: bastya_elvtars on 27 May, 2006, 15:48:52
Then the hub bot name isn't filled, I cannot think of anything else right now.

I need that blocked message reach non registered users that try to send a private message, because it does not works

jiten

Replace your ToArrival function with this one and post your progress:

ToArrival = function(user,data)
	if CanSendPm[user.iProfile] == 1 then
		local s,e,who = string.find(data,"$To:%s+(%S+)%s+From:")
		local nick = GetItemByName(who)
		if nick then 
			if CanGetPm[user.iProfile] < CanGetPm[nick.iProfile] then
				local FilterMsg = "\r\n\r\n\t***Your Private Message To "..nick.sName.." Was Blocked.***\r\n\t"..
				(GetProfileName(user.iProfile) or "Unreg").."'s are currently not allowed to PM "..
				(GetProfileName(nick.iProfile) or "Unreg").."'s.\r\n\r\n"
				return SendPmToNick(user.sName, nick.sName, Bot.." 8( ...Sorry "..user.sName..FilterMsg), 1
			end
		else
			local OfflineMsg = "The user "..who.." is not online. Check your spelling."
			return SendPmToNick(user.sName, Bot, OfflineMsg), 1
		end
	end
end

Braum

The messages does not reach the non registered users, but yes for registered

jiten

Quote from: Braum on 29 May, 2006, 16:26:14
The messages does not reach the non registered users, but yes for registered

What do you mean with that?

Do you want to allow messages only sent to profiles higher than the sender's?

If that's so, just replace:

if CanGetPm[user.iProfile] < CanGetPm[nick.iProfile] then


with:

if CanGetPm[user.iProfile] >= CanGetPm[nick.iProfile] then

SMF spam blocked by CleanTalk