Krypt-IRC — File Browser
Krypt-IRCv1.1 / Krypt-IRCv1.1 / addon / fserve.mrc
fserve.mrc — 10.13 KB — Download this file
; file server
on 1:text:%.trigger:*: {
if ($fserve($nick) == $null) {
set %mask. [ $+ [ $nick ] ] $mask($fulladdress,3)
if ($readini $mircdir\script\data\fsdata.ini $mask($fulladdress,3) Visited == YES) {
set %nick.check $readini $mircdir\script\data\fsdata.ini $mask($fulladdress,3) Nick
if (%nick.check != $nick) { set %not.new. [ $+ [ $nick ] ] %nick.check }
set %leech.check $readini $mircdir\script\data\fsdata.ini $mask($fulladdress,3) Leech
if (%leech.check == YES) { set %leech. [ $+ [ $nick ] ] YES }
set %ban.check $readini $mircdir\script\data\fsdata.ini $mask($fulladdress,3) Ban
if (%ban.check == YES) {
.msg $nick %logo Fserve - You have been banned from this Fserve.
unset %mask. [ $+ [ $nick ] ] | unset %nick.check | unset %not.new. [ $+ [ $nick ] ]
unset %leech.check | unset %ban.check | unset %leech. [ $+ [ $nick ] ] | halt
} }
else {
writeini $mircdir\script\data\fsdata.ini $mask($fulladdress,3) Nick $nick
writeini $mircdir\script\data\fsdata.ini $mask($fulladdress,3) Credits %.initial.credits
writeini $mircdir\script\data\fsdata.ini $mask($fulladdress,3) Ban NO
writeini $mircdir\script\data\fsdata.ini $mask($fulladdress,3) Leech NO
}
fserve $nick 100 %.root.dir
} }
on 1:open:!: {
if ($readini $mircdir\script\data\fsdata.ini %mask. [ $+ [ $nick ] ] Visited == YES) {
if (%leech. [ $+ [ $nick ] ] == YES) {
msg =$nick 12Leech Access 5Granted12, help yourself :).
msg =$nick 12No Credits will be added or removed.
halt
}
if (%not.new. [ $+ [ $nick ] ] != $null) {
msg =$nick %logo 12Fserve
msg =$nick 12You already have an account under the nick5 %not.new. [ $+ [ $nick ] ]
msg =$nick 12Your current credit status is5 $readini $mircdir\script\data\fsdata.ini %mask. [ $+ [ $nick ] ] Credits 12Credits
msg =$nick 12The current ratio is5 1: $+ %.ratio
msg =$nick 12To recieve more credits, send me files.
}
else {
msg =$nick %logo 2Fserve
msg =$nick 12Welcome back, your current credit status is5 $readini $mircdir\script\data\fsdata.ini %mask. [ $+ [ $nick ] ] Credits 12Credits
msg =$nick 12The current ratio is5 1: $+ %.ratio
msg =$nick 12To recieve more credits, you most upload files.
} }
else {
msg =$nick %logo 12Fserve
msg =$nick 12Welcome, this is your first time on this Fserve, you will be awarded5 %.initial.credits 12bytes of Credit.
msg =$nick 12The current ratio is5 1: $+ %.ratio
msg =$nick 12If you run out of credits, or want to recieve more, you most upload files.
} }
on 1:close:!: {
if ($readini $mircdir\script\data\fsdata.ini %mask. [ $+ [ $nick ] ] Visited == $null) {
writeini $mircdir\script\data\fsdata.ini %mask. [ $+ [ $nick ] ] Visited YES
}
unset %mask. [ $+ [ $nick ] ] | unset %nick.check | unset %not.new. [ $+ [ $nick ] ]
unset %leech.check | unset %ban.check | unset %leech. [ $+ [ $nick ] ]
unset %file.gets. [ $+ [ $nick ] ] | unset %file.sends. [ $+ [ $nick ] ]
.notice $nick Thanks for using my File Server. %logo
}
on 1:serv:*: {
if ($1 == exit) || ($1 == quit) {
if ($readini $mircdir\script\data\fsdata.ini %mask. [ $+ [ $nick ] ] Visited == $null) {
writeini $mircdir\script\data\fsdata.ini %mask. [ $+ [ $nick ] ] Visited YES
}
.notice $nick Thanks for using my File Server. %logo
}
elseif ($1 == get) {
if ($findfile($fserv($nick).cd,$2,1) == $null) {
msg =$nick 12File not found. Syntax is: 5get <12filename.ext5> | halt
}
if (%leech. [ $+ [ $nick ] ] == YES) {
DCC SEND $nick $findfile($fserv($nick).cd,$2,1) | halt
}
if (%file.gets. [ $+ [ $nick ] ] == %.max.file.gets) {
msg =$nick 12Max number of5 %.max.file.gets 12 file downloads has been reached, you can't download anymore files in this session. | halt
}
set %credits.check $readini $mircdir\script\data\fsdata.ini %mask. [ $+ [ $nick ] ] Credits
if ( $lof($findfile($fserv($nick).cd,$2,1)) > %credits.check ) {
msg =$nick 12That file is5 $lof($findfile($fserv($nick).cd,$2,1)) bytse12 and you have only5 %Credits.Check bytes 12Credits.
msg =$nick 12You most upload more files to get more credit.
unset %credits.check
halt
}
DCC SEND $nick $findfile($fserv($nick).cd,$2,1) | halt
}
elseif ($1 == read) { msg =$nick 12The command 5READ12 is disabled. If you want to read something, download it! | halt }
elseif ($1 == help) {
msg =$nick 12Commands are:
msg =$nick 5dir,ls:12 Display current directory files.
msg =$nick 5get:12 Download a file from the File Server. Syntax: 12get <filename.ext>
msg =$nick 5cd:12 Change working directoty directoy.
msg =$nick 5exit,quit: 12Close file server.
msg =$nick 5stats:12 View your personal stats.
msg =$nick 5help:12 This help menu.
halt
}
elseif ($1 == stats) {
if (%leech. [ $+ [ $nick ] ] == YES) { msg =$nick 12Ratio is:5 Leech Access, no credit ratio. }
else { msg =$nick 12Ratio is:5 1: $+ %.ratio }
msg =$nick 12Credits Left:5 $readini $mircdir\script\data\fsdata.ini %mask. [ $+ [ $nick ] ] Credits
halt
}
}
on 1:filercvd:*.*: {
if (%leech. [ $+ [ $nick ] ] == YES) {
if ($fserv($nick).status == active) {
msg =$nick 12Leech Access. No credits added.
}
else { .notice $nick 12Leech Access. No credits added. }
}
else {
set %ratio.credits $lof($filename) * %.ratio
set %current.credits $readini $mircdir\script\data\fsdata.ini %mask. [ $+ [ $nick ] ] Credits
inc %Current.Credits %ratio.credits
.writeini $mircdir\script\data\fsdata.ini %mask. [ $+ [ $nick ] ] Credits %Current.Credits
if ($fserv($nick).status == active) {
msg =$nick 12File transfer of5 $nopath($filename) 12Complete, your account will be awarded with5 %ratio.credits 12Credits.
msg =$nick 12Your new credit status is 5 %Current.Credits
unset %Current.Credits | unset %ratio.credits
}
else {
.notice $nick 12File transfer of5 $nopath($filename) 12Complete, your account will be awarded with5 %ratio.credits 12Credits.
.notice $nick 12Your new credit status is 5 %New.Credits
unset %Current.Credits | unset %ratio.credits
}
}
inc %file.sends. [ $+ [ $nick ] ]
}
on 1:filesent:*.*: {
if (%leech. [ $+ [ $nick ] ] == YES) {
if ($fserv($nick).status == active) {
msg =$nick 12Leech Access. No credits taken.
}
else { .notice $nick 12Leech Access. No credits taken. }
}
else {
set %current.credits $readini $mircdir\script\data\fsdata.ini %mask. [ $+ [ $nick ] ] Credits
dec %Current.Credits $lof($filename)
.writeini $mircdir\script\data\fsdata.ini %mask. [ $+ [ $nick ] ] Credits %Current.Credits
if ($fserv($nick).status == active) {
msg =$nick 12File transfer of5 $nopath($filename) 12Complete,5 $lof($filename) 12credits taken.
msg =$nick 12Your new credit status is5 %Current.Credits
unset %Current.Credits
}
else {
.notice $nick 12File transfer of5 $nopath($filename) 12Complete, your account will be awarded with5 %ratio.credits 12Credits.
.notice $nick 12Your new credit status is5 %Current.Credits
unset %Current.Credits
} }
inc %file.gets. [ $+ [ $nick ] ]
}
ctcp 1:dcc send: {
if (%file.sends. [ $+ [ $nick ] ] = %.max.file.sends) {
msg =$nick 12Max number of5 %.max.file.sends 12file sends has been reached, you can't upload anymore files in this session. | halt
}
if ($right($3,3) !isin %.accept.files) {
if ($fserv($nick).status == active) {
msg =$nick 5 $+ $right($3,3) 12is not an acceptible file type.
msg =$nick 12Acceptable file types are:5 %.accept.files
halt
} } }
menu query {
f&serve
.grant leech access: {
writeini $mircdir\script\data\fsdata.ini %mask. [ $+ [ $$1 ] ] Leech YES
msg = $+ $nick 12Leech Access 5Granted, 12reconnect to the Fserve to get it.
}
.revoke leech access: {
writeini $mircdir\script\data\fsdata.ini %mask. [ $+ [ $$1 ] ] Leech NO
msg = $+ $nick 12Leech Access 5Revoked. 12Tough luck.
}
.-
.ban from fserve: {
writeini $mircdir\script\data\fsdata.ini %mask. [ $+ [ $$1 ] ] Ban YES
.close -f $$1 | .notice $$1 12You are 5banned 12from this Fserve!
}
.unban from fserve: {
writeini $mircdir\script\data\fsdata.ini %mask. [ $+ [ $$1 ] ] Ban NO
.notice $$1 12You are 5unbanned 12from my Fserve.
}
}
menu @Fserve_Stats {
initial credits:set %.initial.credits $$?="Initial Fserve Download Credits:" | f9
root directory:set %.root.dir $$?="File Server's Root Directory:" | f9
trigger command:set %.trigger $$?="Fserve Trigger Command:" | f9
ratio:set %.ratio $$?="ul/dl byte ratio. use 3 for 1:3 etc." | f9
max sends/gets: {
set %.max.file.sends $$?="Max file sends, current: [ %.max.file.sends ] "
set %.max.file.gets $$?="Max file gets, current: [ %.max.file.gets ] " | f9
}
acceptable Files: %.accept.files = %.accept.files $$?="Add to acceptable files list. example: txt tar" | f9
}
alias f9 {
window @Fserve_Stats 342 78 255 131 @Fserve_Stats
clear @Fserve_Stats
aline @Fserve_Stats 12Fserve Stats
aline @Fserve_Stats 12Root Directory:5 %.root.dir
aline @Fserve_Stats 12Trigger Command:5 %.trigger
aline @Fserve_Stats 12Ratio:5 1: $+ %.ratio
aline @Fserve_Stats 12Initial Credit:5 %.initial.credits
aline @Fserve_Stats 12Max Gets:5 %.max.file.gets 12Max Sends:5 %.max.file.sends
}
on 1:load: fserve.init
alias fserve.init {
if (%.initial.credits == $null) { set %.initial.credits 300000 }
if (%.root.dir == $null) { set %.root.dir $mircdir } | if (%.trigger == $null) { set %.trigger !acid }
if (%.ratio == $null) { set %.ratio 3 } | if (%.Max.file.sends == $null) { set %.Max.file.sends 5 }
if (%.Max.file.gets == $null) { set %.Max.file.gets 5 }
if ( %.accept.files == $null ) { set %.accept.files zip tar jpg gif txt }
techo -a 12use 5F912 to configure the file server
}