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 

Limit function request

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
Psyfire
Voice


Joined: 05 Nov 2006
Posts: 36

PostPosted: Fri Apr 20, 2007 2:12 pm    Post subject: Limit function request Reply with quote

Hello,

this is my actual thread and I cant continue there cause I dont know how to do something.

In my code at the bottom I need a limit. In the variable add_ban_length I need a simple limit. Everybody can add a ban only with a maximum of 180 minutes. That means you are able to add a ban into the database but not longer than the variable 180, how to do this?

Code:

#######################################
   ############## Add Ban ################
   #######################################

      proc ban:db:addban {nick host hand chan arg} {
                  global sql

               set add_player_id [lindex $arg 0]
               set add_player_nick [lindex $arg 1]
               set add_admin_id [nick2hand $nick]
               set add_ban_reason [lindex $arg 2]
               set add_ban_time [unixtime]
               set add_ban_length [lrange $arg 3 end]

               set sql(handle) [mysqlconnect -host $sql(host2) -user $sql(user2) -password $sql(pass2) -db $sql(db2)]
               set sma(qry) [mysqlsel $sql(handle) "INSERT INTO amx_bans(player_ip,player_id,player_nick,admin_ip,admin_id,admin_nick,ban_type,ban_reason,ban_created,ban_length,server_ip,server_name) VALUES('0.0.0.0','$add_player_id','$add_player_nick','$host','$add_admin_id','$nick','S','$add_ban_reason','$add_ban_time','$add_ban_length','$chan','IRC');"]
               mysqlclose $sql(handle)

            putserv "NOTICE $nick :Done."
         }
Back to top
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Fri Apr 20, 2007 3:09 pm    Post subject: Reply with quote

Code:

#change this, since it should only be one argument anyway, no need for
#lrange:
set add_ban_limit [lindex $arg 3]


if {(![string is integer -strict $add_ban_limit]) || ($add_ban_limit > 180)} {puthelp "PRIVMSG $nick :Ban time must be an integer and cannot be longer than 180 minutes";return}
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 -> Script Requests 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