Author Topic: Need little help!  (Read 5907 times)

0 Members and 1 Guest are viewing this topic.

Offline mbalee

  • Street Thug
  • *
  • Posts: 32
    • View Profile
    • Hungarian GTA Site
Need little help!
« on: December 01, 2007, 06:12:36 pm »
  elseif ($2 == !players) || ($2 == !pmplayers) {
    if ($vcmp.cmdcheck(!players,%id) == fail) !halt
    else {
      var %aa = 0,%bb,%cc,%dd
      while (%aa <= 50) {
        if ($vcmp.level(%aa) >= 1) {
          if (!%bb) %bb = $vcmp.name(%aa) $+ ;
          elseif ($numtok(%bb,32) <= 7) %bb = %bb  $vcmp.name(%aa) $+
          elseif (!%cc) %cc = $vcmp.name(%aa) $+
          elseif ($numtok(%cc,32) <= 7) %cc = %cc  $vcmp.name(%aa) $+
          elseif (!%dd) %dd = $vcmp.name(%aa) $+
          elseif ($numtok(%dd,32) <= 7) %dd = %dd  $vcmp.name(%aa) $+
        }
        !inc %aa
      }
      if (%bb) {
        vcmp.cmdsay $2 %id Online Players: *$calc...?????????
        if (%cc) vcmp.cmdsay $2 %id %cc
        if (%dd) vcmp.cmdsay $2 %id %dd
      }
    }
  }


*What write here???

Offline Mex

  • Wiseguy
  • **
  • Posts: 63
    • View Profile
Re: Need little help!
« Reply #1 on: December 01, 2007, 10:31:38 pm »
Hey, what exactly are you trying to do?

Also you haven't displayed the %bb variable, so try replacing
Code: [Select]
*$calc...with
Code: [Select]
%bb

Offline mbalee

  • Street Thug
  • *
  • Posts: 32
    • View Profile
    • Hungarian GTA Site
Re: Need little help!
« Reply #2 on: December 02, 2007, 03:00:40 pm »
I would like it with numbers!

... Online Players: [17/30]

Offline Mex

  • Wiseguy
  • **
  • Posts: 63
    • View Profile
Re: Need little help!
« Reply #3 on: December 03, 2007, 12:12:53 am »
Ah ok, if you only want the numbers displayed and not the player's names then this should work:

Code: [Select]
elseif ($2 == !players) || ($2 == !pmplayers) {
  if ($vcmp.cmdcheck(!players,%id) == fail) !halt
  else {
    var %aa = 0,%bb = 0
    while (%aa <= 50) {
      if ($vcmp.level(%aa) >= 1) {
        inc %bb
      }
      inc %aa
    }
    vcmp.cmdsay $2 %id Online Players: $+($chr(90),%bb,/30,$chr(91))
  }
}

Also dont forget to add the command name (!players) and its required-to-use level to the ini file.

Also this will only count the players who's level is more than or equal to 1.
If you want the script to count all players in the server, no matter what their level is, then use this instead:

Code: [Select]
elseif ($2 == !players) || ($2 == !pmplayers) {
  if ($vcmp.cmdcheck(!players,%id) == fail) !halt
  else {
    var %aa = 0,%bb = 0
    while (%aa <= 50) {
      if ($vcmp.name(%aa) != Unknown) {
        inc %bb
      }
      inc %aa
    }
    vcmp.cmdsay $2 %id Online Players: $+($chr(90),%bb,/30,$chr(91))
  }
}

Offline mbalee

  • Street Thug
  • *
  • Posts: 32
    • View Profile
    • Hungarian GTA Site
Re: Need little help!
« Reply #4 on: December 03, 2007, 08:43:08 pm »
sorry, but your command is wrong! :S :(

writes this to me: Z1/30

Offline Mex

  • Wiseguy
  • **
  • Posts: 63
    • View Profile
Re: Need little help!
« Reply #5 on: December 03, 2007, 10:11:40 pm »
Hey sorry about that, I used the wrong ASCII values.
Here they are again fixed:

Code: [Select]
elseif ($2 == !players) || ($2 == !pmplayers) {
  if ($vcmp.cmdcheck(!players,%id) == fail) !halt
  else {
    var %aa = 0,%bb = 0
    while (%aa <= 30) {
      if ($vcmp.level(%aa) >= 1) {
        inc %bb
      }
      inc %aa
    }
    vcmp.cmdsay $2 %id Online Players: $+($chr(91),%bb,/30,$chr(93))
  }
}

Code: [Select]
elseif ($2 == !players) || ($2 == !pmplayers) {
  if ($vcmp.cmdcheck(!players,%id) == fail) !halt
  else {
    var %aa = 0,%bb = 0
    while (%aa <= 30) {
      if ($vcmp.name(%aa) != Unknown) {
        inc %bb
      }
      inc %aa
    }
    vcmp.cmdsay $2 %id Online Players: $+($chr(91),%bb,/30,$chr(93))
  }
}

Also this will now only check for up to 30 players, as I assumed your server had a max players of 30.

Offline mbalee

  • Street Thug
  • *
  • Posts: 32
    • View Profile
    • Hungarian GTA Site
Re: Need little help!
« Reply #6 on: December 04, 2007, 09:32:39 pm »
Sry..., but what is this???!!!

I was not curious about this!!!!

$calc...

NOT [ and ] CHARACTERS!!
To count out the on-line players!
Please!

Offline Mex

  • Wiseguy
  • **
  • Posts: 63
    • View Profile
Re: Need little help!
« Reply #7 on: December 04, 2007, 09:39:10 pm »
... Online Players: [17/30]

NOT [ and ] CHARACTERS!!

Ok then try this.

Code: [Select]
elseif ($2 == !players) || ($2 == !pmplayers) {
  if ($vcmp.cmdcheck(!players,%id) == fail) !halt
  else {
    var %aa = 0,%bb = 0
    while (%aa <= 30) {
      if ($vcmp.name(%aa) != Unknown) {
        inc %bb
      }
      inc %aa
    }
    vcmp.cmdsay $2 %id Online Players: %bb $+ /30
  }
}

Offline mbalee

  • Street Thug
  • *
  • Posts: 32
    • View Profile
    • Hungarian GTA Site
Re: Need little help!
« Reply #8 on: December 04, 2007, 10:13:18 pm »
OK! Sry, I was me the idiotic. Works.