on *:text:*:#: {
  if ($1 == !gag && $2 ison $chan) {
    mode $2 +z
    msg $chan $2 has been gagged for 5 minutes
    .timer 1 300 mode $2 -z

The main problems being that /setvar is not a valid command. You can use /set or you can use /var depending on what you're doing. Also, you missed a space after timer for your other error. One other issue you had is that you can only every have 1 nick automatically ungagged the way you are setting a variable like that. Also, you were ungagging the person doing the command rather than $2. The changes made fix all 3 issues and make it a little more efficient.

Note that I stuck it into an on TEXT event just to show how it fits into a script. If you have it in some other event, you can just insert the part that is inside this on TEXT into whatever event you already have set up.

EDIT: Edited to make the timer safe. Keep in mind that you should, of course, limit the ability to use this command to approved nicks or only yourself, which also will help prevent misuse. I would actually assume this command would be either an alias or an on INPUT anyhow.

Last edited by Riamus2; 04/05/08 01:12 AM.

Invision Support
#Invision on