PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: RiPOFF on 20 October, 2003, 01:24:12

Title: Reg user of higher chat bot help
Post by: RiPOFF on 20 October, 2003, 01:24:12
All i need in this chat is a message that will tell a NoN-Reg when he trys to pm it the message below and not actaually send the message

This chat is for registered users only. Your message has not been sent.

Quote-- Date: 01-09-2003
--
-- code from klownietklowniet
-- network: [ > DC - UniteD < ]
--
-- Request by peter
--
-- A simple SU (Master) chat
-- 02-09-2003: changed the script abit so all (ReGS, VIPs, OPs and SUs) can chat. (Request by BlazeXXX)


BotName = ".:ReG~OnLy ChAt:."


function Main()
   frmHub:RegBot(BotName)
end


function DataArrival(curUser,data)

   local MessageRecognized = 0

   if isPM(data)==1 then
      whoto,from,message=ParsePM(data)
      MessageRecognized=1
   end

   if MessageRecognized==1 and whoto==BotName and (curUser.iProfile>=0 and curUser.iProfile<=4) then
      local sus=GetUsersByProfile("Master")
      local ops=GetUsersByProfile("Operator")
      local vips=GetUsersByProfile("VIP")
   local regs=GetUsersByProfile("REG")

   for i, n in sus do
      if n == curUser.sName then
      else
            SendPmToNick(n, BotName, from.." -> "..message)
      end
      end
   for i, n in ops do
      if n == curUser.sName then
      else
            SendPmToNick(n, BotName, from.." -> "..message)
      end
      end
   for i, n in vips do
      if n == curUser.sName then
      else
            SendPmToNick(n, BotName, from.." -> "..message)
      end
      end
   for i, n in regs do
      if n == curUser.sName then
      else
            SendPmToNick(n, BotName, from.." -> "..message)
      end
      end

   end

end


function ParsePM(data)
   s,e,whoTo,from,message = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(.*)")
   message = strsub(message,1,strlen(message)-1)
   return whoTo,from,message
end


function isPM(data)
   if( strsub(data, 1, 3) == "$To" ) then
      return 1
   else
      return 0
   end
end
[/SIZE]  
Title:
Post by: klownietklowniet on 20 October, 2003, 01:54:19
Haven't tested it but try this:

-- Date: 01-09-2003
--
-- code from klownietklowniet
-- network: [ > DC - UniteD < ]
--
-- Request by peter
--
-- A simple SU (Master) chat
-- 02-09-2003: changed the script abit so all (ReGS, VIPs, OPs and SUs) can chat. (Request by BlazeXXX)


BotName = ".:ReG~OnLy ChAt:."


function Main()
frmHub:RegBot(BotName)
end


function DataArrival(curUser,data)

local MessageRecognized = 0

if isPM(data)==1 then
whoto,from,message=ParsePM(data)
MessageRecognized=1
end

if MessageRecognized==1 and whoto==BotName and (curUser.iProfile>=0 and curUser.iProfile<=4) then
local sus=GetUsersByProfile("Master")
local ops=GetUsersByProfile("Operator")
local vips=GetUsersByProfile("VIP")
local regs=GetUsersByProfile("REG")

for i, n in sus do
if n == curUser.sName then
else
SendPmToNick(n, BotName, from.." -> "..message)
end
end
for i, n in ops do
if n == curUser.sName then
else
SendPmToNick(n, BotName, from.." -> "..message)
end
end
for i, n in vips do
if n == curUser.sName then
else
SendPmToNick(n, BotName, from.." -> "..message)
end
end
for i, n in regs do
if n == curUser.sName then
else
SendPmToNick(n, BotName, from.." -> "..message)
end

else
   curUser:SendPM(BotName, "This chat is for registered users only. Your message has not been sent.")
end

end

end


function ParsePM(data)
s,e,whoTo,from,message = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(.*)")
message = strsub(message,1,strlen(message)-1)
return whoTo,from,message
end


function isPM(data)
if( strsub(data, 1, 3) == "$To" ) then
return 1
else
return 0
end
end

Title: :)
Post by: RiPOFF on 20 October, 2003, 02:22:47
whoa already back i naction your great by the way while you werent looking i modified it a little i added the REGS profile but thanks ill let you kno if it works
Title:
Post by: klownietklowniet on 20 October, 2003, 02:24:12
I modified or added to the script that was posted here, did notice the little change... looking good... ;-)
Title:
Post by: RiPOFF on 20 October, 2003, 02:37:59
Syntax Error: `end' expected (to close `for' at line 57);
  last token read: `else' at line 63 in string "--
..."


Quote--
-- Creator: klownietklowniet
-- Network: [ > DC - UniteD < ]
--
-- Request by Peter
--
-- Edits by R?P?FF?
--
-- A VIP and Higher chat
-- 02-09-2003: klownietklowniet changed the script abit so all (VIPs, OPs and SUs) can chat. (Request by BlazeXXX)
-- 19-10-2003: R?P?FF? added the reg profile in it so now regs are included in script. (Request by Me)
-- 19-10-2003: klownietklowniet added a message so when non reg users pm it, it will respond and act on the message
-- "This chat is for registered users only. Your message has not been sent." (Request by R?P?FF?)


BotName = ".:ReGs~OnLy ChAt:."


function Main()
frmHub:RegBot(BotName)
end


function DataArrival(curUser,data)

local MessageRecognized = 0

if isPM(data)==1 then
whoto,from,message=ParsePM(data)
MessageRecognized=1
end

if MessageRecognized==1 and whoto==BotName and (curUser.iProfile>=0 and curUser.iProfile<=4) then
local sus=GetUsersByProfile("Master")
local ops=GetUsersByProfile("Operator")
local vips=GetUsersByProfile("VIP")
local regs=GetUsersByProfile("REG")

for i, n in sus do
if n == curUser.sName then
else
SendPmToNick(n, BotName, from.." -> "..message)
end
end
for i, n in ops do
if n == curUser.sName then
else
SendPmToNick(n, BotName, from.." -> "..message)
end
end
for i, n in vips do
if n == curUser.sName then
else
SendPmToNick(n, BotName, from.." -> "..message)
end
end
for i, n in regs do
if n == curUser.sName then
else
SendPmToNick(n, BotName, from.." -> "..message)
end

else
   curUser:SendPM(BotName, "This chat is for registered users only. Your message has not been sent.")
end

end

end


function ParsePM(data)
s,e,whoTo,from,message = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(.*)")
message = strsub(message,1,strlen(message)-1)
return whoTo,from,message
end


function isPM(data)
if( strsub(data, 1, 3) == "$To" ) then
return 1
else
return 0
end
end
Title:
Post by: klownietklowniet on 20 October, 2003, 02:56:47
Hehe.. my bad... easier when it's tabbed properly:


-- Creator: klownietklowniet
-- Network: [ > DC - UniteD < ]
--
-- Request by Peter
--
-- Edits by R?P?FF?
--
-- A VIP and Higher chat
-- 02-09-2003: klownietklowniet changed the script abit so all (VIPs, OPs and SUs) can chat. (Request by BlazeXXX)
-- 19-10-2003: R?P?FF? added the reg profile in it so now regs are included in script. (Request by Me)
-- 19-10-2003: klownietklowniet added a message so when non reg users pm it, it will respond and act on the message
-- "This chat is for registered users only. Your message has not been sent." (Request by R?P?FF?)


BotName = ".:ReGs~OnLy ChAt:."


function Main()
frmHub:RegBot(BotName)
end


function DataArrival(curUser,data)

local MessageRecognized = 0

   if isPM(data)==1 then
      whoto,from,message=ParsePM(data)
      MessageRecognized=1
   end

   if MessageRecognized==1 and whoto==BotName and (curUser.iProfile>=0 and curUser.iProfile<=4) then
      local sus=GetUsersByProfile("Master")
      local ops=GetUsersByProfile("Operator")
      local vips=GetUsersByProfile("VIP")
      local regs=GetUsersByProfile("REG")

      for i, n in sus do
         if n == curUser.sName then
         else
            SendPmToNick(n, BotName, from.." -> "..message)
         end
      end
     
      for i, n in ops do
         if n == curUser.sName then
         else
            SendPmToNick(n, BotName, from.." -> "..message)
         end
      end
     
      for i, n in vips do
         if n == curUser.sName then
         else
            SendPmToNick(n, BotName, from.." -> "..message)
         end
      end
     
      for i, n in regs do
         if n == curUser.sName then
         else
            SendPmToNick(n, BotName, from.." -> "..message)
         end
      end
   else
      curUser:SendPM(BotName, "This chat is for registered users only. Your message has not been sent.")
   end
end


function ParsePM(data)
s,e,whoTo,from,message = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(.*)")
message = strsub(message,1,strlen(message)-1)
return whoTo,from,message
end


function isPM(data)
if( strsub(data, 1, 3) == "$To" ) then
return 1
else
return 0
end
end

Title:
Post by: RiPOFF on 20 October, 2003, 03:06:52
ok no errors this time but the script code is bogus...

heres what happens...
first i pm it no responce then i reg myself(non ops) in mainchat noone else can see but whether im a reg or not it will send the message you are not regged i tired from my other client(regged op) to type in mainchat and sends mesage to me saying not regged and in addition the message still goes throught to mainchat
Title:
Post by: RiPOFF on 20 October, 2003, 03:19:36
anyone help???
Title:
Post by: klownietklowniet on 20 October, 2003, 03:28:42
main chat? It works only for pm... what did I get wrong?
Title:
Post by: RiPOFF on 20 October, 2003, 03:31:22
i pmed you in chevy hide out
Title:
Post by: klownietklowniet on 20 October, 2003, 03:31:54
BTW:

curUser.iProfile>=0 and curUser.iProfile<=4

will allow the next profile at possition 4 to receive and send aswell (be included in the chat). It should be:

curUser.iProfile>=0 and curUser.iProfile<=3
Title:
Post by: RiPOFF on 20 October, 2003, 03:52:12
anyone else gonna help?
Title:
Post by: klownietklowniet on 20 October, 2003, 14:58:38
I'm not sure what is wrong with it... but I'll test it out as soon as I have some time. I think it should work as it used too...

PS: private messages don't work like main chat messages, they WILL appear in the chat window (pm to bot) of the user that send the pm eather way and there is no way to block that. That is because the hub doesn't send a confirmation that the message was send. That doesn't mean that it is send to all others though...
Title:
Post by: RiPOFF on 20 October, 2003, 23:07:40
Ok function of this whole bot is a secondary chat for my users LIKE an op chat but not just for ops

profiles it uses
REGS
VIPS
OPS
SOPS
ADMINS(Master)

Now if the user sneding the message is not regged it will repley

This chat is for registered users only. Your message has not been sent.

its bugged and does send message to anyone or anything and when you type in main it will say that and message and even so still let the message go through
Title:
Post by: klownietklowniet on 20 October, 2003, 23:25:10
I haven't tested it.. but I kinda refuse to believe that the message was sent to all the others. Btw. the script is ONLY for the first 4 Profiles in PtokaX, the default ones. Don't know if you have changed something there that influences the functionality of the script...
Title:
Post by: RiPOFF on 21 October, 2003, 01:23:37
i did i added profile superopi think but that still dont mae a a diff if you want to come 2 my hub i will show you what hapens
Title:
Post by: RiPOFF on 21 October, 2003, 02:36:27
SOme plz help phatty or opium or someone plz help
Title:
Post by: klownietklowniet on 21 October, 2003, 03:01:49
Silly mistake... fixed it:


-- Creator: klownietklowniet
-- Network: [ > DC - UniteD < ]
--
-- Request by Peter
--
-- Edits by R?P?FF?
--
-- A VIP and Higher chat
-- 02-09-2003: klownietklowniet changed the script abit so all (VIPs, OPs and SUs) can chat. (Request by BlazeXXX)
-- 19-10-2003: R?P?FF? added the reg profile in it so now regs are included in script. (Request by Me)
-- 19-10-2003: klownietklowniet added a message so when non reg users pm it, it will respond and act on the message
-- "This chat is for registered users only. Your message has not been sent." (Request by R?P?FF?)


BotName = ".:ReGs~OnLyChAt:."


function Main()
frmHub:RegBot(BotName)
end


function DataArrival(curUser,data)

   local MessageRecognized = 0

   if isPM(data)==1 then
      whoto,from,message=ParsePM(data)
      MessageRecognized=1
   end

   if MessageRecognized==1 and whoto==BotName then
if (curUser.iProfile>=0 and curUser.iProfile<=3) then
      local sus=GetUsersByProfile("Master")
      local ops=GetUsersByProfile("Operator")
      local vips=GetUsersByProfile("VIP")
      local regs=GetUsersByProfile("REG")

      for i, n in sus do
         if n == curUser.sName then
         else
            SendPmToNick(n, BotName, from.." -> "..message)
         end
      end
     
      for i, n in ops do
         if n == curUser.sName then
         else
            SendPmToNick(n, BotName, from.." -> "..message)
         end
      end
     
      for i, n in vips do
         if n == curUser.sName then
         else
            SendPmToNick(n, BotName, from.." -> "..message)
         end
      end
     
      for i, n in regs do
         if n == curUser.sName then
         else
            SendPmToNick(n, BotName, from.." -> "..message)
         end
      end
   else
      curUser:SendPM(BotName, "This chat is for registered users only. Your message has not been sent.")
   end
   end
end


function ParsePM(data)
s,e,whoTo,from,message = strfind(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(.*)")
message = strsub(message,1,strlen(message)-1)
return whoTo,from,message
end


function isPM(data)
if( strsub(data, 1, 3) == "$To" ) then
return 1
else
return 0
end
end

Title:
Post by: RiPOFF on 21 October, 2003, 04:19:28
good job it worked  :D
but dont touch iprofile as a reg is profile #4
Title:
Post by: klownietklowniet on 21 October, 2003, 21:18:17
? REG is 3
Title:
Post by: RiPOFF on 21 October, 2003, 23:06:56
well see this one users 5 profiles Master,Sop,Op,VIP,Reg
Title:
Post by: klownietklowniet on 22 October, 2003, 04:16:01
The message is send ONLY to 4 profile group users. Btw, have you changed in the order of the profiles or just added the new profile last?