This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Limit function request

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
P
Psyfire
Voice
Posts: 36
Joined: Sun Nov 05, 2006 12:32 pm

Limit function request

Post by Psyfire »

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: Select all

#######################################
   ############## 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."
         } 
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

Code: Select all

#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}
Post Reply