Author Topic: InVaLiD NiCk..  (Read 6787 times)

0 Members and 1 Guest are viewing this topic.

Offline Amenine

  • Street Thug
  • *
  • Posts: 47
  • [UCG]Clan Leader -Scripter/Fighter/XE MoD-
    • View Profile
    • UCG
InVaLiD NiCk..
« on: March 02, 2009, 09:50:14 am »
Hey i am trying to convert WSV little but getting problem here...about invalid nick gets a kick...but its kicking everyone in server with name as [CG]Amenine or with invalid name as !!35433%%#...Plz try to sort this out...

Here.
Code: [Select]
if ($len($3) < 3) || ($left($3,1) isnum) || ($chr(35) isin $3) || ($chr(36) isin $3) || ($chr(37) isin $3) || ($3 == none) {
    vcmp.say *** $3 has been auto-kicked. [Invalid Nick]
    vcmp.announce %id ~y~Please change your nick-name..
    .timer 1 2 /vcmp.kick %id
  }

Windlord

  • Guest
Re: InVaLiD NiCk..
« Reply #1 on: March 02, 2009, 11:07:58 am »
Are you sure $3 on your vcmp.join signal is the nick-name of the player that is joining?

It seems like you have removed IDs from the aliases and you may have done so in the signals as well.

Try $2

Offline thijn

  • LU testers
  • VC:MP Veteran
  • *
  • Posts: 667
  • Im proud to be pro.
    • View Profile
    • Vice Underdogs
Re: InVaLiD NiCk..
« Reply #2 on: March 02, 2009, 06:57:56 pm »
If this is GUS with the old DLL, It's $1 ;)

Offline Mex

  • Wiseguy
  • **
  • Posts: 63
    • View Profile
Re: InVaLiD NiCk..
« Reply #3 on: March 02, 2009, 09:45:11 pm »
also you should put an extra pair of ( ) brackets around the massive conditional statement ;)

Code: [Select]
if (($len($3) < 3) || ($left($3,1) isnum) || ($chr(35) isin $3) || ($chr(36) isin $3) || ($chr(37) isin $3) || ($3 == none)) {
  vcmp.say *** $3 has been auto-kicked. [Invalid Nick]
  vcmp.announce %id ~y~Please change your nick-name..
  .timer 1 2 /vcmp.kick %id
}

Windlord

  • Guest
Re: InVaLiD NiCk..
« Reply #4 on: March 03, 2009, 12:12:24 pm »
lol you don't need that extra bracket.

Offline Amenine

  • Street Thug
  • *
  • Posts: 47
  • [UCG]Clan Leader -Scripter/Fighter/XE MoD-
    • View Profile
    • UCG
Re: InVaLiD NiCk..
« Reply #5 on: March 03, 2009, 03:24:06 pm »
If this is GUS with the old DLL, It's $1 ;)
Yup Thijn is right ,its $1...
Now working fine ..
Nvm Thanks to all for their suggestions.. :P

Offline thijn

  • LU testers
  • VC:MP Veteran
  • *
  • Posts: 667
  • Im proud to be pro.
    • View Profile
    • Vice Underdogs
Re: InVaLiD NiCk..
« Reply #6 on: March 03, 2009, 06:46:40 pm »
No Problem ;)

Offline Mex

  • Wiseguy
  • **
  • Posts: 63
    • View Profile
Re: InVaLiD NiCk..
« Reply #7 on: March 03, 2009, 08:19:11 pm »
lol you don't need that extra bracket.

Sometimes you do sometimes you dont.

Windlord

  • Guest
Re: InVaLiD NiCk..
« Reply #8 on: March 04, 2009, 11:26:49 am »
lol yes but we were only discussing the case for
Code: [Select]
if ($len($3) < 3) || ($left($3,1) isnum) || ($chr(35) isin $3) || ($chr(36) isin $3) || ($chr(37) isin $3) || ($3 == none) {
    vcmp.say *** $3 has been auto-kicked. [Invalid Nick]
    vcmp.announce %id ~y~Please change your nick-name..
    .timer 1 2 /vcmp.kick %id
  }

Were we not? :P

Offline Mex

  • Wiseguy
  • **
  • Posts: 63
    • View Profile
Re: InVaLiD NiCk..
« Reply #9 on: March 04, 2009, 04:34:57 pm »
Indeed we were.

I can remember along time ago when I was having problems with brackets,
and I tried all possible bracket solutions for the statement, and the only one which worked was when I added an extra pair of ( )

So from now on I've always added them when I have a statement with more than 1 condition, and it's never let me down.

So unless you know when to add them or not, in my opinion it's best to add them anyway.

I'm assuming you know when to add them, perhaps you could explain?

Offline VRocker

  • LU Developer
  • Wiseguy
  • *
  • Posts: 63
    • View Profile
    • Liberty Unleashed - GTA3 Multiplayer Mod
Re: InVaLiD NiCk..
« Reply #10 on: March 04, 2009, 05:15:29 pm »
Just adding my small comment of the brackets thingy...

I remember reading ages ago that mirc scripts execute a bit faster if the entire if statement is in brackets. so if ( ( $1 == 1 ) && ( $2 == 2 ) ). Not sure how reliable this source was though.

Another reason for encapsulating it all in brackets would be that some complex if statements require it else they will just fail or not work as expected.


Windlord

  • Guest
Re: InVaLiD NiCk..
« Reply #11 on: March 04, 2009, 05:58:46 pm »
I'm not very good at explaining stuff... but I'll try nonetheless.

When using the if/elseif conditionals,
The statement is checked by the script starting from the start of the line.

So if you have a line like;
Code: [Select]
if ($nick == Windlord) || ($chan == #windlord) && ($1 == !cmd)
The script will check if '$nick == Windlord' first.
Then it goes on to check the operator which is '||' in this case.
As '||' means; 'or' the script won't bother continuing to check the statement if the first conditional is already true.
By any chance, if '$nick != Windlord' the script will continue processing the statement.

If the operator is '&&' the script only continues checking if the first conditional is true. If it is false, there is no need to check the next conditional.

Now sometimes, we would want '!cmd' to work both for 'Windlord' and '#windlord' but since the script only processes the statements in the order they are written in, it is not possible to do so.
That's when you add in extra brackets so that the script can process additional conditionals included inside the main conditional.

If '!cmd' needs to be used by 'Windlord' as well as anyone on '#windlord, the script would need to be;
Code: [Select]
if (($nick == Windlord) || ($chan == #windlord)) && ($1 == !cmd)

And so on...

Hope this helps.

Offline Mex

  • Wiseguy
  • **
  • Posts: 63
    • View Profile
Re: InVaLiD NiCk..
« Reply #12 on: March 07, 2009, 06:58:44 pm »
nice explanation man,

about what i said, i must have been thinking of a more advanced expression like the last one you posted