Vice City Multiplayer

VC:MP => mIRC/pawn Scripting => Topic started by: mbalee on December 01, 2007, 04:12:36 PM

Title: Need little help!
Post by: mbalee on December 01, 2007, 04: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???
Title: Re: Need little help!
Post by: Mex on December 01, 2007, 08:31:38 PM
Hey, what exactly are you trying to do?

Also you haven't displayed the %bb variable, so try replacing
*$calc...
with
%bb
Title: Re: Need little help!
Post by: mbalee on December 02, 2007, 01:00:40 PM
I would like it with numbers!

... Online Players: [17/30]
Title: Re: Need little help!
Post by: Mex on December 02, 2007, 10:12:53 PM
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))
  }
}
Title: Re: Need little help!
Post by: mbalee on December 03, 2007, 06:43:08 PM
sorry, but your command is wrong! :S :(

writes this to me: Z1/30
Title: Re: Need little help!
Post by: Mex on December 03, 2007, 08:11:40 PM
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.
Title: Re: Need little help!
Post by: mbalee on December 04, 2007, 07: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!
Title: Re: Need little help!
Post by: Mex on December 04, 2007, 07:39:10 PM
Quote from: mbalee on December 02, 2007, 01:00:40 PM
... Online Players: [17/30]

Quote from: mbalee on December 04, 2007, 07: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
  }
}
Title: Re: Need little help!
Post by: mbalee on December 04, 2007, 08:13:18 PM
OK! Sry, I was me the idiotic. Works.