Author Topic: Help! Server Xtras  (Read 5153 times)

0 Members and 1 Guest are viewing this topic.

Offline mbalee

  • Street Thug
  • *
  • Posts: 32
    • View Profile
    • Hungarian GTA Site
Help! Server Xtras
« on: February 12, 2008, 08:24:48 pm »
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

Offline Mex

  • Wiseguy
  • **
  • Posts: 63
    • View Profile
Re: Help! Server Xtras
« Reply #1 on: February 12, 2008, 11:19:50 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.)

Code: [Select]
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
  } 
}

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).

Code: [Select]
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:
Code: [Select]
$vcmp.partofnick($vcmp.name(%id),[,])
« Last Edit: February 13, 2008, 06:58:00 pm by Mex »

Offline mbalee

  • Street Thug
  • *
  • Posts: 32
    • View Profile
    • Hungarian GTA Site
Re: Help! Server Xtras
« Reply #2 on: February 13, 2008, 12:03:41 am »
Thanks! :)

But... need some little things

1. cannot start with number

and

2. with ( and ) characters

Offline Mex

  • Wiseguy
  • **
  • Posts: 63
    • View Profile
Re: Help! Server Xtras
« Reply #3 on: February 13, 2008, 12:09:12 am »
Thanks! :)

But... need some little things

1. cannot start with number

np, hope this works too.

Code: [Select]
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
  } 
}

2. with ( and ) characters

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

Offline mbalee

  • Street Thug
  • *
  • Posts: 32
    • View Profile
    • Hungarian GTA Site
Re: Help! Server Xtras
« Reply #4 on: February 13, 2008, 01:41:45 pm »
WoW, big thanks! :D  :-*

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

Thanks, Balee

Offline Mex

  • Wiseguy
  • **
  • Posts: 63
    • View Profile
Re: Help! Server Xtras
« Reply #5 on: February 13, 2008, 07:01:05 pm »
Hey here's an update for the 'part or nick' alias:

Code: [Select]
$vcmp.partofnick($vcmp.name(%id))
Code: [Select]
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)
« Last Edit: February 13, 2008, 07:04:36 pm by Mex »

Offline mbalee

  • Street Thug
  • *
  • Posts: 32
    • View Profile
    • Hungarian GTA Site
Re: Help! Server Xtras
« Reply #6 on: February 17, 2008, 11:04:55 pm »
sorry, i need cannot START with number! Not how it may not use a number!

Please write! :)

Thanks, Balee!

Offline GTA-Roloboy

  • Made Man
  • ***
  • Posts: 135
    • View Profile
Re: Help! Server Xtras
« Reply #7 on: February 19, 2008, 12:35:44 am »
Maybe like, the first character in the name..

you have in some commands $3 !isnum)

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

Offline mbalee

  • Street Thug
  • *
  • Posts: 32
    • View Profile
    • Hungarian GTA Site
Re: Help! Server Xtras
« Reply #8 on: February 19, 2008, 07:50:30 pm »
aha, thx!