mIRC Home    About    Download    Register    News    Help

Print Thread
#254167 25/07/15 02:53 PM
Joined: Jul 2015
Posts: 2
C
Cliftin Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
C
Joined: Jul 2015
Posts: 2
I need help with a script I've been trying to do for about a day and a half.
Code:
on *:TEXT:Delete messages for*:*: {
  IF ($4 == $nick) { GOTO first }
  ELSE { GOTO second }
  :first
  IF {$isfile($$4.txt) <= 1} { /msg $nick You don't have any messages to delete! }
  ELSE { /msg $nick Okay, I will delete all of your messages. | /remove $$4.txt }
  HALT
  :second
  { /msg $nick Only $4 can delete their messages! }
}

The way I intend the script to work is, if the file doesn't exist, then it prints the message to the right.

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Code:
on *:text:Delete messages for *:*: {
  if ($4 != $nick) { 
    msg $nick Only $4 can delete their messages!
    return
  }

  var %file = $4 $+ .txt

  if ($isfile(%file)) {
    msg $nick Okay, I will delete all of your messages.
    remove %file
  }
  else {
    msg $nick You don't have any messages to delete!
  }
}

Last edited by Loki12583; 25/07/15 03:35 PM.
Joined: Jul 2015
Posts: 2
C
Cliftin Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
C
Joined: Jul 2015
Posts: 2
It worked, thanks.


Link Copied to Clipboard