25.07.2003, 06:48 Uhr
hi @all
ich wollte mal fragen ob jemand hier eine suchfunktion einbauen kann, danke schön
mfg sts
Code:
dim version,anzahl,lock,allowchans,disallowchans,ftplist(20,4),ftpinfo(20,2),chansecurity,maximum
Sub Init
version="0.7 beta"
Script "FTP Datenbank ver."&version&" by Killer07"
Hook "Chan_msg"
Hook "Commands"
SpreadFlagMessage 0, "+m", "FTP Datenbank "&version&" geladen."
ConnectErrors = 0
addcommand "FTP-INFO", Cl_User, "+m","2*** Infos zum Script und zu den Channelbefehlen"
addcommand "FTP-VOTE", Cl_User, "+m","2*** Fügt dem FTP <NR> eine Vote Hinzu ab der nächsten version wird der FTP Server mit der Höchsten Vote an Platz 1 gebracht"
AddCommand "FTP-DOWN", CL_User, "+m", "2*** Erhöht den wert der DOWN liste um 1 ist der FTP Server zu oft als down markiert wird er automatisch gelöscht. Achtung vergewissert euch vorher mit FTP-LIST welche nummer der Server hat da die Positionen manchmal wechseln"
AddCommand "FTP-LIST", CL_User, "+m", "2*** Alle FTP's werden aufgelistet"
AddCommand "FTP-ADD", CL_Mas, "+m", "2*** Eingabeformat .ftp-add <FTP> <USER> <PASSWORT> <zusätliche infos(optional)>"
AddCommand "FTP-DEL", CL_Mas, "+m", "2*** Eingabeformat .ftp-del <NUMMER DES ZU LÖSCHENDEN FTP'S> die nummer ist aus dem befehl .ftp-list zu entnehmen"
AddCommand "FTP-CLEAR", CL_Own, "+m", "2*** Alle FTP's werden gelöscht"
Randomize Timer
allowchans = ""
disallowchans = ""
for i=0 to 19 step +1
for j=0 to 3 step +1
ftplist(i,j)="_"
next
for j=0 to 1 step +1
ftpinfo(i,j)=0
next
next
anzahl=0
chansecurity=2
maximum=20
end sub
sub ftpvote(number)
number=number-1
if (anzahl>0) and (number<anzahl) and (number+1>0) then
ftpinfo(number,0)=ftpinfo(number,0)+1
end if
end sub
sub ftpdown(number)
number=number-1
if (anzahl>0) and (number<anzahl) and (number+1>0) then
ftpinfo(number,1)=ftpinfo(number,1)+1
if ftpinfo(number,1)>6 then
spreadflagmessage 0,"+p","3*** FTP NR. "&number+1&" "&ftplist(number,0)&" is down and deletet."
delftp number+1,0
end if
end if
end sub
sub delftp(number,vsock)
number=number-1
if (anzahl>0) and (number<anzahl) and (number+1>0) then
for i=0 to 3 step +1
ftplist(number,i)=""
next
for i=0 to 1 step +1
ftpinfo(number,i)=0
next
if number<anzahl-1 then
for i=number to anzahl-2 step+1
for j=0 to 3 step +1
ftplist(i,j)=ftplist(i+1,j)
next
for j=0 to 1 step +1
ftpinfo(i,j)=ftpinfo(i+1,j)
next
next
end if
anzahl=anzahl-1
if vsock>0 then
TU vsock, "3*** FTP Entfernt"
end if
else
if vsock>0 then
TU vsock, "3*** Fehler beim Entfernen"
end if
end if
end sub
sub addftp(ftp,ftpuser,ftppwd,info,vsock)
if (anzahl<maximum) and (ftp<>"") and (ftpuser<>"" and ftppwd<>"") then
anzahl=anzahl+1
x=anzahl-1
ftplist(x,0)=ftp
ftplist(x,1)=ftpuser
ftplist(x,2)=ftppwd
ftplist(x,3)=info
ftpinfo(x,0)=0
ftpinfo(x,1)=0
TU vsock, "3*** FTP Hinzugefügt"
else
if anzahl=maximum then
TU vsock, "3*** Maximum erreicht"
else
TU vsock, "3*** Fehlender Parameter"
end if
end if
end sub
sub listftp(vsock,nick)
if anzahl>0 then
for i=0 to anzahl -1
if vsock>0 then
TU vsock, "3*** "&i+1&" FTP:"&ftplist(i,0)&" USER:"&ftplist(i,1)&" PW:"&ftplist(i,2)&" INFO's:"&ftplist(i,3)&" VOTES:"&ftpinfo(i,0)&" DOWNVOTES:"&ftpinfo(i,1)
else
SendLine "NOTICE " & nick & " :" &i+1&" FTP:"&ftplist(i,0)&" USER:"&ftplist(i,1)&" PW:"&ftplist(i,2)&" INFO's:"&ftplist(i,3)&" VOTES:"&ftpinfo(i,0)&" DOWNVOTES:"&ftpinfo(i,1),3
end if
next
else
if vsock>0 then
TU vsock, "3*** Keine FTP Server in der Liste"
else
SendLine "NOTICE " & nick & " : Keine FTP Server in der Liste",3
end if
end if
end sub
Sub Chan_msg(Chan, Nick, RegUser, Line)
if (lcase(param(line,1))="!ftp-vote") then
if (lcase(param(line,2))<>"")then
ftpvote param(line,2)
SendLine "NOTICE " & nick & " : Your Vote was added"
else
SendLine "NOTICE " & nick & " : FTP Nummer definieren"
listftp vsock,nick
end if
end if
if lcase(param(line,1))="!ftp-list" then
listftp 0,nick
end if
if (lcase(param(line,1))="!ftp-down") then
if (lcase(param(line,2))<>"")then
if lcase(param(line,3))="sure" then
ftpdown param(line,2)
SendLine "NOTICE " & nick & " : Der Server wurde als Down markiert."
else
SendLine "NOTICE " & nick & " : Sicher? Type !ftp-down <number> sure",3
listftp 0,nick
end if
else
SendLine "NOTICE " & nick & " : FTP Nummer definieren",3
listftp 0,nick
end if
end if
end sub
Sub Commands(vsock, RegUser, Flags, Line)
if lcase(param(line,1))=".ftp-add" then
x=1
i=5
y=""
for x=0 to 10 step +1
x=10
if param(line,i)<>"" then
y=y&" "¶m(line,i)
i=i+1
x=1
end if
next
addftp param(line,2),param(line,3),param(line,4),y,vsock
end if
if lcase(param(line,1))=".ftp-del" and param(line,2)<>""then
delftp param(line,2),vsock
end if
if lcase(param(line,1))=".ftp-clear" then
if lcase(param(line,2))="sure" then
anzahl=0
TU vsock, "3*** FTP Liste gelöscht"
else
TU vsock, "3*** Sicher? Type .ftp-clear sure"
end if
end if
if lcase(param(line,1))=".ftp-list" then
listftp vsock,reguser
end if
if (lcase(param(line,1))=".ftp-down") then
if (lcase(param(line,2))<>"")then
if lcase(param(line,3))="sure" then
ftpdown param(line,2)
TU vsock, "3*** Server als Down markiert"
else
TU vsock, "3*** Sicher? Type .ftp-down <number> sure"
listftp vsock,nick
end if
else
TU vsock, "3*** FTP Nummer definieren"
listftp vsock,nick
end if
end if
if (lcase(param(line,1))=".ftp-vote") then
if (lcase(param(line,2))<>"")then
ftpvote param(line,2)
TU vsock, "3*** Your Vote was added"
else
TU vsock, "3*** FTP Nummer definieren"
listftp vsock,nick
end if
end if
if lcase(param(line,1))=".ftp-info" then
TU vsock, "3*** FTP Database ver. "&version
TU vsock, "3*** Channcommands: !ftp-list, !ftp-down, !ftp-vote"
end if
end sub
Sub SaveList()
ret = FileOpen("filearea\ftplist.txt",FA_Write)
For i = 0 to 20
FileWritln ftplist(i,1) & "ÿ" & ftplist(i,2) & "ÿ" & ftplist(i,3) & "ÿ" & ftplist(i,4) & "ÿ" & ftpinfo(i,1) & "ÿ" & ftpinfo(i,2)
Next
End Sub
Sub ReadList()
ret = FileOpen("filearea\ftplist.txt",FA_Read)
For i = 0 to 20
E$ = FileReadln(ret)
ftplist(i,1) = ParamX(E$,1,"ÿ")
ftplist(i,2) = ParamX(E$,2,"ÿ")
ftplist(i,3) = ParamX(E$,3,"ÿ")
ftplist(i,4) = ParamX(E$,4,"ÿ")
ftpinfo(i,1) = ParamX(E$,5,"ÿ")
ftpinfo(i,2) = ParamX(E$,6,"ÿ")
Next
end subich wollte mal fragen ob jemand hier eine suchfunktion einbauen kann, danke schön
mfg sts