Author Topic: Auto-Voice + On/Off switch  (Read 2768 times)

HackBenjamin

  • Newbie
  • *
  • Posts: 35
Auto-Voice + On/Off switch
« on: June 13, 2008, 12:07:43 PM »
Code: [Select]
Sub ONJOIN(Nickname,Host,Channel,ServerNumber)
mynick = getidentifier("$me")
op = getidentifier("$nick(" & channel & "," & mynick & ").op",servernumber)
if op = "$true" then
 autovoice = getinifile("Script.ini","Auto Voice",channel,"disabled")
  if autovoice = "enabled" then
   sendcommand "/mode " & channel & " +v " & nickname,servernumber
  end if
end if
End Sub

Sub Settings()
ScriptSettings = CreateDialog("Script Settings",100,100,110,20)
AddButton ScriptSettings,"Auto-Voice",2,3,100,20,1,O,"AutoVoice"
ShowDialog ScriptSettings
End Sub

Sub AutoVoice_Clicked()
windowtype = getidentifier("$currentwindowtype")
channel = getidentifier("$currentwindow")
servernumber = getidentifier("$currentservernumber")
autovoice = getinifile("Script.ini","Auto Voice",channel,"disabled")
 if windowtype = "2" then
  if autovoice = "disabled" then
   writeinifile "Script.ini","Auto Voice",channel,"enabled"
    sendcommand "/echo Auto-Voice is now enabled for " & channel,servernumber
  else
   writeinifile "Script.ini","Auto Voice",channel,"disabled"
    sendcommand "/echo Auto-Voice is now disabled for " & channel,servernumber
  end if
 else
  sendcommand "/echo Error: " & channel & " is not a channel.",servernumber
 end if
End Sub

You probably want to make an alias.

Code: [Select]
/settings /! settings



Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: Auto-Voice + On/Off switch
« Reply #1 on: June 14, 2008, 12:25:32 AM »
to check if you're an op you could just use the ISOP function

Code: [Select]
If ISOP(GetIdentifier("$me"),Channel,ServerNumber)
"I don't know what World War 3 will be fought with, but I know World War 4 with be fought with sticks and stones." - Albert Einstein

HackBenjamin

  • Newbie
  • *
  • Posts: 35
Re: Auto-Voice + On/Off switch
« Reply #2 on: June 15, 2008, 01:44:00 PM »
Heh, thanks.