Psyfire Voice
Joined: 05 Nov 2006 Posts: 36
|
Posted: Fri Apr 20, 2007 2:12 pm Post subject: Limit function request |
|
|
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."
}
|
|
|
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
Posted: Fri Apr 20, 2007 3:09 pm Post subject: |
|
|
| 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}
|
|
|