Reg user of higher chat bot help
 

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

Reg user of higher chat bot help

Started by RiPOFF, 20 October, 2003, 01:24:12

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

RiPOFF

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]  

klownietklowniet

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
[ > DC - UniteD < ]

RiPOFF

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

klownietklowniet

I modified or added to the script that was posted here, did notice the little change... looking good... ;-)
[ > DC - UniteD < ]

RiPOFF

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

klownietklowniet

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
[ > DC - UniteD < ]

RiPOFF

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

RiPOFF


klownietklowniet

main chat? It works only for pm... what did I get wrong?
[ > DC - UniteD < ]

RiPOFF

i pmed you in chevy hide out

klownietklowniet

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
[ > DC - UniteD < ]

RiPOFF

anyone else gonna help?

klownietklowniet

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...
[ > DC - UniteD < ]

RiPOFF

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

klownietklowniet

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...
[ > DC - UniteD < ]

RiPOFF

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

RiPOFF

SOme plz help phatty or opium or someone plz help

klownietklowniet

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
[ > DC - UniteD < ]

RiPOFF

good job it worked  :D
but dont touch iprofile as a reg is profile #4

klownietklowniet

[ > DC - UniteD < ]

RiPOFF

well see this one users 5 profiles Master,Sop,Op,VIP,Reg

klownietklowniet

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?
[ > DC - UniteD < ]

SMF spam blocked by CleanTalk