קוד PHP:
menu nicklist {
Friends List
.open Dialog:{ f }
.Add Friend:{
if (!$dialog(friends)) && ($address($1,2) !isin $read(friends.txt, w, $address($1,2))) { write friends.txt $address($1,2) }
elseif ($dialog(friends)) && ($address($1,2) !isin $read(friends.txt, w, $address($1,2))) { write friends.txt $address($1,2) | f | f }
}
.Del Friend:{
if (!$dialog(friends)) && ($address($1,2) isin $read(friends.txt, w, $address($1,2))) {
write -ds $address($1,2) friends.txt
}
elseif ($dialog(friends)) && ($address($1,2) isin $read(friends.txt, w, $address($1,2))) {
write -ds $address($1,2) friends.txt
f
f
}
}
}
dialog friends {
title "Friends List"
size -1 -1 99 150
icon icons/friend.ico
option dbu notheme
box "Friends List", 1, 1 1 97 89
button "Add", 2, 6 93 37 12
button "Edit", 3, 6 106 37 12
button "Clear", 4, 49 106 37 12
button "Del", 5, 49 93 37 12
list 6, 3 9 92 78, vsbar hsbar
radio "Music ON", 7, 6 122 45 10
radio "Music OFF", 8, 6 137 42 10
button "Check Friend", 9, 50 129 37 12
}
alias f { dialog $iif(!$dialog(friends),-m ,-x) friends friends }
on *:dialog:friends:init:*:{
var %a = 1
while (%a < $calc($lines(friends.txt) + 1)) { did -a $dname 6 $read(friends.txt, %a) | inc %a }
}
on *:dialog:friends:sclick:*:{
if ($did == 2) { var %a = $input(Add nick/address to friends list,e,Friends List System) | if (%a !isin $read(friends.txt)) { did -a $dname 6 %a | write friends.txt %a } | elseif (%a isin $read(friends.txt)) { var %b = $input(%a isin in the list,o,Friends List System) } }
if ($did == 3) && ($did($dname,6).sel) { var %a = $input(Edit The nick/address,e,Friends List System,$did($dname,6).seltext) | write -d friends.txt $did($dname,6).seltext | write friends.txt %a | did -d $dname 6 $did($dname,6).sel | did -a $dname 6 %a } | elseif ($did == 3) && (!$did($dname,6).sel) { var %a = $input(Push on one of the list`s line,o,Friends List System) }
if ($did == 4) && ($lines(friends.txt) > 0)) { var %a = $input(Are you sure?,c,Friends List System) | if (%a == $true) { write -c friends.txt | did -r $dname 6 } } | elseif ($did == 4) && ($lines(friends.txt) < 1)) { var %a = $input(The list is cleared whyyou cleared again?,o,Friends List System) }
if ($did == 5) && ($did($dname,6).sel) {
write -ds $did($dname,6).seltext friends.txt
did -d $dname 6 $did($dname,6).sel
}
if ($did == 7) { set %fmusic ON }
if ($did == 8) { set %fmusic OFF }
if ($did == 9) && ($did($dname,6).sel) {
if ($chan(0) > 0) {
ch
var %nick = $did($dname,6).seltext
var %a = 1
while (%a < $calc($chan(0) + 1)) {
var %b = 1
while (%b < $calc($nick($chan(%a),0) + 1)) {
if (%nick == $nick($chan(%a),%b)) || (%nick == $address($nick($chan(%a),%b),2)) {
did -a check 2 %nick Detected IN $chan(%a)
set %nickch $nick($chan(%a),%b)
}
inc %b
}
inc %a
}
did -a check 2 Name of friend is: %nickch
did -a check 2 Address of friend is: $address(%nickch,2)
unset %nickch
}
}
}
on *:join:#: {
if ($nick isin $read(friends.txt, w, $nick)) || ($address($nick,2) isin $read(friends.txt, w, $address($nick,2))) {
var %a = $+ $replace($r(2,13),8,$replace($r(2,8),8,$r(9,13)))
msg $chan %a $+ F14riends %a $+ L14ist: $iif($len($nick) > 1,%a $+ $left($nick,1) $+ 14 $+ $mid($mid($nick,2,$len($nick)),1,$calc($len($nick) - 2)) $+ %a $+ $right($nick,1) ,$+ %a $nick) 14 $+ ( $+ %a $+ $address($nick,2) $+ 14 $+ ) ( $+ %a $+ r $+ 14ikufu $+ %a $+ @14Script)
if (%fmusic == ON) { splay Friend.wav }
}
}
dialog check {
title "Checks"
size -1 -1 246 54
option dbu
box "Checks", 1, 2 1 243 52
list 2, 3 9 240 42, vsbar
}
alias ch { dialog $iif(!$dialog(check),-m ,-x) check check }
כדי להוסיף חבר יש ללחוץ ברשימה בצד מקש ימיני עליו ואז Friend List <add Friend