Turn OFF and ON service
 

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

Turn OFF and ON service

Started by NemeziS, 01 November, 2004, 12:54:43

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

NemeziS

Hi, guys!

Who can help me with this?  Here is my connection script:

function NewUserConnected(user)
SendToAll("Someone witn nick "..user.sName.." has just entered the hub!") 
end

function OpConnected(user)
SendToAll("Operator "..user.sName.." has just entered the hub!")
end
And here is disconnection script:

oprofiles = {
  ["unreg"] = "Unreg user [user] has left the hub",
  ["Master"] = "Master with nick [user] has left the hub",
  ["Operator"] = "Operator with nick [user] has left the hub",
  ["VIP"] = "VIP with nick [user] has left the hub",
  ["Reg"] = "Reg with nick [user] has left the hub",}

layout = ""

function UserDisconnected(curUser)
  getmessages(curUser, "out")
end

function OpDisconnected(curUser)
  getmessages(curUser, "out")
end

function announce(user, string)
  local arrTmp = substitute(user, string)
  SendToAll(layout..arrTmp)
end

function substitute(user, string)
  local arrTmp = gsub(string, "%[usercount%]", frmHub:GetUsersCount())
  arrTmp = gsub(arrTmp, "%[crlf%]",            "\r\n")

if type(user) == "table" then
    local myinfo = user.sMyInfoString
    local _, _, desc, speed, email, sharesize = strfind(myinfo, "$ALL %S+ (.*)%$ %$(.+)%$(.*)%$(%d+)%$");
    arrTmp = gsub(arrTmp, "%[user%]",        user.sName)
end
  return arrTmp
end

function getmessages(user, io)
  local userprofile = GetProfileName(user.iProfile)
  if user.iProfile == -1 then
    userprofile = "unreg"
  end
  if userprofile == nil then userprofile = "LOL" end

    if oprofiles["$"..user.sName] then
        announce(user, oprofiles["$"..user.sName])

    elseif oprofiles[userprofile] then
      announce(user, oprofiles[userprofile])
    end
 end


So I wanted every user could Turn ON and OFF this functions on my hub for himself.

If somebody writes !turn off  he will never see both connection and disconnection messages again (but other users will see them)

If somebody writes !turn on  he will see this messages again (and the other users will see them too).

So I wanted a script that will write names of the users  (on !turn off) who don't want to see both connection and disconnection messages to a file  (for example users.dat).
And If the name of the user is written in this file, he will never see this messages again.
But If there are no user name in a file (on !turn on) he will see this messages every time somebody connects/disconnects.




--LUA forever! =)

BoJlk

#1
There is Such a Script!
And you Can make it thru DC++ settings

And i don't think you want that :)

[*edit]
Funny...

NemeziS

#2
So, who can help me with that? I need it very much. Plizzzzzzzzzzzzzzz help me :(
--LUA forever! =)

plop

it's posible but not a good idea.
it would increase the used resources a lot.
instead of 1 send command you need 1 for every user who has it enabled.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

NemeziS

#4
But I don't really know how to make that script. Can you help me with it?

[*edit]  

Plizzzz :)
--LUA forever! =)

plop

QuoteOriginally posted by NemeziS
But I don't really know how to make that script. Can you help me with it?

[*edit]  

Plizzzz :)
i don't mind helping but it's gone be the long way home.
you're gone make it from scratch.
and pls folow my leads so this topic ends up in a good lesson for other ppl.

1st task is very simple (you need some basic skills before starting pattern matching which is needed for the on/off switch).
drop the 2nd script you posted for now, whe'll get back 2 that later.
use the 1st script as a lead and add the same kind of msg for when a user/op leaves.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

SMF spam blocked by CleanTalk