egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Removing user from list

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
garfwen
Halfop


Joined: 12 Mar 2008
Posts: 61

PostPosted: Sat Dec 06, 2008 8:30 am    Post subject: Removing user from list Reply with quote

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 ?! Confused

Ty, GaRfWeN
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Sat Dec 06, 2008 10:32 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
garfwen
Halfop


Joined: 12 Mar 2008
Posts: 61

PostPosted: Sat Dec 06, 2008 10:55 am    Post subject: Reply with quote

still not working,

bot says "Removed"
but nick stills there (on the list) :<
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Sat Dec 06, 2008 12:08 pm    Post subject: Reply with quote

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 Smile
its no problem Smile
Back to top
View user's profile Send private message Visit poster's website
garfwen
Halfop


Joined: 12 Mar 2008
Posts: 61

PostPosted: Sat Dec 06, 2008 2:20 pm    Post subject: Reply with quote

I forgot that it was saving nick;host .

Fixed, ty Razz
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber