• Welcome to Vice City Multiplayer.
 

Help! Server Xtras

Started by mbalee, February 12, 2008, 06:24:48 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

mbalee

Hi! I have 2 little questions. Please help. :)

1. How may I make it that the nickname may not contain @,/,&,%,*,! and other characters? (kick)

2. How I may have it read through only the parenthesis and the characters in him?
exampl: [VcMp]Testplayer the nick and only need [VcMp]

I hope for it myself expressed it understandable. :)  :-\

Thanks!  :-*

Cya, Balee

Mex

#1
Quote from: mbalee on February 12, 2008, 06:24:48 PM
1. How may I make it that the nickname may not contain @,/,&,%,*,! and other characters? (kick)

Hey mbalee,
Just put the characters after the "%b = " bit, hope it works.

(A regular expression could probably do this better, but I don't know them.)

on *:SIGNAL:vcmp.join:{
  var %name = $1, %id = $vcmp.getid(%name)
  var %a = 1, %b = @ / & % * !
  while (%a <= $numtok(%b,32)) {
    if ($gettok(%b,%a,32) isin %name) {
      vcmp.kick %id
    }
    !inc %a
  } 
}


Quote from: mbalee on February 12, 2008, 06:24:48 PM
2. How I may have it read through only the parenthesis and the characters in him?
exampl: [VcMp]Testplayer the nick and only need [VcMp]

Remember to put this alias outside any signal brackets (scope).

alias vcmp.partofnick {
  var %name = $1, %pos1 = $pos(%name,$2,1), %pos2 = $pos(%name,$3,1)
  !return $mid(%name,%pos1,%pos2)
}


And heres the identifier to use:
$vcmp.partofnick($vcmp.name(%id),[,])

mbalee

Thanks! :)

But... need some little things

1. cannot start with number

and

2. with ( and ) characters

Mex

Quote from: mbalee on February 12, 2008, 10:03:41 PM
Thanks! :)

But... need some little things

1. cannot start with number

np, hope this works too.

on *:SIGNAL:vcmp.join:{
  var %name = $1, %id = $vcmp.getid(%name)
  var %a = 1, %b = @ / & % * !
  if ($left(%name,1) isnum) { vcmp.kick %id }
  while (%a <= $numtok(%b,32)) {
    if ($gettok(%b,%a,32) isin %name) {
      vcmp.kick %id
    }
    !inc %a
  } 
}


Quote from: mbalee on February 12, 2008, 10:03:41 PM
2. with ( and ) characters

$vcmp.partofnick($vcmp.name(%id),$chr(40),$chr(41))

mbalee

WoW, big thanks! :D  :-*

Very good! But I realized a 1st question. :)
I did not look at the second though sufficient.  ::)

Thanks, Balee

Mex

#5
Hey here's an update for the 'part or nick' alias:

$vcmp.partofnick($vcmp.name(%id))

alias vcmp.partofnick {
  var %a = 1, %b = $1, %c, %d, %e, %f, %g, %h
  while (%a <= $len(%b)) {
    %c = $mid(%b,%a,1)
    if (%c == $chr(40)) { %d = $v2 | %e = $chr(41) | !break }
    elseif (%c == $chr(91)) { %d = $v2 | %e = $chr(93) | !break }
    !inc %a
  }
  %f = $pos(%b,%d,1) | %g = $pos(%b,%e,1)
  if ((!%d) || (!%f) || (!%g)) { !return }
  %h = $mid(%b,%f,$calc((%g - %f) + 1))
  !return $iif($len(%h) > 2,%h)
}


It will work for nicks like:
[XX]Testing Test[XX]ing Testing[XX] (XX)Testing Test(XX)ing Testing(XX)

mbalee

sorry, i need cannot START with number! Not how it may not use a number!

Please write! :)

Thanks, Balee!

GTA-Roloboy

Maybe like, the first character in the name..

you have in some commands $3 !isnum)

Well use by the first character "isnum" (without ! )

mbalee