mIRC Home    About    Download    Register    News    Help

Print Thread
whats wrong with this??? #98332 22/09/04 09:07 PM
Joined: Jun 2004
Posts: 291
W
whatsthedillio Offline OP
Fjord artisan
OP Offline
Fjord artisan
W
Joined: Jun 2004
Posts: 291
hey, could you please help me with this,
i dont know why its not working
for some reason when i type add bla bla it writes it the first time
but if i type the same thing it wont tell me that %name
already has access of %level

Code:
on *:TEXT:Access Add*:#:{
if ($nick != mynick) || ($address($nick,2) != *!*@myaddress) {
msg # Sorry You Cant Use This Command.
goto end
}
else {
if (!$3) || (!$4) || (!$5) || (!$6) {
msg # Sorry Not Enough Parameters.
goto end
}
if ($3 !ison $chan) {
msg # $3 Is Not On # Attempting To Add Anyway.
}
if ($4 == Access) && ($5 == Level) {
var %name = $3
var %level = $6
if ($read(Access.txt,s,$3)) {
tokenize 1 $read(Access.txt, $readn)
var %nick = $1
var %access.level = $2
if (%level == %access.level) {
msg # %name Allready Has Access Level Of %level
goto end
}
if (%access.level != %level) {
write -dl [ $+ [ $readn ] ] Access.txt
msg # I Changed %name $+ 's Access From $2 To %level
msg # To View Your Access Commands Type " My Access Commands"
goto end

}
}
if (!$read(Access.txt,s,%name)) {
write Access.txt %name $chr(1) %level $chr(1) $date(dddd) the $ord($date(dd)) Of $date(mmmm) $date(yyyy) $chr(1) $time(h:nn tt)
msg # Added %name To Access At Level %level
msg # To View Your Access Commands Type "My Access Commands"
}
}
:end
}
}


any ideas,

thanks alot

Re: whats wrong with this??? #98333 23/09/04 01:50 AM
Joined: Mar 2004
Posts: 540
A
Armada Offline
Fjord artisan
Offline
Fjord artisan
A
Joined: Mar 2004
Posts: 540
Why have the goto end? Just curious

Re: whats wrong with this??? #98334 23/09/04 05:48 AM
Joined: Mar 2003
Posts: 1,271
L
LocutusofBorg Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
1. all your goto's are mute, you might as well remove them
2. if (!$3) || (!$4) || (!$5) || (!$6) -- you can replace this with just if ($6) { do stuff } -- if $6 exists, so will $3-$53.
3. your check to see if it's you is HIGHLY insecure. Also, since you cannot triger your own on text events, how does this work? Is it a clone from you? Best would be to add a password or something you also need to type. Especially since this goes into open channel...

Code:
on *:TEXT:Access Add*:#:{
  [color:green]; this checks if it's you a wee bit more secure[/color]
  if ($mask($fulladdress,3) != *!*yourident@*.yourdomain.com) msg # Sorry You Cant Use This Command.
  [color:green]; check if there's enough parameters[/color]
  elseif ($!6) msg # Sorry Not Enough Parameters.
  [color:green]; check if the nick is present[/color]
  elseif ($3 !ison $chan) msg # $3 Is Not On # Attempting To Add Anyway.

  [color:green]; check for correct parameters[/color]
  elseif ($4 == Access) && ($5 == Level) {
    [color:green]; save entered data for later use[/color]
    var %nick $3, %level $6
    [color:green]; see if the user already exists[/color]
    if ($read(Access.txt,s,$3)) {
      [color:green]; if he does, read his info[/color]
      tokenize 1 $read(Access.txt, $readn)
      [color:green]; check info for match[/color]
      if ($2 == %level) msg # $1 already has accesslevel $2 !
      [color:green]; if it's not an exact match, delete old info[/color]
      else {
        write -dl [ $+ [ $readn ] ] Access.txt
        msg # Changing $1 $+ 's Access From $2 to %level
      }
    }
    [color:green]; add new info[/color]
    if ($!read(Access.txt,s,$3)) {
      write Access.txt %nick $chr(1) %level $chr(1) $date(dddd) the $ord($date(dd)) Of $date(mmmm) $date(yyyy) $chr(1) $time(h:nn tt)
      msg # Added %nick To Access At Level %level
      msg # To View Your Access Commands Type "My Access Commands"
    }
  }
}


Now I can't guarantee since I can't test it here, but this *should* work.


DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius
Re: whats wrong with this??? #98335 23/09/04 05:52 AM
Joined: Dec 2002
Posts: 788
C
Coolkill Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 788
elseif ([color:red]$!6) msg # Sorry Not Enough Parameters[/color] needs fixing.

Eamonn.

Re: whats wrong with this??? #98336 23/09/04 11:10 AM
Joined: Jun 2004
Posts: 291
W
whatsthedillio Offline OP
Fjord artisan
OP Offline
Fjord artisan
W
Joined: Jun 2004
Posts: 291
cool thanks for all the replies ill try them out later
smile