Author Topic: Peak Script  (Read 5215 times)

TheCellist42

  • Full Member
  • ***
  • Posts: 143
    • TheCellist42.com
Peak Script
« on: June 01, 2008, 01:11:13 PM »
Is There A Way To Make A Peak Script In Which When Someone Types !peak, It Logs The Maximum Users And Displays The Current Channel Peak? Like:

<TheCellist42>!peak
<Ares>The Channel Peak For #SamF Is: 40 Users

Or Something, I Think I Have An Idea On how To Do It, I Just Dont Know How To, I Guess, Compile It All Together Into A VB Script, :-)

~ Sam
~ Visit my website at http://www.TheCellist42.com

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: Peak Script
« Reply #1 on: June 01, 2008, 08:10:35 PM »
You would have to add a counter in an ONJOIN script, so you can check how many users are in the channel, check if its the highest value, and save it. $nick(#channel,0) gives you the total number of nicks in a channel.
I am sure you can figure the rest out.
The IceChat God

HackBenjamin

  • Newbie
  • *
  • Posts: 35
Re: Peak Script
« Reply #2 on: June 06, 2008, 01:49:47 PM »
I actually recently made a script that does this, It records the peak, and informs everyone if the peak is broken, as well as counts the number of joins for each channel.

Code: [Select]
Sub ONJOIN(Nickname,Host,Channel,ServerNumber)
total = getinifile("Joincounter.ini","Channels",channel,0)
 writeinifile "Joincounter.ini","Channels",channel,total+1
  sendcommand "/msg " & channel & " (" & total+1 & ")",servernumber
   peak = getinifile("Channel.ini","Channel peaks",channel,0)
   totalnicks = getidentifier("$nick(" & channel & ",0)",servernumber)
     if peak < totalnicks then
       writeinifile "Channel.ini","Channel peaks",channel,totalnicks
        sendcommand "/msg " & channel & " " & nickname & " has just broke the peak users for " & channel & "!(" & totalnicks & ")",servernumber
      end if
End Sub

And to make it work with !peak, just add the following to the script:

Code: [Select]
sub ontext(message,channel,nickname,host,servernumber)
 if lcase(message) = "!peak" then
  peak = getinifile("Joincounter.ini","Channel peaks",channel,0)
   sendcommand "/msg " & channel & " The peak for " & channel & " is: " & peak,servernumber
 end if
end sub

HackBenjamin

  • Newbie
  • *
  • Posts: 35
Re: Peak Script
« Reply #3 on: June 07, 2008, 12:30:35 PM »
Ok, the actual script should look like this:

Code: [Select]
Sub ONJOIN(Nickname,Host,Channel,ServerNumber)
total = getinifile("Joincounter.ini","Channels",channel,0)
 writeinifile "Joincounter.ini","Channels",channel,total+1
    sendcommand "/msg " & channel & " (" & total+1 & ")",servernumber
     peak = getinifile("Channel.ini","Channel peaks",channel,0)
     totalnicks = getidentifier("$nick(" & channel & ",0)",servernumber)
      if peak < totalnicks then
       writeinifile "Channel.ini","Channel peaks",channel,totalnicks
        sendcommand "/msg " & channel & " " & nickname & " has just broke the peak users for " & channel & "!(" & totalnicks & ")",servernumber
      end if
End Sub

sub ontext(message,channel,nickname,host,servernumber)
 if lcase(message) = "!peak" then
  peak = getinifile("Channel.ini","Channel peaks",channel,0)
   sendcommand "/msg " & channel & " The peak for " & channel & " is " & peak,servernumber
 end if
end sub


HackBenjamin

  • Newbie
  • *
  • Posts: 35
Re: Peak Script
« Reply #4 on: June 15, 2008, 01:45:54 PM »
I noticed a bug that happens quite often with this script, and I have yet to fix it, so unless you want incorrect peaks, I'd suggest not actually using this script until I fix the bugs.

Socom

  • Guest
Re: Peak Script
« Reply #5 on: May 04, 2009, 10:46:46 AM »
Were you ever able to fix this script? I would like to try it.

TheCellist42

  • Full Member
  • ***
  • Posts: 143
    • TheCellist42.com
Re: Peak Script
« Reply #6 on: May 22, 2009, 09:59:47 PM »
It's been quite a while since I've been around. Glad to be back, and I'll work on a script for you.
~ Sam
~ Visit my website at http://www.TheCellist42.com

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: Peak Script
« Reply #7 on: May 23, 2009, 08:32:22 AM »
So what was the bug, Hack?  The script looks sound.
Main problem would be for same channel on different networks.
The IceChat God