Registered Users ONLY Message In Main Chat
 

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

Registered Users ONLY Message In Main Chat

Started by Spoonlord312, 10 March, 2005, 21:34:28

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Spoonlord312

Hi guys i am fairly new to scripting in lua and i am also trying to write my own script - the two of which don't go well together! Anyway, i am trying to write a script that will allow registered users to send a msg to the main chat that only regged users will receive. here is what i have:

-----------------------

Comm = "!regm1"
Bot = "RegMSG"

function Main()
end

function DataArrival(user, data)
   xyz = 0
   s,e,cmd,msg = strfind(data,"%b<>%s+(%S+)%s+(.+)")
   if (cmd == "!regm2") then
      cmd = "!regm1"
      xyz = 1
   end
   if (cmd == Comm) then
      for i = 0, zgetn(profiles) - 1 do
         local tmp = strupper(profiles)
         local users = GetUsersByProfile(tmp)
         local n = zgetn(users);
         total = total + n
         for j = 0, n - 1 do
            nick = users[j]
            if nick.iProfile ~= -1 then
               if xyz == 0 then
                  nick:SendData(nick, "<<<"..Bot.." From: "..user.sName..">>> "..msg)
               else
                  nick:SendData(nick, "<<<"..Bot.." From: Anonymous>>> "..msg)
               end
            end
         end
      end
      return 1
   end
   
end

function zgetn(tTable)
   return (tTable and (getn(tTable) + (tTable[0] and 1 or 0))) or 0;
end

----------------------

I started using Mutor's whisper script and tried to convert it to this... the hub says there are no errors in the script but messages don't ever show up. Could someone please see if you can figure it out or show me a script that works?
I would certainly appreciate any help you can give me...

Pothead

Change DataArrival  to ChatArrival , change strfind  to string.find  , and strupper  to string.upper  . :)

Spoonlord312

i did that - now the messages are showing up but its not doing what i want it too.

when they enter:     !regm1 hello
that shows up to everyone instead of "hello" showing up to only regged users.

Any suggestions here?

SMF spam blocked by CleanTalk