AnGelBot-Portal²

Normale Version: TOPIC Script
Du siehst gerade eine vereinfachte Darstellung unserer Inhalte. Normale Ansicht mit richtiger Formatierung.
ich habe mal ein Topicscript geschrieben!

Ihr geht auf die Partyline und gebt .settopic <#channel> <text>
In eurem Topic fügt ihr dann noch %NEWS% ein und wenn ihr nun im channel !news bla schreibt wird euer %NEWS% mit bla ersetzt! Wink


Code:
Const ini_topic = "topic.ini"

Sub Init()
  Script "Topic - Changer V1.0 by t2|ash"
  Hook "Commands"
  Hook "Chan_Msg"
  AddCommand "settopic", CL_SOwn, "+s", "2*** .settopic <#channel> <text>##14Setzt das Topic Design für #channel."
End Sub

Sub Commands(vsock, RegUser, Flags, Line)
  If Param(Line, 1) = ".settopic" Then
    If Param(Line, 2) = vbNullString Then
      SpreadFlagMessage 0, "+m", "5*** Usage: .settopic <#channel> <text>"
    Else
      t_chan = Param(Line, 2)
      t_topic = GetRest(Line, 3)
      WriteINIString "Topic", t_chan, t_topic, ini_topic
      SpreadFlagMessage 0, "+m", "11*** Topic was set for " & Param(Line, 2) & " : " & GetRest(Line, 3)
    End If
  End If
End Sub

Sub Chan_Msg(Chan, Nick, RegUser, Line)
  If Param(Line, 1) = "!news" Then
    If IsOp(Nick, Chan) Then
      If Param(Line, 2) = vbNullString Then
        SendLine "NOTICE " & Nick & " :Use: !news <text>", 2
      Else
        mytopic = GetRest(ReadINIString("Topic", Chan, vbNullString, ini_topic), 1)
          SendLine "TOPIC " & Chan & " :" & Replace(mytopic, "%NEWS%", GetRest(Line, 2)), 2
      End If
    Else
      SendLine "NOTICE " & Nick & " :Du musst Op haben um das Topic ändern zu können!", 2
    End If
  End If
End Sub
Referenz-URLs