PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: Jorgesc on 20 October, 2004, 19:12:50

Title: Block User PM to Reg User
Post by: Jorgesc on 20 October, 2004, 19:12:50
Hola a todos, necesito un script que bloquee los PM de usuarios a Usuarios registrados.
Pero que permita el envio de PM a OP's y VIP's.
-----------------------------------------------------------------------
Hello, I need script that blocks the p.m. of users to registered Users.
But that allows to send of p.m. to OP's and VIP's.

Gracias / Thanks

Title:
Post by: bastya_elvtars on 21 October, 2004, 12:51:45
are you using the standard profiles?
Title: Thanks
Post by: Jorgesc on 22 October, 2004, 00:44:35
Thanks mens.

Now:

How I can allow PM to unregistered user From OP and VIP.   ?(

Thanks again.   :D
Title: I Know
Post by: Jorgesc on 22 October, 2004, 02:04:05
QuoteOriginally posted by Mutor
any profile that = 1 may send pm's

CanPM = {[0]=1,[1]=1,[2]=1,[3]=0,[4]=1,[5]=1,[6]=1}

set that part per your need.

I know that. But my cuestion is:  How I can allow to Unreg Users send PM to OP and VIP.

 ?(

Thanks
Title: Don't Work
Post by: Jorgesc on 22 October, 2004, 03:49:48
Hi Hi Hi.

Me too use RC-8.0, but I install this script and does not allow me to send p.m. to the Masters.

This is the config of the script:

CanPM = {[0]=1,[1]=1,[2]=0,[3]=0,[4]=1,[5]=1,[6]=0}

This is the message send of User to Master:

Hi
<(Master)--xxxxx> BOT ***Private Message blocked. You are not alowed to PM (Master)--xxxxx

Pls, help me.   8)
Title:
Post by: UwV on 26 October, 2004, 12:31:55
--PM Filter 1.0
--by Mutor
--
--Requested by Jorgesc
--
-- Allow PM by unregistered users to select profiles only
--
--User Settings-------------------------------------------------------------------------------------
Bot = frmHub:GetHubBotName()
-- Which profiles may an unregistered user send a PM to? '1=yes/0=no'
-- Adjust to your profiles

CanPM = {
[0]=1, --0|Master
[1]=1, --1|Operator
[2]=0, --2|VIP
[3]=0, --3|Reg
[4]=0, --4|Newbie <-- Moderator in RC9
[5]=1, --5|Moderator <-- NetFounder in RC9
[6]=0, --6|Admin <-- only in CB
[7]=0 --7|NetWorkFounder <-- only in CB
}

--End User Settings----------------------------------------------------------------------------------

function DataArrival(user, data)
if (strsub(data,1,4) == "$To:") and (user.iProfile == -1) then
local s,e,who = strfind(data,"$To:%s+(%S+)%s+From:")
local nick = GetItemByName(who)
if not nick = nil and CanPM[nick.iProfile] ~= 1 then
user:SendPM(who,"\r\n\r\n\t\t* ** <-=Holly-Inquisitor=-> ** *\r\n\r\n\tYour Private Message to : <"..who..">  has been blocked.\r\n\tBecause: you are not a regged user. ")
return 1
end
end
end

this is what i have now ..
and this is what i get ..

Syntax error: attempt to index local `nick' (a nil value)
stack traceback:
   1:  function `DataArrival' at line 30 [file `...(NEW)~\scripts\X.01.nopmfornonreggedbymutor.lua']

any clue.. even though i run a beta-test-ptokax or just a "cold shoulder" .. ;0)
Title:
Post by: UwV on 27 October, 2004, 00:57:27
not sure about that..
but indeed the script works fine ,,..

user could be kicked be a antiflood before ...    
or user that gets pm might not be regged or in list..

no matter WORKS great .. :0)

*EDIT

if not nick = nil and  CanPM[nick.iProfile] ~= 1 then

solves the error messages
(incase anybody had the same problem)

*EDIT again
well i just see that error messege again .. so i am trying some other way to fix it . but now only one ..after many hours .. instead of many in one hour ...
Title:
Post by: UwV on 28 October, 2004, 15:46:52
local s,e,who = strfind(data,"$To:%s+(%S+)%s+From:")
    if GetItemByName(who) ~="" then
        local nick = GetItemByName(who)


seems to solve the error messages also ..
(no errors in last 12 hours yet)
but you are right ..
 i will do the
"else
user:SendPM(who," Has logged off the hub")"
thingy too ..

is nicer indeed..

..although ..
if a user is no longer logged into the hub,
doesn't the sender get a "user is no longer online" message anyway ? (from their client or the hub)..