Trouver une ressource (Nouvelle version du moteur, plus rapide & pertinent, essayez le !)
Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum.
Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !
UN BOT XDCC EN MIRC
Information sur la source
Description
Bon voila c'est mon tout premier code en irc, il permet d'etre soi meme un bot xdcc qui reagit aux commandes xdcc list, send #pack, remove , donc pour le faire marcher il faut creer un fichier c:\program files\mirc\xdcc.mrc et taper /load -rs xdcc.mrc ds une fenetre qqconque donc tout n'est pas parametrable (le nb de slot et la liste d'attente) mais j'attend toutes vos suggestions pour pouvoir ameliorer mon code
Source
- on *:LOAD:{ echo Script Loaded!
- write -c pack.txt
- dialog -md xdcc_ xdcc_
- }
- ;=================================================================================
- menu channel,menubar {
- XDCC bot
- .gestion du xdcc:dialog -md xdcc_ xdcc_
- }
- ;=================================================================================
- On *:CONNECT: { write -c list.txt }
-
- On *:TEXT:!list:*:{
- notice $nick $me (XDCC) 2 slots d'envoie, liste d'attente de max 10 personnes, $lines(pack.txt) fichiers partagés
- }
-
- On *:TEXT:*xdcc*:?:{
- if ( $2 == list ) { listpack $nick }
- elseif ( $2 == send ) {
- if ( $3 <= $lines(pack.txt) ) addtoqueu $nick $3
- else notice $nick pack non existant
- }
- elseif ( $2 == remove ) { remfrqueu $nick }
- }
-
- On *:SENDFAIL:*: {
- var %lign = 1, %nblines = $lines(list.txt)
- while ( %lign <= %nblines && $gettok($read(list.txt,%lign),1,32) != $nick ) {
- inc %lign
- }
- if ( %lign <= %nblines ) {
- notice $nick transfert de $deltok($read(pack.txt,$gettok($read(list.txt,%lign),2,32),1,124) interrompu ... dsl :(
- write -dl %lign list.txt
- dcc send $gettok($read(list.txt,2),1,124)) $gettok($read(pack.txt,$gettok($read(list.txt,2),2,32))),1,124)
- }
- }
-
- on *:FILESENT:*: {
- var %lign = 1, %nblines = $lines(list.txt)
- while ( %lign <= %nblines && $gettok($read(list.txt,%lign),1,32) != $nick ) {
- inc %lign
- }
- if ( %lign <= %nblines ) {
- notice $nick transfert de $deltok($read(pack.txt,$gettok($read(list.txt,%lign),2,32)),1,124) accompli
- write -dl %lign list.txt
- dcc send $gettok($read(list.txt,2),1,124)) $gettok($read(pack.txt,$gettok($read(list.txt,2),2,32))),1,124)
- }
- }
-
- alias listpack {
- var %lign = 1, %nblines = $lines(pack.txt)
- notice $1 anime-team's XDCC, 2 slot d'envoie , liste d'attentes $calc( 12 - $lines(pack.txt) )/12
- notice $1 pour avoir un pack, tapez /msg $me xdcc send numero_du_pack
- while ( %lign <= %nblines ) {
- notice $1 pack %lign : $deltok($read(pack.txt,%lign),1,124)
- inc %lign
- }
- notice $1 %nblines fichiers partagés
- }
-
- alias addtoqueu {
- if ( $lines(list.txt) < 12 ) {
- if ( $read(list.txt, w, $1) != $1 ) {
- write list.txt $1 $2
- notice $1 vouz avez été ajouté en position $lines(list.txt)
- if ( $lines(list.txt) < 3 ) {
- notice $1 envoi du pack : $deltok($read(pack.txt,$2),1,124)
- dcc send $1 $gettok($read(pack.txt,$2),1,124)
- }
- }
- else { notice $1 vous ete deja present dans la liste d'attente }
- }
- else { notice $1 liste pleine }
- }
-
-
- alias remfrqueu {
- var %lign = 1, %nblines = $lines(list.txt)
- while ( %lign <= %nblines && $gettok($read(list.txt,%lign),1,124) != $1 ) {
- inc %lign
- }
- if ( %lign <= %nblines ) {
- write -dl %lign list.txt
- notice $1 vous avez bien été enlevé de la liste d'attente :)
- }
- else { notice $1 dsl zetes pas dans la liste d'attente :( }
- }
-
- ;========================================================================================
- dialog xdcc_ {
- title "Xdcc"
- size -1 -1 412 129
- option dbu
- button "Ajouter un fichier", 2, 334 11 65 15
- list 1, 9 11 312 105, size
- box "Gestion de votre Xdcc", 7, 3 4 405 116
- button "Supprimer un fichier", 3, 334 32 65 15
- button "Move Up", 5, 334 75 65 15
- button "Modifier une description", 4, 334 53 65 15
- button "Move Down", 6, 334 97 65 15
- }
-
- On *:DIALOG:xdcc_:*:*: {
- if ( $devent == init ) {
- var %lign = 1, %nblines = $lines(pack.txt)
- while ( %lign <= %nblines ) {
- did -a xdcc_ 1 $read(pack.txt,%lign)
- inc %lign
- }
- }
- elseif ( $devent == sclick ) {
- if ( $did == 2 ) {
- var %nam = $sfile(C:\,Ajouter un fichier,Ajouter)
- if ( %nam ) {
- write pack.txt %nam
- did -a xdcc_ 1 %nam
- }
- }
- elseif ( $did == 3 ) {
- if ( $did(1).sel ) {
- write -dl $did(1).sel pack.txt
- did -d xdcc_ 1 $did(1).sel
- }
- }
- elseif ( $did == 4 ) {
- if ( $did(1).sel ) {
- var %temp = $read(pack.txt,$gettok($did(1).sel,1,124))
- write -l $did(1).sel pack.txt $+(%temp,|,$?=" $+(entrez une description pour le fichier,$chr(32),%temp) ")
- did -o xdcc_ 1 $did(1).sel $read(pack.txt,$did(1).sel)
- }
- }
- elseif ( $did == 5 ) {
- if ( $did(1).sel ) {
- if ( $calc( $did(1).sel - 1 ) > 0 ) {
- var %temp = $read(pack.txt,$did(1).sel) , %did_ = $did(1).sel , %didm_ = $calc( $did(1).sel - 1 )
- did -o xdcc_ 1 %didm_ %temp
- did -o xdcc_ 1 %did_ $read(pack.txt,%didm_)
- write -l %did_ pack.txt $read(pack.txt,%didm_)
- write -l %didm_ pack.txt %temp
- }
- }
- }
- elseif ( $did == 6 ) {
- if ( $did(1).sel ) {
- if ( $calc( $did(1).sel + 1 ) <= $lines(pack.txt) ) {
- var %temp = $read(pack.txt,$did(1).sel) , %did_ = $did(1).sel , %didm_ = $calc( $did(1).sel + 1 )
- did -o xdcc_ 1 %didm_ %temp
- did -o xdcc_ 1 %did_ $read(pack.txt,%didm_)
- write -l %did_ pack.txt $read(pack.txt,%didm_)
- write -l %didm_ pack.txt %temp
- }
- }
- }
- }
- }
on *:LOAD:{ echo Script Loaded!
write -c pack.txt
dialog -md xdcc_ xdcc_
}
;=================================================================================
menu channel,menubar {
XDCC bot
.gestion du xdcc:dialog -md xdcc_ xdcc_
}
;=================================================================================
On *:CONNECT: { write -c list.txt }
On *:TEXT:!list:*:{
notice $nick $me (XDCC) 2 slots d'envoie, liste d'attente de max 10 personnes, $lines(pack.txt) fichiers partagés
}
On *:TEXT:*xdcc*:?:{
if ( $2 == list ) { listpack $nick }
elseif ( $2 == send ) {
if ( $3 <= $lines(pack.txt) ) addtoqueu $nick $3
else notice $nick pack non existant
}
elseif ( $2 == remove ) { remfrqueu $nick }
}
On *:SENDFAIL:*: {
var %lign = 1, %nblines = $lines(list.txt)
while ( %lign <= %nblines && $gettok($read(list.txt,%lign),1,32) != $nick ) {
inc %lign
}
if ( %lign <= %nblines ) {
notice $nick transfert de $deltok($read(pack.txt,$gettok($read(list.txt,%lign),2,32),1,124) interrompu ... dsl :(
write -dl %lign list.txt
dcc send $gettok($read(list.txt,2),1,124)) $gettok($read(pack.txt,$gettok($read(list.txt,2),2,32))),1,124)
}
}
on *:FILESENT:*: {
var %lign = 1, %nblines = $lines(list.txt)
while ( %lign <= %nblines && $gettok($read(list.txt,%lign),1,32) != $nick ) {
inc %lign
}
if ( %lign <= %nblines ) {
notice $nick transfert de $deltok($read(pack.txt,$gettok($read(list.txt,%lign),2,32)),1,124) accompli
write -dl %lign list.txt
dcc send $gettok($read(list.txt,2),1,124)) $gettok($read(pack.txt,$gettok($read(list.txt,2),2,32))),1,124)
}
}
alias listpack {
var %lign = 1, %nblines = $lines(pack.txt)
notice $1 anime-team's XDCC, 2 slot d'envoie , liste d'attentes $calc( 12 - $lines(pack.txt) )/12
notice $1 pour avoir un pack, tapez /msg $me xdcc send numero_du_pack
while ( %lign <= %nblines ) {
notice $1 pack %lign : $deltok($read(pack.txt,%lign),1,124)
inc %lign
}
notice $1 %nblines fichiers partagés
}
alias addtoqueu {
if ( $lines(list.txt) < 12 ) {
if ( $read(list.txt, w, $1) != $1 ) {
write list.txt $1 $2
notice $1 vouz avez été ajouté en position $lines(list.txt)
if ( $lines(list.txt) < 3 ) {
notice $1 envoi du pack : $deltok($read(pack.txt,$2),1,124)
dcc send $1 $gettok($read(pack.txt,$2),1,124)
}
}
else { notice $1 vous ete deja present dans la liste d'attente }
}
else { notice $1 liste pleine }
}
alias remfrqueu {
var %lign = 1, %nblines = $lines(list.txt)
while ( %lign <= %nblines && $gettok($read(list.txt,%lign),1,124) != $1 ) {
inc %lign
}
if ( %lign <= %nblines ) {
write -dl %lign list.txt
notice $1 vous avez bien été enlevé de la liste d'attente :)
}
else { notice $1 dsl zetes pas dans la liste d'attente :( }
}
;========================================================================================
dialog xdcc_ {
title "Xdcc"
size -1 -1 412 129
option dbu
button "Ajouter un fichier", 2, 334 11 65 15
list 1, 9 11 312 105, size
box "Gestion de votre Xdcc", 7, 3 4 405 116
button "Supprimer un fichier", 3, 334 32 65 15
button "Move Up", 5, 334 75 65 15
button "Modifier une description", 4, 334 53 65 15
button "Move Down", 6, 334 97 65 15
}
On *:DIALOG:xdcc_:*:*: {
if ( $devent == init ) {
var %lign = 1, %nblines = $lines(pack.txt)
while ( %lign <= %nblines ) {
did -a xdcc_ 1 $read(pack.txt,%lign)
inc %lign
}
}
elseif ( $devent == sclick ) {
if ( $did == 2 ) {
var %nam = $sfile(C:\,Ajouter un fichier,Ajouter)
if ( %nam ) {
write pack.txt %nam
did -a xdcc_ 1 %nam
}
}
elseif ( $did == 3 ) {
if ( $did(1).sel ) {
write -dl $did(1).sel pack.txt
did -d xdcc_ 1 $did(1).sel
}
}
elseif ( $did == 4 ) {
if ( $did(1).sel ) {
var %temp = $read(pack.txt,$gettok($did(1).sel,1,124))
write -l $did(1).sel pack.txt $+(%temp,|,$?=" $+(entrez une description pour le fichier,$chr(32),%temp) ")
did -o xdcc_ 1 $did(1).sel $read(pack.txt,$did(1).sel)
}
}
elseif ( $did == 5 ) {
if ( $did(1).sel ) {
if ( $calc( $did(1).sel - 1 ) > 0 ) {
var %temp = $read(pack.txt,$did(1).sel) , %did_ = $did(1).sel , %didm_ = $calc( $did(1).sel - 1 )
did -o xdcc_ 1 %didm_ %temp
did -o xdcc_ 1 %did_ $read(pack.txt,%didm_)
write -l %did_ pack.txt $read(pack.txt,%didm_)
write -l %didm_ pack.txt %temp
}
}
}
elseif ( $did == 6 ) {
if ( $did(1).sel ) {
if ( $calc( $did(1).sel + 1 ) <= $lines(pack.txt) ) {
var %temp = $read(pack.txt,$did(1).sel) , %did_ = $did(1).sel , %didm_ = $calc( $did(1).sel + 1 )
did -o xdcc_ 1 %didm_ %temp
did -o xdcc_ 1 %did_ $read(pack.txt,%didm_)
write -l %did_ pack.txt $read(pack.txt,%didm_)
write -l %didm_ pack.txt %temp
}
}
}
}
}
Conclusion
donc y'a pê des erreurs etc et j'attend vraiment vraiment vraiment vraiment impatiemment toutes vos suggestions pour l'ameliorer , l'optimiser etc ... merci infiniment pour tout vos commentaires !
Fichier Zip
Pour les "Membres Club", vous pouvez télécharger directement un fichier contenu dans le zip sans télécharger le zip en entier !
Télécharger le zip
Historique
- 21 août 2005 17:15:38 :
- eu j'av oublié un truc lol dsl
- 21 août 2005 18:37:08 :
- code eclairci
variable locale ds certain remote
- 21 août 2005 18:54:16 :
- remplacement des variables inutiles par des arguments pour fonction
- 21 août 2005 21:22:03 :
- des optimisations ds les boucles
- 22 août 2005 20:19:33 :
- ajout d'un dialogue pour parametrer les fichiers partagées !
- 22 août 2005 22:10:42 :
- correction de bugs / mise sous forme *.mrc / ajout d'un zip & d'un apercu
- 23 août 2005 00:00:24 :
- rajout du !list
Sources de la même categorie
Commentaires
Discussions en rapport avec ce code source
|
CalendriCode
| | | L | M | M | J | V | S | D |
| | | | | 1 | 2 | 3 |
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
|
Téléchargements
Logiciels à télécharger sur le même thème :
|