• Welcome to Vice City Multiplayer.
 

Need little help!

Started by mbalee, December 01, 2007, 03:12:36 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

mbalee

  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???

Mex

Hey, what exactly are you trying to do?

Also you haven't displayed the %bb variable, so try replacing
*$calc...
with
%bb

mbalee

I would like it with numbers!

... Online Players: [17/30]

Mex

Ah ok, if you only want the numbers displayed and not the player's names then this should work:

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:

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

mbalee

sorry, but your command is wrong! :S :(

writes this to me: Z1/30

Mex

Hey sorry about that, I used the wrong ASCII values.
Here they are again fixed:

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


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.

mbalee

Sry..., but what is this???!!!

I was not curious about this!!!!

$calc...

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

Mex

Quote from: mbalee on December 02, 2007, 12:00:40 PM
... Online Players: [17/30]

Quote from: mbalee on December 04, 2007, 06:32:39 PM
NOT [ and ] CHARACTERS!!

Ok then try this.

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
  }
}

mbalee

OK! Sry, I was me the idiotic. Works.