Author Topic: Ratio Problem..  (Read 3633 times)

0 Members and 1 Guest are viewing this topic.

Offline Amenine

  • Street Thug
  • *
  • Posts: 47
  • [UCG]Clan Leader -Scripter/Fighter/XE MoD-
    • View Profile
    • UCG
Ratio Problem..
« on: December 30, 2008, 06:27:31 pm »
Here ..its not working..anything wrong in it,,
Code:
Code: [Select]
elseif ($2 == !danger) {
    var %a = 0,%c = -100
    while (%aa <= %MaxPlayers) {
      if ((%ratio > %c) var %b = $vcmp.name(%a),%c = %ratio
      elseif ((%ratio == %c) {
        if ($vcmp.kills(%b) > $vcmp.kills(%a)) { }
        elseif ($vcmp.kills(%b) < $vcmp.kills(%a)) var %b = $vcmp.name(%a),%c = %ratio
      }
      !inc %aa
    }
    if (%b) vcmp.say == %b is the most dangerous player with a ratio of %c
    else { }
  }

Thanks
Amenine

Offline Force

  • LU Developer
  • Made Man
  • *
  • Posts: 242
    • View Profile
Re: Ratio Problem..
« Reply #1 on: December 30, 2008, 06:57:08 pm »
I don't see the %aa or %ratio variable defined there....

Offline Amenine

  • Street Thug
  • *
  • Posts: 47
  • [UCG]Clan Leader -Scripter/Fighter/XE MoD-
    • View Profile
    • UCG
Re: Ratio Problem..
« Reply #2 on: December 30, 2008, 07:41:17 pm »
What do u mean??
Means:How it shows the ratio of the player..??

Edit:[/b
Code: [Select]
]:var %ratio = $round($calc($vcmp.kills(%a) / $vcmp.deaths(%a)),2)..This..??

Confusing
Amenine
« Last Edit: December 30, 2008, 07:43:21 pm by Amenine »

Offline Force

  • LU Developer
  • Made Man
  • *
  • Posts: 242
    • View Profile
Re: Ratio Problem..
« Reply #3 on: December 30, 2008, 08:08:22 pm »
You can't take a variable from somewhere else in the script, it has to be under the particular part.

Aka, If you had this:

Code: [Select]
var %ratio = blalh
vcmp.say Stats: Blalh - Kills: 11111 - Deaths: 1111 - Ratio: %ratio

You can't then do:

Code: [Select]
elseif ($2 == !danger) {
    var %a = 0,%c = -100
    while (%aa <= %MaxPlayers) {
      if ((%ratio > %c) var %b = $vcmp.name(%a),%c = %ratio
      elseif ((%ratio == %c) {
        if ($vcmp.kills(%b) > $vcmp.kills(%a)) { }
        elseif ($vcmp.kills(%b) < $vcmp.kills(%a)) var %b = $vcmp.name(%a),%c = %ratio
      }
      !inc %aa
    }
    if (%b) vcmp.say == %b is the most dangerous player with a ratio of %c
    else { }
  }

because it doesn't know where the %ratio variable is. Same applies for the missing %aa variable you have but your using.

Offline [NoN]Toiletduck

  • Wiseguy
  • **
  • Posts: 65
    • View Profile
Re: Ratio Problem..
« Reply #4 on: January 11, 2009, 12:34:45 pm »
I found the problem with Amenine's script is that he removed half of the script.

Code: [Select]
  elseif (!stat* iswm $2) || (!pmstat* iswm $2) {
    var %ratio = $round($calc($vcmp.kills(%a) / $vcmp.deaths(%a)),2)
    if ($vcmp.cmdcheck(!stats,%id) == fail) !halt
    elseif (%a == -1) vcmp.msg %id Error - Absent ID/Name
    else vcmp.say $vcmp.name(%a) $+ 's Stats - Joins: $vcmp.joins(%a) $+ , Kills: $vcmp.kills(%a) $+ , Deaths: $vcmp.deaths(%a) $+ , Ratio: %ratio ,
  }