All pastes #944478 Raw Edit

Mine

public text v1 · immutable
·published 2008-03-16 03:24 UTC
rendered paste body
/floodprotect {
  if %floodProtectEnabled == 1 goto floodProtEnd
  /inc %floodCounter
  if %floodCounter == %maxMessages {
    %time [ $+ [ %floodCounter ] ] = $ctime($asctime)
    if $calc(%time [ $+ [ %floodCounter ] ] - %time1) <= 3 {
      /floodProtectOn
    }
    :shiftFloodMessageTimes
    /inc %i
    if %i == %maxMessages goto endShiftFloodMessageTimes
    %time [ $+ [ %i ] ] = %time [ $+ [ $calc(%i + 1) ] ]
    goto shiftFloodMessageTimes
    :endShiftFloodMessageTimes
    /unset %i
    /dec %floodCounter
  }
  %time [ $+ [ %floodCounter ] ] = $ctime($asctime)
  %difference = $calc(%time [ $+ [ %floodCounter ] ] - %time1)
  /echo the time difference in seconds is %difference
  :floodProtEnd
}

/floodProtectOn {
  %floodProtectEnabled = 1
  /timer 1 %floodProtectDuration /floodProtectOff
}

/floodProtectOff {
  %floodProtectEnabled = 0
}