| View previous topic :: View next topic |
| Author |
Message |
garfwen Halfop
Joined: 12 Mar 2008 Posts: 61
|
Posted: Sat Dec 06, 2008 8:30 am Post subject: Removing user from list |
|
|
Hello
I have a script that add every single person that types !reg bot adds on a list.
| Code: |
foreach new_player $player_list {
|
Now i has trying to make a !remove script, but is not working:
| Code: |
bind pub - !remove remove
proc remove {nick uhost hand chan rest} {
global reg_status player_list max_players game_status game_prize the_winner_is
set pos [lsearch -exact $player_list $nick]
if { $pos != -1 } {
set player_list [lreplace $player_list $pos 0]
putserv "NOTICE $nick :$::corinicial Removed! $::corfinal"
} else {
putserv "NOTICE $nick :$::corinicial You are not registered! $::corfinal"
}
}
|
Whats wrong ?!
Ty, GaRfWeN |
|
| Back to top |
|
 |
tomekk Master

Joined: 28 Nov 2008 Posts: 255 Location: Oswiecim / Poland
|
Posted: Sat Dec 06, 2008 10:32 am Post subject: |
|
|
try to change:
| Code: | | set player_list [lreplace $player_list $pos 0] |
to:
| Code: | | set player_list [lreplace $player_list $pos $pos] |
:> |
|
| Back to top |
|
 |
garfwen Halfop
Joined: 12 Mar 2008 Posts: 61
|
Posted: Sat Dec 06, 2008 10:55 am Post subject: |
|
|
still not working,
bot says "Removed"
but nick stills there (on the list) :< |
|
| Back to top |
|
 |
tomekk Master

Joined: 28 Nov 2008 Posts: 255 Location: Oswiecim / Poland
|
Posted: Sat Dec 06, 2008 12:08 pm Post subject: |
|
|
| Code: | [tomekk@zonk]:/home# ./zonk.tcl
list before: nick1 nick2 nick3
command [remove "nick2"]
NOTICE nick2 :Removed!
list after: nick1 nick3 |
but ok, u can always use another foreach to rewrite the list without specified nick
its no problem  |
|
| Back to top |
|
 |
garfwen Halfop
Joined: 12 Mar 2008 Posts: 61
|
Posted: Sat Dec 06, 2008 2:20 pm Post subject: |
|
|
I forgot that it was saving nick;host .
Fixed, ty  |
|
| Back to top |
|
 |
|